Always install deps with current and current-tripleo

The current and current-tripleo repos depend on the deps repo so it
makes no sense to install them without it.
This commit is contained in:
Ben Nemec 2016-11-22 23:24:46 +00:00
parent f930302ae2
commit 8577a37fe5
3 changed files with 43 additions and 18 deletions

View File

@ -16,11 +16,11 @@ Examples
--------
Install current master dlrn repo and the deps repo::
tripleo-repos current deps
tripleo-repos current
Install current-tripleo dlrn repo and the deps repo::
tripleo-repos current-tripleo deps
tripleo-repos current-tripleo
Install the current-tripleo-dev repo. This will also pull current and deps,
and will adjust the priorities of each repo appropriately::
@ -29,16 +29,16 @@ and will adjust the priorities of each repo appropriately::
Install the mitaka dlrn repo and deps::
tripleo-repos -b mitaka current deps
tripleo-repos -b mitaka current
Write repos to a different path::
tripleo-repos -o ~/test-repos current deps
tripleo-repos -o ~/test-repos current
Install the current-tripleo, deps, and ceph repos. NOTE: The Ceph repo is
installed from a package and thus does not respect -o::
tripleo-repos current-tripleo deps ceph
tripleo-repos current-tripleo ceph
TripleO
```````

View File

@ -56,7 +56,9 @@ def _parse_args():
choices=['current', 'deps', 'current-tripleo',
'current-tripleo-dev', 'ceph', 'opstools'],
help='A list of repos. Available repos: '
'%(choices)s. current-tripleo-dev '
'%(choices)s. The deps repo will always be '
'included when using current or '
'current-tripleo. current-tripleo-dev '
'downloads the current-tripleo, current, and '
'deps repos, but sets the current repo to only '
'be used for TripleO projects. It also modifies '
@ -178,18 +180,24 @@ def _install_repos(args, base_path):
# a way to handle setting this appropriately.
current_tripleo_repo = ('http://buildlogs.centos.org/centos/7/cloud/x86_64'
'/rdo-trunk-master-tripleo/delorean.repo')
def install_deps(args, base_path):
content = _get_repo(base_path + 'delorean-deps.repo')
_write_repo(content, args.output_path)
for repo in args.repos:
if repo == 'current':
content = _get_repo(base_path + 'current/delorean.repo')
if args.branch != 'master':
content = TITLE_RE.sub('[delorean-%s]' % args.branch, content)
_write_repo(content, args.output_path)
install_deps(args, base_path)
elif repo == 'deps':
content = _get_repo(base_path + 'delorean-deps.repo')
_write_repo(content, args.output_path)
install_deps(args, base_path)
elif repo == 'current-tripleo':
content = _get_repo(current_tripleo_repo)
_write_repo(content, args.output_path)
install_deps(args, base_path)
elif repo == 'current-tripleo-dev':
content = _get_repo(base_path + 'delorean-deps.repo')
_write_repo(content, args.output_path)

View File

@ -116,8 +116,14 @@ class TestTripleORepos(testtools.TestCase):
args.output_path = 'test'
mock_get.return_value = '[delorean]\nMr. Fusion'
main._install_repos(args, 'roads/')
mock_get.assert_called_once_with('roads/current/delorean.repo')
mock_write.assert_called_once_with('[delorean]\nMr. Fusion', 'test')
self.assertEqual([mock.call('roads/current/delorean.repo'),
mock.call('roads/delorean-deps.repo'),
],
mock_get.mock_calls)
self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test'),
mock.call('[delorean]\nMr. Fusion', 'test'),
],
mock_write.mock_calls)
@mock.patch('tripleo_repos.main._get_repo')
@mock.patch('tripleo_repos.main._write_repo')
@ -128,9 +134,14 @@ class TestTripleORepos(testtools.TestCase):
args.output_path = 'test'
mock_get.return_value = '[delorean]\nMr. Fusion'
main._install_repos(args, 'roads/')
mock_get.assert_called_once_with('roads/current/delorean.repo')
mock_write.assert_called_once_with('[delorean-mitaka]\nMr. Fusion',
'test')
self.assertEqual([mock.call('roads/current/delorean.repo'),
mock.call('roads/delorean-deps.repo'),
],
mock_get.mock_calls)
self.assertEqual([mock.call('[delorean-mitaka]\nMr. Fusion', 'test'),
mock.call('[delorean]\nMr. Fusion', 'test'),
],
mock_write.mock_calls)
@mock.patch('tripleo_repos.main._get_repo')
@mock.patch('tripleo_repos.main._write_repo')
@ -154,10 +165,16 @@ class TestTripleORepos(testtools.TestCase):
args.output_path = 'test'
mock_get.return_value = '[delorean]\nMr. Fusion'
main._install_repos(args, 'roads/')
mock_get.assert_called_once_with('http://buildlogs.centos.org/centos/'
'7/cloud/x86_64/rdo-trunk-master-'
'tripleo/delorean.repo')
mock_write.assert_called_once_with('[delorean]\nMr. Fusion', 'test')
self.assertEqual([mock.call('http://buildlogs.centos.org/centos/'
'7/cloud/x86_64/rdo-trunk-master-'
'tripleo/delorean.repo'),
mock.call('roads/delorean-deps.repo'),
],
mock_get.mock_calls)
self.assertEqual([mock.call('[delorean]\nMr. Fusion', 'test'),
mock.call('[delorean]\nMr. Fusion', 'test'),
],
mock_write.mock_calls)
@mock.patch('tripleo_repos.main._get_repo')
@mock.patch('tripleo_repos.main._write_repo')
@ -273,7 +290,7 @@ class TestTripleORepos(testtools.TestCase):
'/etc/yum.repos.d/CentOS-Ceph-Jewel.repo'
])
],
mock_check_call.mock_calls)
mock_check_call.mock_calls)
@mock.patch('subprocess.check_call')
def test_install_ceph_fail1(self, mock_check_call):