fix pylint issues
This commit is contained in:
Родитель
e4e586ef56
Коммит
109ae0f7c9
|
@ -42,31 +42,33 @@ def get_docker_templates(language, port):
|
|||
def get_helm_charts(language, acr_details, port):
|
||||
language_packs_path = get_supported_language_packs_path(language)
|
||||
files = []
|
||||
if language_packs_path:
|
||||
try:
|
||||
abs_pack_path = FILE_ABSOLUTE_PATH + language_packs_path
|
||||
# r=root, d=directories, f = files
|
||||
logger.debug("Checking in helm charts")
|
||||
for r, _d, f in os.walk(abs_pack_path):
|
||||
if 'charts' in r:
|
||||
for file in f:
|
||||
if '__pycache__' not in r and '__init__.py' not in file:
|
||||
file_path = os.path.join(r, file)
|
||||
file_content = get_file_content(file_path)
|
||||
# replace values in charts
|
||||
if 'values.yaml' in file_path:
|
||||
logger.debug("Replacing values in values.yaml")
|
||||
file_content = replace_values(file_content, acr_details)
|
||||
file_content = replace_port(file_content, port)
|
||||
if file_path.startswith(abs_pack_path):
|
||||
file_path = file_path[len(abs_pack_path):]
|
||||
file_path = file_path.replace('\\', '/')
|
||||
file_obj = Files(path=file_path, content=file_content)
|
||||
logger.debug("Checkin file path: %s", file_path)
|
||||
logger.debug("Checkin file content: %s", file_content)
|
||||
files.append(file_obj)
|
||||
except Exception as ex:
|
||||
raise CLIError(ex)
|
||||
if not language_packs_path:
|
||||
return files
|
||||
try:
|
||||
abs_pack_path = FILE_ABSOLUTE_PATH + language_packs_path
|
||||
# r=root, d=directories, f = files
|
||||
logger.debug("Checking in helm charts")
|
||||
for r, _d, f in os.walk(abs_pack_path):
|
||||
if not 'charts' in r:
|
||||
continue
|
||||
for file in f:
|
||||
if '__pycache__' not in r and '__init__.py' not in file:
|
||||
file_path = os.path.join(r, file)
|
||||
file_content = get_file_content(file_path)
|
||||
# replace values in charts
|
||||
if 'values.yaml' in file_path:
|
||||
logger.debug("Replacing values in values.yaml")
|
||||
file_content = replace_values(file_content, acr_details)
|
||||
file_content = replace_port(file_content, port)
|
||||
if file_path.startswith(abs_pack_path):
|
||||
file_path = file_path[len(abs_pack_path):]
|
||||
file_path = file_path.replace('\\', '/')
|
||||
file_obj = Files(path=file_path, content=file_content)
|
||||
logger.debug("Checkin file path: %s", file_path)
|
||||
logger.debug("Checkin file content: %s", file_content)
|
||||
files.append(file_obj)
|
||||
except Exception as ex:
|
||||
raise CLIError(ex)
|
||||
return files
|
||||
|
||||
|
||||
|
|
|
@ -169,8 +169,8 @@ def choose_supported_language(languages):
|
|||
first_language = list_languages[0]
|
||||
if first_language in ('JavaScript', 'Java', 'Python'):
|
||||
return first_language
|
||||
elif len(list_languages) >= 1 and list_languages[1] in ('JavaScript', 'Java', 'Python'):
|
||||
if len(list_languages) >= 1 and list_languages[1] in ('JavaScript', 'Java', 'Python'):
|
||||
return list_languages[1]
|
||||
elif len(list_languages) >= 2 and list_languages[2] in ('JavaScript', 'Java', 'Python'):
|
||||
if len(list_languages) >= 2 and list_languages[2] in ('JavaScript', 'Java', 'Python'):
|
||||
return list_languages[2]
|
||||
return None
|
||||
|
|
|
@ -132,6 +132,7 @@ def get_acr_details(name=None):
|
|||
acr_details = acr_list[registry_choice]
|
||||
return acr_details
|
||||
|
||||
|
||||
def get_sku():
|
||||
sku_list = ['Basic','Classic', 'Premium', 'Standard']
|
||||
sku_choice = prompt_user_friendly_choice_list(
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
try:
|
||||
from urllib.parse import urlparse, quote
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
from urlparse import urlparse
|
||||
|
||||
from knack.log import get_logger
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
from knack.log import get_logger
|
||||
from knack.util import CLIError
|
||||
from azext_aks_deploy.dev.common.prompting import prompt_user_friendly_choice_list
|
||||
from azext_aks_deploy.dev.common.azure_cli_resources import get_default_subscription_info
|
||||
|
||||
|
@ -14,7 +13,7 @@ logger = get_logger(__name__)
|
|||
def get_azure_credentials():
|
||||
import subprocess
|
||||
import json
|
||||
subscription_id, subscription_name, tenant_id, environment_name = get_default_subscription_info()
|
||||
_subscription_id, _subscription_name, _tenant_id, _environment_name = get_default_subscription_info()
|
||||
azure_creds_user_choice = 1
|
||||
print('')
|
||||
print('You need to include the following key value pairs as part of your Secrets in the GitHub Repo Setting.')
|
||||
|
|
|
@ -27,8 +27,8 @@ class GithubCredentialManager():
|
|||
def _create_token(self, token_prefix, note=None):
|
||||
logger.warning('We need to create a Personal Access Token to communicate with GitHub. '
|
||||
'A new PAT will be created with scopes - admin:repo_hook, repo, user.')
|
||||
logger.warning('You can set the PAT in the environment variable (%s) to avoid getting prompted for username and password.',
|
||||
AKS_UP_GITHUB_PAT_ENVKEY)
|
||||
logger.warning('You can set the PAT in the environment variable (%s) to avoid getting prompted '
|
||||
'for username and password.', AKS_UP_GITHUB_PAT_ENVKEY)
|
||||
print('')
|
||||
self.username = prompt(msg='Enter your GitHub username (leave blank for using already generated PAT): ')
|
||||
if not self.username:
|
||||
|
|
|
@ -23,7 +23,7 @@ def poll_workflow_status(repo_name, check_run_id):
|
|||
spinner.step()
|
||||
time.sleep(0.5)
|
||||
check_run_status, check_run_conclusion = get_check_run_status_and_conclusion(repo_name, check_run_id)
|
||||
if check_run_status == 'in_progress' or check_run_status == 'completed':
|
||||
if check_run_status in ('in_progress', 'completed'):
|
||||
break
|
||||
colorama.deinit()
|
||||
if check_run_status == 'in_progress':
|
||||
|
|
|
@ -60,7 +60,6 @@ def functionapp_deploy(repository=None, skip_secrets_generation=False, do_not_wa
|
|||
|
||||
if not do_not_wait:
|
||||
poll_workflow_status(repo_name, check_run_id)
|
||||
return
|
||||
|
||||
|
||||
def get_yaml_template_for_repo(_functionapp_name, _repo_name):
|
||||
|
@ -75,8 +74,8 @@ def choose_supported_language(languages):
|
|||
first_language = list_languages[0]
|
||||
if first_language in ('JavaScript', 'Java', 'Python'):
|
||||
return first_language
|
||||
elif len(list_languages) >= 1 and list_languages[1] in ('JavaScript', 'Java', 'Python'):
|
||||
if len(list_languages) >= 1 and list_languages[1] in ('JavaScript', 'Java', 'Python'):
|
||||
return list_languages[1]
|
||||
elif len(list_languages) >= 2 and list_languages[2] in ('JavaScript', 'Java', 'Python'):
|
||||
if len(list_languages) >= 2 and list_languages[2] in ('JavaScript', 'Java', 'Python'):
|
||||
return list_languages[2]
|
||||
return None
|
||||
|
|
Загрузка…
Ссылка в новой задаче