Browse Source

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
changes/92/761892/8
Sagi Shnaidman 2 months ago
committed by Ronelle Landy
parent
commit
4a5027a6a6
3 changed files with 28 additions and 25 deletions
  1. +21
    -1
      tripleoclient/tests/v1/undercloud/test_install_upgrade.py
  2. +4
    -1
      tripleoclient/v1/undercloud.py
  3. +3
    -23
      zuul.d/layout.yaml

+ 21
- 1
tripleoclient/tests/v1/undercloud/test_install_upgrade.py View File

@@ -564,6 +564,8 @@ class TestUndercloudUpgrade(TestPluginV1):
app_args.verbose_level = 1
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',
return_value=True)
@mock.patch.object(sys, 'executable', 'python2')
@@ -578,11 +580,28 @@ class TestUndercloudUpgrade(TestPluginV1):
mock_subprocess,
mock_wr,
mock_os, mock_copy, mock_user,
mock_confirm):
mock_confirm, mock_sys,
mock_os_sys):
arglist = ['--no-validations']
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
self.cmd.take_action(parsed_args)
mock_run_command.assert_called_with(
@@ -594,6 +613,7 @@ class TestUndercloudUpgrade(TestPluginV1):
'tripleo-ansible'],
name='Update extra packages'
)

mock_subprocess.assert_called_with([
'openstack', 'undercloud', 'upgrade', '--skip-package-updates',
'--no-validations'])


+ 4
- 1
tripleoclient/v1/undercloud.py View File

@@ -182,8 +182,11 @@ class UpgradeUndercloud(InstallUndercloud):

if not packages:
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:
self.log.warning("Updating necessary packages: {}".format(


+ 3
- 23
zuul.d/layout.yaml View File

@@ -39,32 +39,12 @@
- ^tripleoclient/v1/tripleo_container_image.py$
- tripleo-ci-centos-7-scenario000-multinode-oooq-container-upgrades:
dependencies: *deps_unit_lint
- tripleo-ci-centos-8-scenario000-multinode-oooq-container-updates-train:
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:
- tripleo-ci-centos-8-containers-undercloud-minion:
vars: &sa_consumer_vars
consumer_job: true
build_container_images: false
tags:
- standalone
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
remove_tags:
- build
dependencies: *deps_cprovider
files:
- ^config-generator/.*minion.*$


Loading…
Cancel
Save