Commit c803b052 authored by Iustin Pop's avatar Iustin Pop
Browse files

RunCmd: log command line for missing cmd case



In case of missing programs, currently utils.RunCmd doesn't show any
information to help debugging, only 'No such file or directory'. This
patch adds error handling for the ENOENT case such that at least we have
this information in the node daemon logs.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 572e52bf
......@@ -151,11 +151,18 @@ def RunCmd(cmd, env=None, output=None, cwd='/'):
if env is not None:
cmd_env.update(env)
if output is None:
out, err, status = _RunCmdPipe(cmd, cmd_env, shell, cwd)
else:
status = _RunCmdFile(cmd, cmd_env, shell, output, cwd)
out = err = ""
try:
if output is None:
out, err, status = _RunCmdPipe(cmd, cmd_env, shell, cwd)
else:
status = _RunCmdFile(cmd, cmd_env, shell, output, cwd)
out = err = ""
except OSError, err:
if err.errno == errno.ENOENT:
raise errors.OpExecError("Can't execute '%s': not found (%s)" %
(strcmd, err))
else:
raise
if status >= 0:
exitcode = status
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment