Skip to content

Commit

Permalink
dnf_config_manager: use --assumeyes when changing state (#9124)
Browse files Browse the repository at this point in the history
* dnf_config_manager: use --assumeyesm when changing state

* changelog fragment

* update tests

* format fix

* Update changelogs/fragments/9124-dnf_config_manager.yml

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
  • Loading branch information
ahyattdev and russoz authored Nov 17, 2024
1 parent 626c0e1 commit 36c7e56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/9124-dnf_config_manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- dnf_config_manager - fix hanging when prompting to import GPG keys (https://github.com/ansible-collections/community.general/pull/9124, https://github.com/ansible-collections/community.general/issues/8830).
2 changes: 1 addition & 1 deletion plugins/modules/dnf_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_repo_states(module):


def set_repo_states(module, repo_ids, state):
module.run_command([DNF_BIN, 'config-manager', '--set-{0}'.format(state)] + repo_ids, check_rc=True)
module.run_command([DNF_BIN, 'config-manager', '--assumeyes', '--set-{0}'.format(state)] + repo_ids, check_rc=True)


def pack_repo_states_for_return(states):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/plugins/modules/test_dnf_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@
'rpmfusion-nonfree-updates']}

call_get_repo_states = call(['/usr/bin/dnf', 'repolist', '--all', '--verbose'], check_rc=True)
call_disable_crb = call(['/usr/bin/dnf', 'config-manager', '--set-disabled', 'crb'], check_rc=True)
call_enable_crb = call(['/usr/bin/dnf', 'config-manager', '--set-enabled', 'crb'], check_rc=True)
call_disable_crb = call(['/usr/bin/dnf', 'config-manager', '--assumeyes', '--set-disabled', 'crb'], check_rc=True)
call_enable_crb = call(['/usr/bin/dnf', 'config-manager', '--assumeyes', '--set-enabled', 'crb'], check_rc=True)


class TestDNFConfigManager(ModuleTestCase):
Expand Down

0 comments on commit 36c7e56

Please sign in to comment.