Merge pull request #4285 from blair/apt-module-register-stdout-stderr
apt: pass child process stdout and stdout to m.fail_json() and m.exit_js...
This commit is contained in:
commit
9faaa2b98b
1 changed files with 7 additions and 7 deletions
|
@ -256,9 +256,9 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None,
|
||||||
|
|
||||||
rc, out, err = m.run_command(cmd)
|
rc, out, err = m.run_command(cmd)
|
||||||
if rc:
|
if rc:
|
||||||
m.fail_json(msg="'apt-get install %s' failed: %s" % (packages, err))
|
m.fail_json(msg="'apt-get install %s' failed: %s" % (packages, err), stdout=out, stderr=err)
|
||||||
else:
|
else:
|
||||||
m.exit_json(changed=True)
|
m.exit_json(changed=True, stdout=out, stderr=err)
|
||||||
else:
|
else:
|
||||||
m.exit_json(changed=False)
|
m.exit_json(changed=False)
|
||||||
|
|
||||||
|
@ -285,8 +285,8 @@ def remove(m, pkgspec, cache, purge=False,
|
||||||
|
|
||||||
rc, out, err = m.run_command(cmd)
|
rc, out, err = m.run_command(cmd)
|
||||||
if rc:
|
if rc:
|
||||||
m.fail_json(msg="'apt-get remove %s' failed: %s" % (packages, err))
|
m.fail_json(msg="'apt-get remove %s' failed: %s" % (packages, err), stdout=out, stderr=err)
|
||||||
m.exit_json(changed=True)
|
m.exit_json(changed=True, stdout=out, stderr=err)
|
||||||
|
|
||||||
def upgrade(m, mode="yes", force=False,
|
def upgrade(m, mode="yes", force=False,
|
||||||
dpkg_options=expand_dpkg_options(DPKG_OPTIONS)):
|
dpkg_options=expand_dpkg_options(DPKG_OPTIONS)):
|
||||||
|
@ -319,10 +319,10 @@ def upgrade(m, mode="yes", force=False,
|
||||||
force_yes, check_arg, upgrade_command)
|
force_yes, check_arg, upgrade_command)
|
||||||
rc, out, err = m.run_command(cmd)
|
rc, out, err = m.run_command(cmd)
|
||||||
if rc:
|
if rc:
|
||||||
m.fail_json(msg="'%s %s' failed: %s" % (apt_cmd, upgrade_command, err))
|
m.fail_json(msg="'%s %s' failed: %s" % (apt_cmd, upgrade_command, err), stdout=out, stderr=err)
|
||||||
if (apt_cmd == APT_GET_CMD and APT_GET_ZERO in out) or (apt_cmd == APTITUDE_CMD and APTITUDE_ZERO in out):
|
if (apt_cmd == APT_GET_CMD and APT_GET_ZERO in out) or (apt_cmd == APTITUDE_CMD and APTITUDE_ZERO in out):
|
||||||
m.exit_json(changed=False, msg=out)
|
m.exit_json(changed=False, msg=out, stdout=out, stderr=err)
|
||||||
m.exit_json(changed=True, msg=out)
|
m.exit_json(changed=True, msg=out, stdout=out, stderr=err)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
Loading…
Reference in a new issue