1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed inline for more compatibility

This commit is contained in:
Alexander Winkler 2015-12-29 08:02:13 +01:00 committed by Matt Clay
parent c730bd6f1c
commit dca9d618f0

View file

@ -154,7 +154,11 @@ def main():
if len(out) > 75: if len(out) > 75:
out = out[:75] + '...' out = out[:75] + '...'
if rc != 0: if rc != 0:
module.fail_json(msg=err if err else out) if err:
msg = err
else:
msg = out
module.fail_json(msg=msg)
elif state == 'latest': elif state == 'latest':
if not package_installed(module, name): if not package_installed(module, name):
@ -164,7 +168,12 @@ def main():
if len(out) > 75: if len(out) > 75:
out = out[:75] + '...' out = out[:75] + '...'
if rc != 0: if rc != 0:
module.fail_json(msg=err if err else out) if err:
msg = err
else:
msg = out
module.fail_json(msg=msg)
else: else:
if not package_latest(module, name, site): if not package_latest(module, name, site):
if module.check_mode: if module.check_mode:
@ -173,7 +182,11 @@ def main():
if len(out) > 75: if len(out) > 75:
out = out[:75] + '...' out = out[:75] + '...'
if rc != 0: if rc != 0:
module.fail_json(msg=err if err else out) if err:
msg = err
else:
msg = out
module.fail_json(msg=msg)
elif state == 'absent': elif state == 'absent':
if package_installed(module, name): if package_installed(module, name):
@ -183,7 +196,11 @@ def main():
if len(out) > 75: if len(out) > 75:
out = out[:75] + '...' out = out[:75] + '...'
if rc != 0: if rc != 0:
module.fail_json(msg=err if err else out) if err:
msg = err
else:
msg = out
module.fail_json(msg=msg)
if rc is None: if rc is None:
# pkgutil was not executed because the package was already present/absent # pkgutil was not executed because the package was already present/absent