From 030200ee866f6d96b8569ff313bbf560bd2e223c Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 10 Jul 2019 09:34:19 +0100 Subject: [PATCH] Remove deprecated --centos-mirror parameter Obliterates the old code related to the centos mirro which was replaced by more generic one --mirror. As far as we know the last two places where this was used were in the two branches of ovb. Depends-On: https://review.opendev.org/669654 Depends-On: https://review.opendev.org/669396 Change-Id: I8c9aecde7f3fe83ad18afc66682b2272955f7b8b --- tripleo_repos/main.py | 16 +++------------- tripleo_repos/tests/test_main.py | 11 ++++------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/tripleo_repos/main.py b/tripleo_repos/main.py index 4d4bf37..82040ee 100755 --- a/tripleo_repos/main.py +++ b/tripleo_repos/main.py @@ -44,7 +44,7 @@ DEFAULT_MIRROR_MAP = { CEPH_REPO_TEMPLATE = ''' [tripleo-centos-ceph-%(ceph_release)s] name=tripleo-centos-ceph-%(ceph_release)s -baseurl=%(centos_mirror)s/centos/7/storage/x86_64/ceph-%(ceph_release)s/ +baseurl=%(mirror)s/centos/7/storage/x86_64/ceph-%(ceph_release)s/ gpgcheck=0 enabled=1 ''' @@ -146,21 +146,11 @@ def _parse_args(): default=default_mirror, help='Server from which to install base OS packages. ' 'Default value is based on distro param.') - parser.add_argument('--centos-mirror', - default=default_mirror, - help='[deprecated] Server from which to install base ' - 'CentOS packages. If mentioned it will be used ' - 'as --mirror for backwards compatibility.') parser.add_argument('--rdo-mirror', default=DEFAULT_RDO_MIRROR, help='Server from which to install RDO packages.') args = parser.parse_args() - if args.centos_mirror: - print("WARNING: --centos-mirror was deprecated in favour of --mirror", - file=sys.stderr) - args.mirror = args.centos_mirror - args.old_mirror = default_mirror return args @@ -285,7 +275,7 @@ def _install_priorities(): def _create_ceph(args, release): """Generate a Ceph repo file for release""" return CEPH_REPO_TEMPLATE % {'ceph_release': release, - 'centos_mirror': args.centos_mirror} + 'mirror': args.mirror} def _change_priority(content, new_priority): @@ -366,7 +356,7 @@ def _install_repos(args, base_path): content = _create_ceph(args, 'nautilus') _write_repo(content, args.output_path) elif repo == 'opstools': - content = OPSTOOLS_REPO_TEMPLATE % args.centos_mirror + content = OPSTOOLS_REPO_TEMPLATE % args.mirror _write_repo(content, args.output_path) else: raise InvalidArguments('Invalid repo "%s" specified' % repo) diff --git a/tripleo_repos/tests/test_main.py b/tripleo_repos/tests/test_main.py index cbc6701..7a60599 100644 --- a/tripleo_repos/tests/test_main.py +++ b/tripleo_repos/tests/test_main.py @@ -298,7 +298,7 @@ class TestTripleORepos(testtools.TestCase): args.repos = ['opstools'] args.branch = 'master' args.output_path = 'test' - args.centos_mirror = 'http://foo' + args.mirror = 'http://foo' main._install_repos(args, 'roads/') expected_repo = ('\n[tripleo-centos-opstools]\n' 'name=tripleo-centos-opstools\n' @@ -315,7 +315,6 @@ class TestTripleORepos(testtools.TestCase): args.repos = ['deps'] args.branch = 'master' args.output_path = 'test' - args.centos_mirror = 'http://foo' args.old_mirror = 'http://mirror.centos.org' args.mirror = 'http://foo' args.distro = 'centos' @@ -396,7 +395,7 @@ enabled=1 self.assertEqual('[delorean]\npriority=10', result) def test_create_ceph(self): - mock_args = mock.Mock(centos_mirror='http://foo') + mock_args = mock.Mock(mirror='http://foo') result = main._create_ceph(mock_args, 'jewel') expected_repo = ''' [tripleo-centos-ceph-jewel] @@ -428,8 +427,7 @@ name=centos baseurl=http://foo/centos/7/virt/$basearch/kvm-common enabled=1 ''' - mock_args = mock.Mock(centos_mirror='http://foo', - mirror='http://foo', + mock_args = mock.Mock(mirror='http://foo', rdo_mirror='http://bar', distro='centos', old_mirror='http://mirror.centos.org') @@ -457,8 +455,7 @@ name=rhel baseurl=http://foo/stuff enabled=1 ''' - mock_args = mock.Mock(centos_mirror='http://foo', - mirror='http://foo', + mock_args = mock.Mock(mirror='http://foo', rdo_mirror='http://bar', distro='rhel', old_mirror='https://some')