Commit db1f2649 authored by Bipin's avatar Bipin Committed by Raphael Defosseux

Used Image Info in HTML

parent 6053e226
...@@ -189,16 +189,15 @@ def GetContainerName(mySSH, svcName): ...@@ -189,16 +189,15 @@ def GetContainerName(mySSH, svcName):
def GetImageInfo(mySSH, containerName): def GetImageInfo(mySSH, containerName):
usedImage = '' usedImage = ''
ret = mySSH.run('docker inspect --format="ImageUsed: {{.Config.Image}}" ' + containerName) ret = mySSH.run('docker inspect --format="{{.Config.Image}}" ' + containerName)
if ret.stdout.count('ImageUsed: oai-ci'): usedImage = ret.stdout.strip()
usedImage = ret.stdout.replace('ImageUsed: oai-ci', 'oai-ci').strip() logging.debug('Used image is: ' + usedImage)
logging.debug('Used image is ' + usedImage) if usedImage:
if usedImage != '':
ret = mySSH.run('docker image inspect --format "* Size = {{.Size}} bytes\n* Creation = {{.Created}}\n* Id = {{.Id}}" ' + usedImage) ret = mySSH.run('docker image inspect --format "* Size = {{.Size}} bytes\n* Creation = {{.Created}}\n* Id = {{.Id}}" ' + usedImage)
imageInfo = f"Used image is {usedImage}\n{ret.stdout}" imageInfo = f"Used image is {usedImage}\n{ret.stdout}\n"
return imageInfo return imageInfo
else: else:
return "Could not retrieve used image info!\n" return f"Could not retrieve used image info for {containerName}!\n"
def GetContainerHealth(mySSH, containerName): def GetContainerHealth(mySSH, containerName):
if containerName is None: if containerName is None:
...@@ -1023,6 +1022,7 @@ class Containerize(): ...@@ -1023,6 +1022,7 @@ class Containerize():
return return
services_list = allServices if self.services[self.eNB_instance].split() == [] else self.services[self.eNB_instance].split() services_list = allServices if self.services[self.eNB_instance].split() == [] else self.services[self.eNB_instance].split()
status = True status = True
imagesInfo=""
for svcName in services_list: for svcName in services_list:
containerName = GetContainerName(mySSH, svcName) containerName = GetContainerName(mySSH, svcName)
healthyNb,unhealthyNb = GetContainerHealth(mySSH,containerName) healthyNb,unhealthyNb = GetContainerHealth(mySSH,containerName)
...@@ -1032,8 +1032,9 @@ class Containerize(): ...@@ -1032,8 +1032,9 @@ class Containerize():
logging.warning(f"Deployment Failed: Trying to copy container logs {self.eNB_logFile[self.eNB_instance]}") logging.warning(f"Deployment Failed: Trying to copy container logs {self.eNB_logFile[self.eNB_instance]}")
CopyinContainerLog(mySSH,lSourcePath,self.yamlPath[0].split('/'),containerName,self.eNB_logFile[self.eNB_instance]) CopyinContainerLog(mySSH,lSourcePath,self.yamlPath[0].split('/'),containerName,self.eNB_logFile[self.eNB_instance])
status = False status = False
HTML.CreateHtmlTestRowQueue('N/A', 'OK', [(GetImageInfo(mySSH, containerName))]) imagesInfo += (GetImageInfo(mySSH, containerName))
mySSH.close() mySSH.close()
HTML.CreateHtmlTestRowQueue('N/A', 'OK', [(imagesInfo)])
if status: if status:
HTML.CreateHtmlTestRowQueue('N/A', 'OK', ['Healthy deployment!']) HTML.CreateHtmlTestRowQueue('N/A', 'OK', ['Healthy deployment!'])
else: else:
......
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