Merge pull request #1261 from agx/zypper-rc-status
zypper: Add returncode to result
This commit is contained in:
commit
f6a0fec577
1 changed files with 4 additions and 3 deletions
|
@ -144,7 +144,7 @@ def get_package_state(m, packages):
|
||||||
package = packages[i]
|
package = packages[i]
|
||||||
if not os.path.isfile(package) and not '://' in package:
|
if not os.path.isfile(package) and not '://' in package:
|
||||||
stderr = "No Package file matching '%s' found on system" % package
|
stderr = "No Package file matching '%s' found on system" % package
|
||||||
m.fail_json(msg=stderr)
|
m.fail_json(msg=stderr, rc=1)
|
||||||
# Get packagename from rpm file
|
# Get packagename from rpm file
|
||||||
cmd = ['/bin/rpm', '--query', '--qf', '%{NAME}', '--package']
|
cmd = ['/bin/rpm', '--query', '--qf', '%{NAME}', '--package']
|
||||||
cmd.append(package)
|
cmd.append(package)
|
||||||
|
@ -311,11 +311,12 @@ def main():
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
if stderr:
|
if stderr:
|
||||||
module.fail_json(msg=stderr)
|
module.fail_json(msg=stderr, rc=rc)
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=stdout)
|
module.fail_json(msg=stdout, rc=rc)
|
||||||
|
|
||||||
result['changed'] = changed
|
result['changed'] = changed
|
||||||
|
result['rc'] = rc
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue