Handle errors in Copy_Image_to_Test_Server()
This commit is contained in:
@@ -580,8 +580,16 @@ class Containerize():
|
|||||||
lPassWord = self.eNB2Password
|
lPassWord = self.eNB2Password
|
||||||
lSsh.open(lIpAddr, lUserName, lPassWord)
|
lSsh.open(lIpAddr, lUserName, lPassWord)
|
||||||
lSsh.command('docker save ' + self.imageToCopy + ':' + imageTag + ' | gzip --fast > ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
lSsh.command('docker save ' + self.imageToCopy + ':' + imageTag + ' | gzip --fast > ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
||||||
lSsh.copyin(lIpAddr, lUserName, lPassWord, '~/' + self.imageToCopy + '-' + imageTag + '.tar.gz', '.')
|
ret = lSsh.copyin(lIpAddr, lUserName, lPassWord, '~/' + self.imageToCopy + '-' + imageTag + '.tar.gz', '.')
|
||||||
|
if ret != 0:
|
||||||
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
||||||
|
if lSsh.getBefore().count('cannot remove'):
|
||||||
|
HTML.CreateHtmlTestRow('file not created by docker save', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
lSsh.close()
|
lSsh.close()
|
||||||
|
|
||||||
# Going to the Test Server
|
# Going to the Test Server
|
||||||
@@ -599,15 +607,26 @@ class Containerize():
|
|||||||
lPassWord = self.eNB2Password
|
lPassWord = self.eNB2Password
|
||||||
lSsh.open(lIpAddr, lUserName, lPassWord)
|
lSsh.open(lIpAddr, lUserName, lPassWord)
|
||||||
lSsh.copyout(lIpAddr, lUserName, lPassWord, './' + self.imageToCopy + '-' + imageTag + '.tar.gz', '~')
|
lSsh.copyout(lIpAddr, lUserName, lPassWord, './' + self.imageToCopy + '-' + imageTag + '.tar.gz', '~')
|
||||||
|
# copyout has no return code and will quit if something fails
|
||||||
lSsh.command('docker rmi ' + self.imageToCopy + ':' + imageTag, '\$', 10)
|
lSsh.command('docker rmi ' + self.imageToCopy + ':' + imageTag, '\$', 10)
|
||||||
lSsh.command('docker load < ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
lSsh.command('docker load < ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
||||||
|
if lSsh.getBefore().count('o such file') or lSsh.getBefore().count('invalid tar header'):
|
||||||
|
logging.debug(lSsh.getBefore())
|
||||||
|
HTML.CreateHtmlTestRow('problem during docker load', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
|
||||||
|
if lSsh.getBefore().count('cannot remove'):
|
||||||
|
HTML.CreateHtmlTestRow('file not copied during scp?', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
lSsh.close()
|
lSsh.close()
|
||||||
|
|
||||||
if os.path.isfile('./' + self.imageToCopy + '-' + imageTag + '.tar.gz'):
|
if os.path.isfile('./' + self.imageToCopy + '-' + imageTag + '.tar.gz'):
|
||||||
os.remove('./' + self.imageToCopy + '-' + imageTag + '.tar.gz')
|
os.remove('./' + self.imageToCopy + '-' + imageTag + '.tar.gz')
|
||||||
|
|
||||||
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def DeployObject(self, HTML, EPC):
|
def DeployObject(self, HTML, EPC):
|
||||||
if self.eNB_serverId[self.eNB_instance] == '0':
|
if self.eNB_serverId[self.eNB_instance] == '0':
|
||||||
|
|||||||
+3
-1
@@ -921,7 +921,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
|
|||||||
elif action == 'Build_Proxy':
|
elif action == 'Build_Proxy':
|
||||||
CONTAINERS.BuildProxy(HTML)
|
CONTAINERS.BuildProxy(HTML)
|
||||||
elif action == 'Copy_Image_to_Test':
|
elif action == 'Copy_Image_to_Test':
|
||||||
CONTAINERS.Copy_Image_to_Test_Server(HTML)
|
success = CONTAINERS.Copy_Image_to_Test_Server(HTML)
|
||||||
|
if not success:
|
||||||
|
RAN.prematureExit = True
|
||||||
elif action == 'Deploy_Object':
|
elif action == 'Deploy_Object':
|
||||||
CONTAINERS.DeployObject(HTML, EPC)
|
CONTAINERS.DeployObject(HTML, EPC)
|
||||||
if CONTAINERS.exitStatus==1:
|
if CONTAINERS.exitStatus==1:
|
||||||
|
|||||||
Reference in New Issue
Block a user