Commit 65549745 authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): proper automatic undeployment

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent a88c3d2b
...@@ -289,6 +289,7 @@ class Containerize(): ...@@ -289,6 +289,7 @@ class Containerize():
self.proxyCommit = None self.proxyCommit = None
self.eNB_instance = 0 self.eNB_instance = 0
self.eNB_serverId = ['', '', ''] self.eNB_serverId = ['', '', '']
self.deployKind = [True, True, True]
self.yamlPath = ['', '', ''] self.yamlPath = ['', '', '']
self.services = ['', '', ''] self.services = ['', '', '']
self.nb_healthy = [0, 0, 0] self.nb_healthy = [0, 0, 0]
...@@ -835,6 +836,7 @@ class Containerize(): ...@@ -835,6 +836,7 @@ class Containerize():
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
logging.debug('\u001B[1m Deploying OAI Object on server: ' + lIpAddr + '\u001B[0m') logging.debug('\u001B[1m Deploying OAI Object on server: ' + lIpAddr + '\u001B[0m')
self.deployKind[self.eNB_instance] = True
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.open(lIpAddr, lUserName, lPassWord)
...@@ -1037,6 +1039,7 @@ class Containerize(): ...@@ -1037,6 +1039,7 @@ class Containerize():
logging.debug('\u001B[1m Checking Services to deploy\u001B[0m') logging.debug('\u001B[1m Checking Services to deploy\u001B[0m')
# Implicitly we are running locally # Implicitly we are running locally
myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0]) myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0])
self.deployKind[0] = False
cmd = 'docker-compose config --services' cmd = 'docker-compose config --services'
listServices = myCmd.run(cmd) listServices = myCmd.run(cmd)
if listServices.returncode != 0: if listServices.returncode != 0:
......
...@@ -1358,7 +1358,10 @@ class OaiCiTest(): ...@@ -1358,7 +1358,10 @@ class OaiCiTest():
for instance in range(0, len(CONTAINERS.yamlPath)): for instance in range(0, len(CONTAINERS.yamlPath)):
if CONTAINERS.yamlPath[instance]!='': if CONTAINERS.yamlPath[instance]!='':
CONTAINERS.eNB_instance=instance CONTAINERS.eNB_instance=instance
CONTAINERS.UndeployObject(HTML,RAN) if CONTAINERS.deployKind[instance]:
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN, self)
RAN.prematureExit=True RAN.prematureExit=True
#this function is called only if eNB/gNB fails to start #this function is called only if eNB/gNB fails to start
...@@ -1385,7 +1388,10 @@ class OaiCiTest(): ...@@ -1385,7 +1388,10 @@ class OaiCiTest():
for instance in range(0, len(CONTAINERS.yamlPath)): for instance in range(0, len(CONTAINERS.yamlPath)):
if CONTAINERS.yamlPath[instance]!='': if CONTAINERS.yamlPath[instance]!='':
CONTAINERS.eNB_instance=instance CONTAINERS.eNB_instance=instance
CONTAINERS.UndeployObject(HTML,RAN) if CONTAINERS.deployKind[instance]:
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN,self)
RAN.prematureExit=True RAN.prematureExit=True
def IdleSleep(self,HTML): def IdleSleep(self,HTML):
......
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