Merge lp:~frankban/juju-quickstart/changeset-prep into lp:juju-quickstart

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 127
Proposed branch: lp:~frankban/juju-quickstart/changeset-prep
Merge into: lp:juju-quickstart
Diff against target: 99 lines (+17/-10)
4 files modified
quickstart/manage.py (+1/-1)
quickstart/models/bundles.py (+7/-3)
quickstart/tests/models/test_bundles.py (+5/-2)
tox.ini (+4/-4)
To merge this branch: bzr merge lp:~frankban/juju-quickstart/changeset-prep
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+257387@code.launchpad.net

Description of the change

Some small changes in preparation for change sets.

Extend the services method of the bundle model to
include the number of units for each service.

Use the newer jujubundlelib.

https://codereview.appspot.com/231120043/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :
Download full text (4.3 KiB)

Reviewers: mp+257387_code.launchpad.net,

Message:
Please take a look.

Description:
Some small changes in preparation for change sets.

Extend the services method of the bundle model to
include the number of units for each service.

Use the newer jujubundlelib.

https://code.launchpad.net/~frankban/juju-quickstart/changeset-prep/+merge/257387

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/231120043/

Affected files (+19, -10 lines):
   A [revision details]
   M quickstart/manage.py
   M quickstart/models/bundles.py
   M quickstart/tests/models/test_bundles.py
   M tox.ini

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>

Index: tox.ini
=== modified file 'tox.ini'
--- tox.ini 2015-04-23 09:00:26 +0000
+++ tox.ini 2015-04-24 13:31:28 +0000
@@ -72,7 +72,7 @@
      # See https://launchpad.net/~juju/+archive/ubuntu/stable.
      websocket-client==0.18.0
      jujuclient==0.50.1
- jujubundlelib==0.1.3
+ jujubundlelib==0.1.4
      urwid==1.2.1
      # The distribution PyYAML requirement is used in this case.

@@ -82,7 +82,7 @@
      # Ubuntu 14.04 (trusty) distro dependencies.
      websocket-client==0.12.0
      jujuclient==0.17.5
- jujubundlelib==0.1.3
+ jujubundlelib==0.1.4
      PyYAML==3.10
      urwid==1.1.1

@@ -92,7 +92,7 @@
      # Ubuntu 14.10 (utopic) distro dependencies.
      websocket-client==0.12.0
      jujuclient==0.17.5
- jujubundlelib==0.1.3
+ jujubundlelib==0.1.4
      PyYAML==3.11
      urwid==1.2.1

@@ -102,7 +102,7 @@
      # Ubuntu 15.04 (vivid) distro dependencies.
      websocket-client==0.18.0
      jujuclient==0.18.5
- jujubundlelib==0.1.3
+ jujubundlelib==0.1.4
      PyYAML==3.11
      urwid==1.2.1

Index: quickstart/manage.py
=== modified file 'quickstart/manage.py'
--- quickstart/manage.py 2015-04-21 10:22:46 +0000
+++ quickstart/manage.py 2015-04-24 13:31:28 +0000
@@ -575,7 +575,7 @@

      # Handle bundle deployment.
      if options.bundle_source is not None:
- services = ', '.join(options.bundle.services())
+ services = ', '.join(options.bundle.services().keys())
          print('requesting a deployment of {} with the following
services:\n'
                ' {}'.format(options.bundle, services))
          if options.bundle.reference is not None:

Index: quickstart/models/bundles.py
=== modified file 'quickstart/models/bundles.py'
--- quickstart/models/bundles.py 2015-04-23 12:09:29 +0000
+++ quickstart/models/bundles.py 2015-04-24 13:31:28 +0000
@@ -106,11 +106,15 @@
          return serializers.yaml_dump({'bundle': self.data})

      def services(self):
- """Return a list of service names included in the bundle.
+ """Return an ordered dict mapping services and their number of
units.

- Service names are returned in alphabetical order.
+ In the dict, service names are returned in alphabetical order.
...

Read more...

Revision history for this message
Richard Harding (rharding) wrote :
Revision history for this message
Brad Crittenden (bac) wrote :

LGTM, also no QA.

review: Approve (code)
Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Some small changes in preparation for change sets.

Extend the services method of the bundle model to
include the number of units for each service.

Use the newer jujubundlelib.

R=rharding
CC=
https://codereview.appspot.com/231120043

https://codereview.appspot.com/231120043/

Revision history for this message
Francesco Banconi (frankban) wrote :

On 2015/04/24 14:30:36, frankban wrote:
> *** Submitted:

> Some small changes in preparation for change sets.

> Extend the services method of the bundle model to
> include the number of units for each service.

> Use the newer jujubundlelib.

> R=rharding
> CC=
> https://codereview.appspot.com/231120043

Thanks for the reviews!

https://codereview.appspot.com/231120043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quickstart/manage.py'
2--- quickstart/manage.py 2015-04-21 10:22:46 +0000
3+++ quickstart/manage.py 2015-04-24 13:33:40 +0000
4@@ -575,7 +575,7 @@
5
6 # Handle bundle deployment.
7 if options.bundle_source is not None:
8- services = ', '.join(options.bundle.services())
9+ services = ', '.join(options.bundle.services().keys())
10 print('requesting a deployment of {} with the following services:\n'
11 ' {}'.format(options.bundle, services))
12 if options.bundle.reference is not None:
13
14=== modified file 'quickstart/models/bundles.py'
15--- quickstart/models/bundles.py 2015-04-23 12:09:29 +0000
16+++ quickstart/models/bundles.py 2015-04-24 13:33:40 +0000
17@@ -106,11 +106,15 @@
18 return serializers.yaml_dump({'bundle': self.data})
19
20 def services(self):
21- """Return a list of service names included in the bundle.
22+ """Return an ordered dict mapping services and their number of units.
23
24- Service names are returned in alphabetical order.
25+ In the dict, service names are returned in alphabetical order.
26 """
27- return sorted(self.data['services'].keys())
28+ services = self.data['services']
29+ result = collections.OrderedDict()
30+ for service_name in sorted(services.keys()):
31+ result[service_name] = services[service_name]['num_units']
32+ return result
33
34
35 def from_source(source, name=None):
36
37=== modified file 'quickstart/tests/models/test_bundles.py'
38--- quickstart/tests/models/test_bundles.py 2015-04-23 12:13:27 +0000
39+++ quickstart/tests/models/test_bundles.py 2015-04-24 13:33:40 +0000
40@@ -18,6 +18,7 @@
41
42 from __future__ import unicode_literals
43
44+import collections
45 import json
46 import unittest
47
48@@ -115,8 +116,10 @@
49 self.assertEqual(expected_content, self.bundle.serialize_legacy())
50
51 def test_services(self):
52- # Bundle services can be easily retrieved.
53- self.assertEqual(['mysql', 'wordpress'], self.bundle.services())
54+ # Bundle services and their number of units can be easily retrieved.
55+ expected_services = collections.OrderedDict(
56+ [('mysql', 0), ('wordpress', 1)])
57+ self.assertEqual(expected_services, self.bundle.services())
58
59
60 class TestFromSource(
61
62=== modified file 'tox.ini'
63--- tox.ini 2015-04-23 09:00:26 +0000
64+++ tox.ini 2015-04-24 13:33:40 +0000
65@@ -72,7 +72,7 @@
66 # See https://launchpad.net/~juju/+archive/ubuntu/stable.
67 websocket-client==0.18.0
68 jujuclient==0.50.1
69- jujubundlelib==0.1.3
70+ jujubundlelib==0.1.4
71 urwid==1.2.1
72 # The distribution PyYAML requirement is used in this case.
73
74@@ -82,7 +82,7 @@
75 # Ubuntu 14.04 (trusty) distro dependencies.
76 websocket-client==0.12.0
77 jujuclient==0.17.5
78- jujubundlelib==0.1.3
79+ jujubundlelib==0.1.4
80 PyYAML==3.10
81 urwid==1.1.1
82
83@@ -92,7 +92,7 @@
84 # Ubuntu 14.10 (utopic) distro dependencies.
85 websocket-client==0.12.0
86 jujuclient==0.17.5
87- jujubundlelib==0.1.3
88+ jujubundlelib==0.1.4
89 PyYAML==3.11
90 urwid==1.2.1
91
92@@ -102,7 +102,7 @@
93 # Ubuntu 15.04 (vivid) distro dependencies.
94 websocket-client==0.18.0
95 jujuclient==0.18.5
96- jujubundlelib==0.1.3
97+ jujubundlelib==0.1.4
98 PyYAML==3.11
99 urwid==1.2.1
100

Subscribers

People subscribed via source and target branches