Drop python2 logic for upgrades

We no longer need to handle this case and the logic doesn't work now
that packaging uses platform-python.

Change-Id: Ic506842240417142230e39755e7663b9276d4e34
Closes-Bug: #1945357
changes/68/811468/2
Alex Schultz 1 year ago
parent d5457bfb4e
commit 9ec115216f
  1. 1
      tripleoclient/constants.py
  2. 5
      tripleoclient/tests/v1/undercloud/test_install_upgrade.py
  3. 12
      tripleoclient/v1/undercloud.py

@ -253,6 +253,7 @@ EXPORT_DATA = {
# Package that need to be to the latest before undercloud
# update/update
UNDERCLOUD_EXTRA_PACKAGES = [
"python3-tripleoclient",
"openstack-tripleo-common",
"openstack-tripleo-heat-templates",
"openstack-tripleo-validations",

@ -17,7 +17,6 @@ import fixtures
import json
import mock
import os
import sys
from jinja2 import Template
@ -539,7 +538,6 @@ class TestUndercloudUpgrade(TestPluginV1):
@mock.patch('tripleoclient.utils.prompt_user_for_confirmation',
return_value=True)
@mock.patch.object(sys, 'executable', 'python2')
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('os.geteuid', return_value=1001)
@mock.patch('getpass.getuser', return_value='stack')
@ -560,7 +558,7 @@ class TestUndercloudUpgrade(TestPluginV1):
self.cmd.take_action(parsed_args)
mock_run_command.assert_called_with(
['sudo', 'dnf', 'upgrade', '-y',
'python2-tripleoclient',
'python3-tripleoclient',
'openstack-tripleo-common',
'openstack-tripleo-heat-templates',
'openstack-tripleo-validations',
@ -609,7 +607,6 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/'
'undercloud-stack-vstate-dropin.yaml'])
@mock.patch.object(sys, 'executable', 'python3')
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('os.geteuid', return_value=1001)
@mock.patch('getpass.getuser', return_value='stack')

@ -19,7 +19,6 @@ import argparse
import logging
import os
import subprocess
import sys
from openstackclient.i18n import _
@ -245,15 +244,8 @@ class UpgradeUndercloud(InstallUndercloud):
utils.ensure_run_as_normal_user()
if not parsed_args.skip_package_updates:
if ('python3' in sys.executable):
pyver = '3'
else:
pyver = '2'
client_pkgs = [
"python{}-tripleoclient".format(pyver),
]
pkgs = client_pkgs + constants.UNDERCLOUD_EXTRA_PACKAGES
self._update_extra_packages(pkgs, parsed_args.dry_run)
self._update_extra_packages(constants.UNDERCLOUD_EXTRA_PACKAGES,
parsed_args.dry_run)
if not parsed_args.dry_run:
self._run_upgrade(parsed_args)

Loading…
Cancel
Save