Add detection of package manager for undercloud upgrade
In [1] we removed protection for yum not being available.
We should get it back for train because it may still run on
centos-7 and have yum.
[1] 9c53cb3ef5
2. Removed redundant jobs from layout to get the patch in.
Closes-Bug: #1903498
Change-Id: I5a5d942c87af1f97ebc9ff9bc7be7919af564b46
This commit is contained in:
parent
a8c84cc2ae
commit
4a5027a6a6
|
@ -564,6 +564,8 @@ class TestUndercloudUpgrade(TestPluginV1):
|
||||||
app_args.verbose_level = 1
|
app_args.verbose_level = 1
|
||||||
self.cmd = undercloud.UpgradeUndercloud(self.app, app_args)
|
self.cmd = undercloud.UpgradeUndercloud(self.app, app_args)
|
||||||
|
|
||||||
|
@mock.patch('os.system')
|
||||||
|
@mock.patch('sys.version_info')
|
||||||
@mock.patch('tripleoclient.utils.prompt_user_for_confirmation',
|
@mock.patch('tripleoclient.utils.prompt_user_for_confirmation',
|
||||||
return_value=True)
|
return_value=True)
|
||||||
@mock.patch.object(sys, 'executable', 'python2')
|
@mock.patch.object(sys, 'executable', 'python2')
|
||||||
|
@ -578,11 +580,28 @@ class TestUndercloudUpgrade(TestPluginV1):
|
||||||
mock_subprocess,
|
mock_subprocess,
|
||||||
mock_wr,
|
mock_wr,
|
||||||
mock_os, mock_copy, mock_user,
|
mock_os, mock_copy, mock_user,
|
||||||
mock_confirm):
|
mock_confirm, mock_sys,
|
||||||
|
mock_os_sys):
|
||||||
arglist = ['--no-validations']
|
arglist = ['--no-validations']
|
||||||
verifylist = []
|
verifylist = []
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
mock_sys.major = 3
|
||||||
|
mock_os_sys.return_value = 0
|
||||||
|
# DisplayCommandBase.take_action() returns two tuples
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
mock_run_command.assert_called_with(
|
||||||
|
['sudo', 'dnf', 'upgrade', '-y',
|
||||||
|
'python2-tripleoclient',
|
||||||
|
'openstack-tripleo-common',
|
||||||
|
'openstack-tripleo-heat-templates',
|
||||||
|
'openstack-tripleo-validations',
|
||||||
|
'tripleo-ansible'],
|
||||||
|
name='Update extra packages'
|
||||||
|
)
|
||||||
|
mock_os_sys.assert_called_with("which dnf")
|
||||||
|
|
||||||
|
mock_sys.major = 2
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
# DisplayCommandBase.take_action() returns two tuples
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_run_command.assert_called_with(
|
mock_run_command.assert_called_with(
|
||||||
|
@ -594,6 +613,7 @@ class TestUndercloudUpgrade(TestPluginV1):
|
||||||
'tripleo-ansible'],
|
'tripleo-ansible'],
|
||||||
name='Update extra packages'
|
name='Update extra packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_subprocess.assert_called_with([
|
mock_subprocess.assert_called_with([
|
||||||
'openstack', 'undercloud', 'upgrade', '--skip-package-updates',
|
'openstack', 'undercloud', 'upgrade', '--skip-package-updates',
|
||||||
'--no-validations'])
|
'--no-validations'])
|
||||||
|
|
|
@ -182,8 +182,11 @@ class UpgradeUndercloud(InstallUndercloud):
|
||||||
|
|
||||||
if not packages:
|
if not packages:
|
||||||
return
|
return
|
||||||
|
pkg_manager = 'yum'
|
||||||
|
if sys.version_info.major >= 3 and os.system('which dnf') == 0:
|
||||||
|
pkg_manager = 'dnf'
|
||||||
|
|
||||||
cmd = ['sudo', 'yum', 'upgrade', '-y'] + packages
|
cmd = ['sudo', pkg_manager, 'upgrade', '-y'] + packages
|
||||||
|
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
self.log.warning("Updating necessary packages: {}".format(
|
self.log.warning("Updating necessary packages: {}".format(
|
||||||
|
|
|
@ -39,32 +39,12 @@
|
||||||
- ^tripleoclient/v1/tripleo_container_image.py$
|
- ^tripleoclient/v1/tripleo_container_image.py$
|
||||||
- tripleo-ci-centos-7-scenario000-multinode-oooq-container-upgrades:
|
- tripleo-ci-centos-7-scenario000-multinode-oooq-container-upgrades:
|
||||||
dependencies: *deps_unit_lint
|
dependencies: *deps_unit_lint
|
||||||
- tripleo-ci-centos-8-scenario000-multinode-oooq-container-updates-train:
|
- tripleo-ci-centos-8-containers-undercloud-minion:
|
||||||
dependencies: *deps_unit_lint
|
|
||||||
- tripleo-ci-centos-8-scenario007-multinode-oooq-container:
|
|
||||||
vars: *multi_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-scenario001-standalone:
|
|
||||||
vars: &sa_consumer_vars
|
vars: &sa_consumer_vars
|
||||||
consumer_job: true
|
consumer_job: true
|
||||||
build_container_images: false
|
build_container_images: false
|
||||||
tags:
|
remove_tags:
|
||||||
- standalone
|
- build
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-scenario002-standalone:
|
|
||||||
vars: *sa_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-scenario003-standalone:
|
|
||||||
vars: *sa_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-scenario004-standalone:
|
|
||||||
vars: *sa_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-scenario012-standalone:
|
|
||||||
vars: *sa_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
|
||||||
- tripleo-ci-centos-8-containers-undercloud-minion:
|
|
||||||
vars: *sa_consumer_vars
|
|
||||||
dependencies: *deps_cprovider
|
dependencies: *deps_cprovider
|
||||||
files:
|
files:
|
||||||
- ^config-generator/.*minion.*$
|
- ^config-generator/.*minion.*$
|
||||||
|
|
Loading…
Reference in New Issue