Merge lp://staging/~gary/juju-gui/core-sub-num-units into lp://staging/juju-gui/experimental

Proposed by Gary Poster
Status: Merged
Merged at revision: 887
Proposed branch: lp://staging/~gary/juju-gui/core-sub-num-units
Merge into: lp://staging/juju-gui/experimental
Diff against target: 126 lines (+45/-22)
4 files modified
app/store/env/fakebackend.js (+9/-9)
app/templates/charm-pre-configuration.handlebars (+14/-10)
app/views/charm-panel.js (+2/-2)
test/test_fakebackend.js (+20/-1)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/core-sub-num-units
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+176682@code.staging.launchpad.net

Description of the change

Subordinates should not be deployed with unit ct.

Deploying a subordinate with a unit count causes an error in core. This
prevents one from entering a unit count in the charm panel (did not touch ghost
inspector, that may also need it) and defaults to 0. This also affects
fakebackend.

https://codereview.appspot.com/11627044/

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :
Download full text (6.2 KiB)

Reviewers: mp+176682_code.launchpad.net,

Message:
Please take a look.

Description:
Subordinates should not be deployed with unit ct.

Deploying a subordinate with a unit count causes an error in core. This
prevents one from entering a unit count in the charm panel (did not
touch ghost
inspector, that may also need it) and defaults to 0. This also affects
fakebackend.

https://code.launchpad.net/~gary/juju-gui/core-sub-num-units/+merge/176682

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M app/store/env/fakebackend.js
   M app/templates/charm-pre-configuration.handlebars
   M app/views/charm-panel.js
   M test/test_fakebackend.js

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: test/test_fakebackend.js
=== modified file 'test/test_fakebackend.js'
--- test/test_fakebackend.js 2013-07-09 15:11:25 +0000
+++ test/test_fakebackend.js 2013-07-24 13:06:18 +0000
@@ -168,7 +168,7 @@
        assert.isUndefined(charm.get('is_subordinate'));
        // The _set forces a change to a writeOnly attribute.
        charm._set('is_subordinate', true);
- fakebackend.deploy('cs:wordpress', callback);
+ fakebackend.deploy('cs:wordpress', callback, {unitCount: 0});
        assert.isUndefined(result.error);
        assert.strictEqual(
            fakebackend.db.charms.getById('cs:precise/wordpress-10'), charm);
@@ -859,6 +859,25 @@
            'Invalid number of units.');
      });

+ it('returns error for invalid number of subordinate units', function()
{
+ fakebackend.deploy('cs:puppet', callback);
+ assert.isUndefined(deployResult.error);
+ assert.equal(
+ fakebackend.addUnit('puppet', 'goyesca').error,
+ 'Invalid number of units.');
+ assert.equal(
+ fakebackend.addUnit('puppet', 1).error,
+ 'Invalid number of units.');
+ assert.equal(
+ fakebackend.addUnit('puppet', -1).error,
+ 'Invalid number of units.');
+ // It also ignores empty requests
+ assert.isUndefined(
+ fakebackend.addUnit('puppet', 0).error);
+ assert.isUndefined(
+ fakebackend.addUnit('puppet').error);
+ });
+
      it('returns an error if the service does not exist.', function() {
        assert.equal(
            fakebackend.addUnit('foo').error,

Index: app/templates/charm-pre-configuration.handlebars
=== modified file 'app/templates/charm-pre-configuration.handlebars'
--- app/templates/charm-pre-configuration.handlebars 2013-07-17 19:25:41
+0000
+++ app/templates/charm-pre-configuration.handlebars 2013-07-24 13:03:35
+0000
@@ -26,18 +26,22 @@
            </div>
          </div>
        </div>
- <div class="charm-entry">
- <div class="control-group">
- <div class="well control-description">
- Number of units to deploy for this service.
-...

Read more...

Revision history for this message
Richard Harding (rharding) wrote :
Revision history for this message
Madison Scott-Clary (makyo) wrote :
Revision history for this message
Gary Poster (gary) wrote :

*** Submitted:

Subordinates should not be deployed with unit ct.

Deploying a subordinate with a unit count causes an error in core. This
prevents one from entering a unit count in the charm panel (did not
touch ghost
inspector, that may also need it) and defaults to 0. This also affects
fakebackend.

R=rharding, matthew.scott
CC=
https://codereview.appspot.com/11627044

https://codereview.appspot.com/11627044/

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