in scripts/cpd_install.py [0:0]
def installAssemblies(self, assembly, icpdInstallLogFile):
"""
method to install assemlies
for each assembly this method will execute adm command to apply all prerequistes
Images will be pushed to local registry
Installation will be done for the assembly using local registry
"""
methodName = "installAssemblies"
service_tmpl = "/ibm/installDir/cpd-service.tpl.yaml"
service_cr = "/ibm/installDir/cpd-"+assembly+".yaml"
shutil.copyfile(service_tmpl,service_cr)
self.updateTemplateFile(service_cr,'${SERVICE}',assembly)
self.updateTemplateFile(service_cr,'${STORAGECLASS}',self.storageClass)
self.updateTemplateFile(service_cr,'${override-storage}', self.storageOverride)
install_cmd = "oc create -f "+service_cr
try:
TR.info(methodName,"Execute install command for assembly %s"%assembly)
retcode = call(install_cmd,shell=True, stdout=icpdInstallLogFile)
except CalledProcessError as e:
TR.error(methodName,"command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
TR.info(methodName,"Execute install command for assembly %s returned %s"%(assembly,retcode))
cr_status_cmd = "oc get cpdservice "+assembly+"-cpdservice --output='jsonpath={.status.status}' | xargs"
try:
retcode = "Installing"
while(retcode.rstrip()!="Ready"):
time.sleep(60)
retcode = check_output(['bash','-c',cr_status_cmd])
TR.info(methodName,"Get install status for assembly %s is %s"%(assembly,retcode))
if(retcode.rstrip() == "Failed"):
TR.error(methodName,"Installation of assembly %s Failed"%assembly)
raise Exception("Installation of assembly %s Failed"%assembly)
TR.info(methodName,"Get install status for assembly %s is %s"%(assembly,retcode))
except CalledProcessError as e:
TR.error(methodName,"command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))