Add --assumeyes to yum/dnf commands in yumpkg.refresh_db

Without --assumeyes, these commands can hang waiting for
user confirmation if there is an unaccepted repository key.
This commit is contained in:
Adam Mendlik 2018-02-19 07:35:18 -07:00
parent c3a938e994
commit 8d9a432fb2
No known key found for this signature in database
GPG key ID: BD2747BB4A930106
2 changed files with 8 additions and 8 deletions

View file

@ -1025,8 +1025,8 @@ def refresh_db(**kwargs):
options = _get_options(**kwargs)
clean_cmd = [_yum(), '--quiet', 'clean', 'expire-cache']
update_cmd = [_yum(), '--quiet', 'check-update']
clean_cmd = [_yum(), '--quiet', '--assumeyes', 'clean', 'expire-cache']
update_cmd = [_yum(), '--quiet', '--assumeyes', 'check-update']
if __grains__.get('os_family') == 'RedHat' \
and __grains__.get('osmajorrelease') == 7:

View file

@ -311,11 +311,11 @@ class YumTestCase(TestCase, LoaderModuleMockMixin):
fromrepo='good',
branch='foo')
clean_cmd.assert_called_once_with(
['yum', '--quiet', 'clean', 'expire-cache', '--disablerepo=*',
['yum', '--quiet', '--assumeyes', 'clean', 'expire-cache', '--disablerepo=*',
'--enablerepo=good', '--branch=foo'],
python_shell=False)
update_cmd.assert_called_once_with(
['yum', '--quiet', 'check-update',
['yum', '--quiet', '--assumeyes', 'check-update',
'--setopt=autocheck_running_kernel=false', '--disablerepo=*',
'--enablerepo=good', '--branch=foo'],
output_loglevel='trace',
@ -333,11 +333,11 @@ class YumTestCase(TestCase, LoaderModuleMockMixin):
disablerepo='bad',
branch='foo')
clean_cmd.assert_called_once_with(
['yum', '--quiet', 'clean', 'expire-cache', '--disablerepo=bad',
['yum', '--quiet', '--assumeyes', 'clean', 'expire-cache', '--disablerepo=bad',
'--enablerepo=good', '--branch=foo'],
python_shell=False)
update_cmd.assert_called_once_with(
['yum', '--quiet', 'check-update',
['yum', '--quiet', '--assumeyes', 'check-update',
'--setopt=autocheck_running_kernel=false', '--disablerepo=bad',
'--enablerepo=good', '--branch=foo'],
output_loglevel='trace',
@ -354,7 +354,7 @@ class YumTestCase(TestCase, LoaderModuleMockMixin):
fromrepo='good',
branch='foo')
clean_cmd.assert_called_once_with(
['yum', '--quiet', 'clean', 'expire-cache', '--disablerepo=*',
['yum', '--quiet', '--assumeyes', 'clean', 'expire-cache', '--disablerepo=*',
'--enablerepo=good', '--branch=foo'],
python_shell=False)
@ -367,7 +367,7 @@ class YumTestCase(TestCase, LoaderModuleMockMixin):
disablerepo='bad',
branch='foo')
clean_cmd.assert_called_once_with(
['yum', '--quiet', 'clean', 'expire-cache', '--disablerepo=bad',
['yum', '--quiet', '--assumeyes', 'clean', 'expire-cache', '--disablerepo=bad',
'--enablerepo=good', '--branch=foo'],
python_shell=False)