Alon Bar-Lev has uploaded a new change for review.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
bootstrap: return proper exit code from bootstrap scripts
This is quick and dirty solution to return valid exit code from bootstrap scripts, until now exit code of vds_bootstrap* was wrong, however the vds_bootstrap.py did not check for exit code at all, and... engine did not as well.
Now engine checks return code so proper code is requried.
Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Signed-off-by: Alon Bar-Lev alonbl@redhat.com --- M vds_bootstrap/setup M vds_bootstrap/vds_bootstrap.py M vds_bootstrap/vds_bootstrap_complete.py 3 files changed, 32 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/7301/1
diff --git a/vds_bootstrap/setup b/vds_bootstrap/setup index 966b457..d3352d7 100755 --- a/vds_bootstrap/setup +++ b/vds_bootstrap/setup @@ -173,11 +173,16 @@ execfn += [random_num] execfn.append(str(int(rebootAfterInstallation))) logging.debug("trying to run %s script cmd = '%s'",script, string.join(execfn, " ")) - subprocess.Popen(execfn).communicate() + proc = subprocess.Popen(execfn) + proc.communicate() + if proc.returncode == 0: + return True else: logging.debug("script %s doen not exist",script) except: logging.error(traceback.format_exc()) + + return False
def process_ovirt_platform(url_bs, engine_port, random_num, systime, engine_ssh_key):
@@ -340,7 +345,24 @@ else: vds_script = './vds_bootstrap_complete.py'
- runInstaller(bootstrap_interface_version, remote_nfs, orgName, systime, vds_config_str, url_rpm, vds_server, random_num, vds_script, vds_complete, firewall_rules_file, engine_ssh_key, rebootAfterInstallation, installVirtualizationService, installGlusterService) + if not runInstaller( + bootstrap_interface_version, + remote_nfs, + orgName, + systime, + vds_config_str, + url_rpm, + vds_server, + random_num, + vds_script, + vds_complete, + firewall_rules_file, + engine_ssh_key, + rebootAfterInstallation, + installVirtualizationService, + installGlusterService): + return False + if firewall_rules_file is not None: try: os.unlink(firewall_rules_file) diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py index cb38ef1..8211c81 100755 --- a/vds_bootstrap/vds_bootstrap.py +++ b/vds_bootstrap/vds_bootstrap.py @@ -984,7 +984,7 @@ # rev_num = REVISION except: print main.__doc__ - return 0 + return False
logging.debug('**** Start VDS Validation ****') try: @@ -995,7 +995,7 @@ logging.error(main.__doc__) logging.debug("<BSTRAP component='RHEV_INSTALL' status='FAIL'/>") print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" - return 0 + return False else: message = ("<BSTRAP component='RHEV_INSTALL' status=") if ret: @@ -1008,6 +1008,7 @@
logging.debug('**** End VDS Validation ****') sys.stdout.flush() + return ret
if __name__ == "__main__": - sys.exit(main()) + sys.exit(not main()) diff --git a/vds_bootstrap/vds_bootstrap_complete.py b/vds_bootstrap/vds_bootstrap_complete.py index a333842..7711d82 100755 --- a/vds_bootstrap/vds_bootstrap_complete.py +++ b/vds_bootstrap/vds_bootstrap_complete.py @@ -88,7 +88,7 @@ rnum = args[0] except: print main.__doc__ - return 0 + return False try: arg = int(args[1]) except: @@ -119,5 +119,7 @@ print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" sys.stdout.flush()
+ return res + if __name__ == "__main__": - sys.exit(main()) + sys.exit(not main())
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com