Properly report install failures from dnf module (#49760)

Reporting of install failures was improperly guarded behind a list of
packages to install when the first element changed in a list was found.
This lead to the dnf module silently failing at times when it should not
fail.

Fixes issue 49759
pull/49880/head
Greg Hellings 6 years ago committed by ansibot
parent 69988cfca0
commit af5d84b70b

@ -1087,10 +1087,10 @@ class DnfModule(YumDnf):
self.module.exit_json(**response)
else:
response['changed'] = True
if failure_response['failures']:
failure_response['msg'] = 'Failed to install some of the specified packages',
self.module.fail_json(**failure_response)
if self.module.check_mode:
if failure_response['failures']:
failure_response['msg'] = 'Failed to install some of the specified packages',
self.module.fail_json(**failure_response)
response['msg'] = "Check mode: No changes made, but would have if not in check mode"
self.module.exit_json(**response)

Loading…
Cancel
Save