Dan Kenigsberg has posted comments on this change.

Change subject: hooks: Extract function for command execution
......................................................................


Patch Set 1:

(2 comments)

....................................................
File vdsm_hooks/openstacknet/openstacknet_utils.py
Line 17: # Make pyflakes happy
Line 18: DUMMY_BRIDGE
Line 19: 
Line 20: 
Line 21: def executeOrExit(command, expectSuccess=True):
Could you point me to a such usage? searching for executeOrExit.*False found 
nothing. If this arg is indeed a must, "ignoreErrors" would be a clearer name 
imo.
Line 22:     retcode, out, err = hooking.execCmd(command, sudo=True, raw=True)
Line 23:     commandFailed = retcode != 0 if expectSuccess else retcode == 0
Line 24:     if commandFailed:
Line 25:         hooking.exit_hook("Failed to execute %s, due to: %s" %


Line 21: def executeOrExit(command, expectSuccess=True):
Line 22:     retcode, out, err = hooking.execCmd(command, sudo=True, raw=True)
Line 23:     commandFailed = retcode != 0 if expectSuccess else retcode == 0
Line 24:     if commandFailed:
Line 25:         hooking.exit_hook("Failed to execute %s, due to: %s" %
It's a genrally good practice not to exit() an application from within a 
"utils" library - the main script should take the decisions.

Yes, a simple

  if commandFailed:
     raise RuntimeError("exec failed")

would do.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id0bcc3be324d1afd9855f9d624cbe4efbf3cf6dd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Assaf Muller <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to