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
oVirt Jenkins CI Server has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/503/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Alon Bar-Lev has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 1: Verified
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 1: I would prefer that you didn't submit this
(1 inline comment)
script returning a boolean instead of the expected 0-127 integer is quite ugly. oh well, at least we are consistent. ack.
but one request inside.
.................................................... File vds_bootstrap/setup Line 173: execfn += [random_num] Line 174: execfn.append(str(int(rebootAfterInstallation))) Line 175: logging.debug("trying to run %s script cmd = '%s'",script, string.join(execfn, " ")) Line 176: proc = subprocess.Popen(execfn) Line 177: proc.communicate() would you please please please capture stderr and log it, and report it to Engine in the improbable case of an error? Line 178: if proc.returncode == 0: Line 179: return True Line 180: else: Line 181: logging.debug("script %s doen not exist",script)
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Alon Bar-Lev has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File vds_bootstrap/setup Line 173: execfn += [random_num] Line 174: execfn.append(str(int(rebootAfterInstallation))) Line 175: logging.debug("trying to run %s script cmd = '%s'",script, string.join(execfn, " ")) Line 176: proc = subprocess.Popen(execfn) Line 177: proc.communicate() I think we discussed this... the stderr is redirected to our stderr and go to the engine to log. Line 178: if proc.returncode == 0: Line 179: return True Line 180: else: Line 181: logging.debug("script %s doen not exist",script)
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Alon Bar-Lev has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 2:
rebased.
If you want me to do something like if main(): exit(0) else:... tell me.
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/507/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/511/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/512/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Alon Bar-Lev has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 4: Verified
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File vds_bootstrap/setup Line 173: execfn += [random_num] Line 174: execfn.append(str(int(rebootAfterInstallation))) Line 175: logging.debug("trying to run %s script cmd = '%s'",script, string.join(execfn, " ")) Line 176: proc = subprocess.Popen(execfn) Line 177: proc.communicate() I had a vague memory of having asked this once, but I do not recall this answer of yours. sorry.
I'll trust you that nowadays, stderr is not lost. stdout needs funny <BSTRAP> encoding in order to be handled by Engine. Line 178: if proc.returncode == 0: Line 179: return True Line 180: else: Line 181: logging.debug("script %s doen not exist",script)
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: bootstrap: return proper exit code from bootstrap scripts ......................................................................
Patch Set 4: Looks good to me, approved
Alon, I see no benefit in these frequent rebasing. For me, it only adds to the noise level.
Thanks for this cleanup.
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
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(-)
Approvals: Alon Bar-Lev: Verified Dan Kenigsberg: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7301 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I5cf1d2ad402641394da52099c157fc34cf49cad1 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Alon Bar-Lev alonbl@redhat.com Gerrit-Reviewer: Barak Azulay bazulay@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Douglas Schilling Landgraf dougsland@redhat.com Gerrit-Reviewer: Juan Hernandez juan.hernandez@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org