Merge lp:~mskalka/juju-ci-tools/charm-deploy-aliasing into lp:juju-ci-tools

Proposed by Michael Skalka
Status: Merged
Merged at revision: 1913
Proposed branch: lp:~mskalka/juju-ci-tools/charm-deploy-aliasing
Merge into: lp:juju-ci-tools
Diff against target: 39 lines (+10/-1)
2 files modified
jujupy/client.py (+3/-1)
jujupy/tests/test_client.py (+7/-0)
To merge this branch: bzr merge lp:~mskalka/juju-ci-tools/charm-deploy-aliasing
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+318377@code.launchpad.net

Description of the change

Adds the option to alias a jujupy charm deployment with a user-generated charm name. This is a quick workaround for missing multi-series subordinate charm support in juju.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jujupy/client.py'
2--- jujupy/client.py 2017-02-23 17:56:18 +0000
3+++ jujupy/client.py 2017-02-27 16:28:20 +0000
4@@ -1967,7 +1967,7 @@
5
6 def deploy(self, charm, repository=None, to=None, series=None,
7 service=None, force=False, resource=None, num=None,
8- storage=None, constraints=None):
9+ storage=None, constraints=None, alias=None):
10 args = [charm]
11 if service is not None:
12 args.extend([service])
13@@ -1985,6 +1985,8 @@
14 args.extend(['--storage', storage])
15 if constraints is not None:
16 args.extend(['--constraints', constraints])
17+ if alias is not None:
18+ args.extend([alias])
19 return self.juju('deploy', tuple(args))
20
21 def attach(self, service, resource):
22
23=== modified file 'jujupy/tests/test_client.py'
24--- jujupy/tests/test_client.py 2017-02-23 17:56:18 +0000
25+++ jujupy/tests/test_client.py 2017-02-27 16:28:20 +0000
26@@ -1202,6 +1202,13 @@
27 mock_juju.assert_called_with(
28 'deploy', ('mondogb', '--constraints', 'virt-type=kvm'))
29
30+ def test_deploy_aliased(self):
31+ env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
32+ with patch.object(env, 'juju') as mock_juju:
33+ env.deploy('local:blah', alias='blah-blah')
34+ mock_juju.assert_called_with(
35+ 'deploy', ('local:blah', 'blah-blah'))
36+
37 def test_attach(self):
38 env = ModelClient(JujuData('foo', {'type': 'local'}), None, None)
39 with patch.object(env, 'juju') as mock_juju:

Subscribers

People subscribed via source and target branches