Merge lp://qastaging/~frankban/juju-quickstart/fix-num-units into lp://qastaging/juju-quickstart

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 133
Proposed branch: lp://qastaging/~frankban/juju-quickstart/fix-num-units
Merge into: lp://qastaging/juju-quickstart
Diff against target: 72 lines (+25/-4)
4 files modified
quickstart/__init__.py (+1/-1)
quickstart/models/bundles.py (+1/-1)
quickstart/tests/functional/test_functional.py (+11/-2)
quickstart/tests/models/test_bundles.py (+12/-0)
To merge this branch: bzr merge lp://qastaging/~frankban/juju-quickstart/fix-num-units
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+258972@code.qastaging.launchpad.net

Description of the change

Fix key error: num_units not defined in services.

https://codereview.appspot.com/235490043/

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

Reviewers: mp+258972_code.launchpad.net,

Message:
Please take a look.

Description:
Fix key error: num_units not defined in services.

https://code.launchpad.net/~frankban/juju-quickstart/fix-num-units/+merge/258972

(do not edit description out of merge proposal)

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

Affected files (+27, -4 lines):
   A [revision details]
   M quickstart/__init__.py
   M quickstart/models/bundles.py
   M quickstart/tests/functional/test_functional.py
   M quickstart/tests/models/test_bundles.py

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: quickstart/__init__.py
=== modified file 'quickstart/__init__.py'
--- quickstart/__init__.py 2015-05-11 10:55:51 +0000
+++ quickstart/__init__.py 2015-05-13 08:27:30 +0000
@@ -45,7 +45,7 @@
  Once Juju has been installed, the command can also be run as a juju plugin,
  without the hyphen ("juju quickstart").
  """
-VERSION = (2, 1, 0)
+VERSION = (2, 1, 1)

  def get_version():

Index: quickstart/models/bundles.py
=== modified file 'quickstart/models/bundles.py'
--- quickstart/models/bundles.py 2015-04-24 13:31:28 +0000
+++ quickstart/models/bundles.py 2015-05-13 08:31:51 +0000
@@ -113,7 +113,7 @@
          services = self.data['services']
          result = collections.OrderedDict()
          for service_name in sorted(services.keys()):
- result[service_name] = services[service_name]['num_units']
+ result[service_name] = services[service_name].get('num_units',
0)
          return result

Index: quickstart/tests/functional/test_functional.py
=== modified file 'quickstart/tests/functional/test_functional.py'
--- quickstart/tests/functional/test_functional.py 2015-02-26 19:12:17 +0000
+++ quickstart/tests/functional/test_functional.py 2015-05-13 08:31:51 +0000
@@ -166,8 +166,17 @@

      def test_bundle_deployment(self):
          # The application can be used to deploy bundles.
- retcode, output, error = run_quickstart(
- self.env_name, 'mediawiki-single')
+ self._check_bundle('mediawiki-single/7')
+
+ def test_user_owned_bundle_deployment(self):
+ # The application can be used to deploy user owned bundles.
+ # The kubernetes bundle also includes subordinate services not
+ # including the "num_units" field.
+ self._check_bundle('u/kubernetes/kubernetes-cluster/3')
+
+ def _check_bundle(self, bundle_name):
+ """Ensure the given bundle name can be properly deployed."""
+ retcode, output, error = run_quickstart(self.env_name, bundle_name)
          self.assertEqual(0, retcode)
          self.assertIn('bundle deployment request accepted', output)
          self.assertEqual('', error)

Index: quickstart/tests/models/test_bundles.py
=== modified file 'quickstart/tests/models/test_bundles.py'
--- quickstart/tests/models/test_bundles.py 2015-04-28 15:25:14 +0000
+++ quic...

Read more...

Revision history for this message
Martin Hilton (martin-hilton) wrote :

LGTM, but make sure that the default 0 is correct for all cases.

https://codereview.appspot.com/235490043/diff/1/quickstart/models/bundles.py
File quickstart/models/bundles.py (left):

https://codereview.appspot.com/235490043/diff/1/quickstart/models/bundles.py#oldcode116
quickstart/models/bundles.py:116: result[service_name] =
services[service_name]['num_units']
Is 0 always a good default? I thought for subordinates it should be 0
but for normal charms it should be 1.

https://codereview.appspot.com/235490043/

136. By Francesco Banconi

None units

Revision history for this message
Francesco Banconi (frankban) wrote :
Revision history for this message
Uros Jovanovic (uros-jovanovic) wrote :

On 2015/05/13 08:49:04, frankban wrote:
> Please take a look.

LGTM now.

https://codereview.appspot.com/235490043/

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

*** Submitted:

Fix key error: num_units not defined in services.

R=martin.hilton, uros.jovanovic1
CC=
https://codereview.appspot.com/235490043

https://codereview.appspot.com/235490043/

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches