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
=== modified file 'quickstart/manage.py'
--- quickstart/manage.py 2015-04-21 10:22:46 +0000
+++ quickstart/manage.py 2015-04-24 13:33:40 +0000
@@ -575,7 +575,7 @@
575575
576 # Handle bundle deployment.576 # Handle bundle deployment.
577 if options.bundle_source is not None:577 if options.bundle_source is not None:
578 services = ', '.join(options.bundle.services())578 services = ', '.join(options.bundle.services().keys())
579 print('requesting a deployment of {} with the following services:\n'579 print('requesting a deployment of {} with the following services:\n'
580 ' {}'.format(options.bundle, services))580 ' {}'.format(options.bundle, services))
581 if options.bundle.reference is not None:581 if options.bundle.reference is not None:
582582
=== 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:33:40 +0000
@@ -106,11 +106,15 @@
106 return serializers.yaml_dump({'bundle': self.data})106 return serializers.yaml_dump({'bundle': self.data})
107107
108 def services(self):108 def services(self):
109 """Return a list of service names included in the bundle.109 """Return an ordered dict mapping services and their number of units.
110110
111 Service names are returned in alphabetical order.111 In the dict, service names are returned in alphabetical order.
112 """112 """
113 return sorted(self.data['services'].keys())113 services = self.data['services']
114 result = collections.OrderedDict()
115 for service_name in sorted(services.keys()):
116 result[service_name] = services[service_name]['num_units']
117 return result
114118
115119
116def from_source(source, name=None):120def from_source(source, name=None):
117121
=== modified file 'quickstart/tests/models/test_bundles.py'
--- quickstart/tests/models/test_bundles.py 2015-04-23 12:13:27 +0000
+++ quickstart/tests/models/test_bundles.py 2015-04-24 13:33:40 +0000
@@ -18,6 +18,7 @@
1818
19from __future__ import unicode_literals19from __future__ import unicode_literals
2020
21import collections
21import json22import json
22import unittest23import unittest
2324
@@ -115,8 +116,10 @@
115 self.assertEqual(expected_content, self.bundle.serialize_legacy())116 self.assertEqual(expected_content, self.bundle.serialize_legacy())
116117
117 def test_services(self):118 def test_services(self):
118 # Bundle services can be easily retrieved.119 # Bundle services and their number of units can be easily retrieved.
119 self.assertEqual(['mysql', 'wordpress'], self.bundle.services())120 expected_services = collections.OrderedDict(
121 [('mysql', 0), ('wordpress', 1)])
122 self.assertEqual(expected_services, self.bundle.services())
120123
121124
122class TestFromSource(125class TestFromSource(
123126
=== modified file 'tox.ini'
--- tox.ini 2015-04-23 09:00:26 +0000
+++ tox.ini 2015-04-24 13:33:40 +0000
@@ -72,7 +72,7 @@
72 # See https://launchpad.net/~juju/+archive/ubuntu/stable.72 # See https://launchpad.net/~juju/+archive/ubuntu/stable.
73 websocket-client==0.18.073 websocket-client==0.18.0
74 jujuclient==0.50.174 jujuclient==0.50.1
75 jujubundlelib==0.1.375 jujubundlelib==0.1.4
76 urwid==1.2.176 urwid==1.2.1
77 # The distribution PyYAML requirement is used in this case.77 # The distribution PyYAML requirement is used in this case.
7878
@@ -82,7 +82,7 @@
82 # Ubuntu 14.04 (trusty) distro dependencies.82 # Ubuntu 14.04 (trusty) distro dependencies.
83 websocket-client==0.12.083 websocket-client==0.12.0
84 jujuclient==0.17.584 jujuclient==0.17.5
85 jujubundlelib==0.1.385 jujubundlelib==0.1.4
86 PyYAML==3.1086 PyYAML==3.10
87 urwid==1.1.187 urwid==1.1.1
8888
@@ -92,7 +92,7 @@
92 # Ubuntu 14.10 (utopic) distro dependencies.92 # Ubuntu 14.10 (utopic) distro dependencies.
93 websocket-client==0.12.093 websocket-client==0.12.0
94 jujuclient==0.17.594 jujuclient==0.17.5
95 jujubundlelib==0.1.395 jujubundlelib==0.1.4
96 PyYAML==3.1196 PyYAML==3.11
97 urwid==1.2.197 urwid==1.2.1
9898
@@ -102,7 +102,7 @@
102 # Ubuntu 15.04 (vivid) distro dependencies.102 # Ubuntu 15.04 (vivid) distro dependencies.
103 websocket-client==0.18.0103 websocket-client==0.18.0
104 jujuclient==0.18.5104 jujuclient==0.18.5
105 jujubundlelib==0.1.3105 jujubundlelib==0.1.4
106 PyYAML==3.11106 PyYAML==3.11
107 urwid==1.2.1107 urwid==1.2.1
108108

Subscribers

People subscribed via source and target branches