mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 08:13:08 +00:00
Revert "dnf: Call dnf.Base.close() before exit to cleanup. (#41810)"
This reverts commit 32436ea9a5.
This commit is contained in:
committed by
Toshio Kuratomi
parent
29a62038b7
commit
09eac6bab9
@@ -287,7 +287,6 @@ def list_items(module, base, command):
|
||||
packages = dnf.subject.Subject(command).get_best_query(base.sack)
|
||||
results = [_package_dict(package) for package in packages]
|
||||
|
||||
base.close()
|
||||
module.exit_json(results=results)
|
||||
|
||||
|
||||
@@ -296,7 +295,6 @@ def _mark_package_install(module, base, pkg_spec):
|
||||
try:
|
||||
base.install(pkg_spec)
|
||||
except dnf.exceptions.MarkingError:
|
||||
base.close()
|
||||
module.fail_json(msg="No package {0} available.".format(pkg_spec))
|
||||
|
||||
|
||||
@@ -355,7 +353,6 @@ def ensure(module, base, state, names, autoremove):
|
||||
if environment:
|
||||
environments.append(environment.id)
|
||||
else:
|
||||
base.close()
|
||||
module.fail_json(
|
||||
msg="No group {0} available.".format(group_spec))
|
||||
|
||||
@@ -422,7 +419,6 @@ def ensure(module, base, state, names, autoremove):
|
||||
base.conf.clean_requirements_on_remove = autoremove
|
||||
|
||||
if filenames:
|
||||
base.close()
|
||||
module.fail_json(
|
||||
msg="Cannot remove paths -- please specify package name.")
|
||||
|
||||
@@ -454,20 +450,16 @@ def ensure(module, base, state, names, autoremove):
|
||||
|
||||
if not base.resolve(allow_erasing=allow_erasing):
|
||||
if failures:
|
||||
base.close()
|
||||
module.fail_json(msg='Failed to install some of the '
|
||||
'specified packages',
|
||||
failures=failures)
|
||||
base.close()
|
||||
module.exit_json(msg="Nothing to do")
|
||||
else:
|
||||
if module.check_mode:
|
||||
if failures:
|
||||
base.close()
|
||||
module.fail_json(msg='Failed to install some of the '
|
||||
'specified packages',
|
||||
failures=failures)
|
||||
base.close()
|
||||
module.exit_json(changed=True)
|
||||
|
||||
base.download_packages(base.transaction.install_set)
|
||||
@@ -479,11 +471,9 @@ def ensure(module, base, state, names, autoremove):
|
||||
response['results'].append("Removed: {0}".format(package))
|
||||
|
||||
if failures:
|
||||
base.close()
|
||||
module.fail_json(msg='Failed to install some of the '
|
||||
'specified packages',
|
||||
failures=failures)
|
||||
base.close()
|
||||
module.exit_json(**response)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user