diff options
author | John Chittum <john.chittum@gmail.com> | 2022-01-04 12:14:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 11:14:19 -0700 |
commit | 137c9b0e56bf2a9d4651aeb4ceb210d85a630923 (patch) | |
tree | 476294c8599b58f76f82be17494ee63644e1df6d /tests | |
parent | d4bea4a44a0405aaf0d181d4bffff6c07d2fb5ba (diff) | |
download | vyos-cloud-init-137c9b0e56bf2a9d4651aeb4ceb210d85a630923.tar.gz vyos-cloud-init-137c9b0e56bf2a9d4651aeb4ceb210d85a630923.zip |
Update cc_ubuntu_advantage calls to assume-yes (#1158)
cloud-init currently makes calls to ubuntu_advantage without assume-yes.
some ua enable commands, such as ua enable fips, have prompts. In an
automated environment, calling ua enable without --assume-yes will
result in errors and not applying the change. This sets --assume-yes by
default for all enable commands. This capability was added two years ago
in ua commit 576e605ceb5f so should be safe for use in all systems at
this time.
LP: #1954842
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/config/test_cc_ubuntu_advantage.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/unittests/config/test_cc_ubuntu_advantage.py b/tests/unittests/config/test_cc_ubuntu_advantage.py index d7519a1b..c39e421f 100644 --- a/tests/unittests/config/test_cc_ubuntu_advantage.py +++ b/tests/unittests/config/test_cc_ubuntu_advantage.py @@ -63,7 +63,9 @@ class TestConfigureUA(CiTestCase): """all services should be enabled and then any failures raised""" def fake_subp(cmd, capture=None): - fail_cmds = [["ua", "enable", svc] for svc in ["esm", "cc"]] + fail_cmds = [ + ["ua", "enable", "--assume-yes", svc] for svc in ["esm", "cc"] + ] if cmd in fail_cmds and capture: svc = cmd[-1] raise subp.ProcessExecutionError( @@ -78,9 +80,15 @@ class TestConfigureUA(CiTestCase): m_subp.call_args_list, [ mock.call(["ua", "attach", "SomeToken"]), - mock.call(["ua", "enable", "esm"], capture=True), - mock.call(["ua", "enable", "cc"], capture=True), - mock.call(["ua", "enable", "fips"], capture=True), + mock.call( + ["ua", "enable", "--assume-yes", "esm"], capture=True + ), + mock.call( + ["ua", "enable", "--assume-yes", "cc"], capture=True + ), + mock.call( + ["ua", "enable", "--assume-yes", "fips"], capture=True + ), ], ) self.assertIn( @@ -118,7 +126,9 @@ class TestConfigureUA(CiTestCase): m_subp.call_args_list, [ mock.call(["ua", "attach", "SomeToken"]), - mock.call(["ua", "enable", "fips"], capture=True), + mock.call( + ["ua", "enable", "--assume-yes", "fips"], capture=True + ), ], ) self.assertEqual( @@ -135,7 +145,9 @@ class TestConfigureUA(CiTestCase): m_subp.call_args_list, [ mock.call(["ua", "attach", "SomeToken"]), - mock.call(["ua", "enable", "fips"], capture=True), + mock.call( + ["ua", "enable", "--assume-yes", "fips"], capture=True + ), ], ) self.assertEqual( |