Change in vdsm[master]: Extend vdsm-tool commands - retrieving host uuid by utils.ge...

Alon Bar-Lev alonbl at redhat.com
Tue May 21 17:57:50 UTC 2013


Alon Bar-Lev has posted comments on this change.

Change subject: Extend vdsm-tool commands - retrieving host uuid by utils.getHostUUID
......................................................................


Patch Set 7: (1 inline comment)

....................................................
File lib/vdsm/tool/vdsm-id.py
Line 32:         hostUUID = getHostUUID(False)
Line 33:         if hostUUID is None:
Line 34:             raise RuntimeError('Cannot retrieve host UUID')
Line 35:         sys.stdout.write(hostUUID)
Line 36:     except RuntimeError:
I am by far not python expert... but I expected:

 except:
     traceback.print_exc(file=sys.stderr)
     sys.exit(1)

But question... isn't the method that calls the getUUID() function catches exceptions and exists?

Well... no... ./vdsm-tool/vdsm-tool

But once reading this source I figure out that you really need to return exit code not exit... and you do need to return 0 in case of success...

so it need to be:

 def xxx():
     ret = 1
     try:
         bla
         ret = 0
     except:
         traceback.print_exc(file=sys.stderr)
     return ret

danken... I really think an except clause should be added to ./vdsm-tool/vdsm-tool and not added to each command...
Line 37:         sys.stderr.write(traceback.format_exc())


--
To view, visit http://gerrit.ovirt.org/14866
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia8cab7f55697e07479a4f35c161bd836925374e8
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list