add logging
This commit is contained in:
Родитель
cc5e919cfd
Коммит
957b17ee1b
|
@ -6,4 +6,4 @@
|
|||
|
||||
def load_aks_arguments(self, _):
|
||||
with self.argument_context('aks up') as context:
|
||||
context.argument('pat', options_list='--pat')
|
||||
context.argument('repository', options_list=('--repository', '-r'))
|
||||
|
|
|
@ -19,7 +19,9 @@ FILE_ABSOLUTE_PATH = abspath(dirname(dirname(abspath(__file__))))
|
|||
def get_docker_templates(language, port):
|
||||
files = []
|
||||
language_packs_path = get_supported_language_packs_path(language)
|
||||
if language_packs_path:
|
||||
if not language_packs_path:
|
||||
logger.debug('get_docker_templates(): No language packs found.')
|
||||
else:
|
||||
docker_file_path = r'Dockerfile'
|
||||
file_path = FILE_ABSOLUTE_PATH + language_packs_path + docker_file_path
|
||||
file_content = get_file_content(file_path)
|
||||
|
@ -43,32 +45,33 @@ def get_helm_charts(language, acr_details, port):
|
|||
language_packs_path = get_supported_language_packs_path(language)
|
||||
files = []
|
||||
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 'charts' not 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)
|
||||
logger.debug('get_helm_charts(): No language packs found.')
|
||||
else:
|
||||
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' not 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
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче