Commit ddcb216a authored by Robert Schmidt's avatar Robert Schmidt

Improve logging in CI Undeploy/DeployObject()

Consistently print requested services (if applicable)
and outcome of the step.
parent 247e908b
...@@ -716,7 +716,6 @@ class Containerize(): ...@@ -716,7 +716,6 @@ class Containerize():
def DeployObject(self, ctx, node, HTML): def DeployObject(self, ctx, node, HTML):
num_attempts = self.num_attempts num_attempts = self.num_attempts
lSourcePath = self.eNBSourceCodePath lSourcePath = self.eNBSourceCodePath
logging.debug(f'Deploying OAI Object on server: {node}')
yaml = self.yamlPath.strip('/') yaml = self.yamlPath.strip('/')
wd = f'{lSourcePath}/{yaml}' wd = f'{lSourcePath}/{yaml}'
wd_yaml = f'{wd}/docker-compose.y*ml' wd_yaml = f'{wd}/docker-compose.y*ml'
...@@ -727,6 +726,7 @@ class Containerize(): ...@@ -727,6 +726,7 @@ class Containerize():
logging.error(msg) logging.error(msg)
HTML.CreateHtmlTestRowQueue('N/A', 'KO', [msg]) HTML.CreateHtmlTestRowQueue('N/A', 'KO', [msg])
return False return False
logging.info(f'\u001B[1mDeploying object(s) "{services}" on server {node}\u001B[0m')
ExistEnvFilePrint(ssh, wd) ExistEnvFilePrint(ssh, wd)
WriteEnvFile(ssh, services, wd, self.deploymentTag, self.flexricTag) WriteEnvFile(ssh, services, wd, self.deploymentTag, self.flexricTag)
if num_attempts <= 0: if num_attempts <= 0:
...@@ -751,14 +751,16 @@ class Containerize(): ...@@ -751,14 +751,16 @@ class Containerize():
imagesInfo = info.stdout.splitlines()[1:] imagesInfo = info.stdout.splitlines()[1:]
logging.debug(f'{info.stdout.splitlines()[1:]}') logging.debug(f'{info.stdout.splitlines()[1:]}')
if deployed: if deployed:
HTML.CreateHtmlTestRowQueue('N/A', 'OK', ['\n'.join(imagesInfo)]) HTML.CreateHtmlTestRowQueue(self.services, 'OK', ['\n'.join(imagesInfo)])
logging.info('\u001B[1m Deploying objects Pass\u001B[0m')
else: else:
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ['\n'.join(imagesInfo)]) HTML.CreateHtmlTestRowQueue(self.services, 'KO', ['\n'.join(imagesInfo)])
logging.error('\u001B[1m Deploying objects Failed\u001B[0m')
return deployed return deployed
def UndeployObject(self, ctx, node, HTML, RAN): def UndeployObject(self, ctx, node, HTML, RAN):
lSourcePath = self.eNBSourceCodePath lSourcePath = self.eNBSourceCodePath
logging.debug(f'\u001B[1m Undeploying OAI Object from server: {node}\u001B[0m') logging.info(f'\u001B[1m Undeploying all objects from server {node}\u001B[0m')
yaml = self.yamlPath.strip('/') yaml = self.yamlPath.strip('/')
wd = f'{lSourcePath}/{yaml}' wd = f'{lSourcePath}/{yaml}'
wd_yaml = f'{wd}/docker-compose.y*ml' wd_yaml = f'{wd}/docker-compose.y*ml'
...@@ -781,7 +783,7 @@ class Containerize(): ...@@ -781,7 +783,7 @@ class Containerize():
log_results = [CheckLogs(self, f, HTML, RAN) for f in copyin_res] log_results = [CheckLogs(self, f, HTML, RAN) for f in copyin_res]
success = all(log_results) success = all(log_results)
if success: if success:
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') logging.info('\u001B[1m Undeploying objects Pass\u001B[0m')
else: else:
logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m') logging.error('\u001B[1m Undeploying objects Failed\u001B[0m')
return success return success
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment