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 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" % Usually it's not nice for a module to explicitly shut down its controlling application. From the usage in a future patch it seems that this could be replaced by raising an exception.
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 26: (str(command), err)) no need to call str(). %s does this automatically, and better.