Merge lp://staging/~gary/juju-gui/exportBugs into lp://staging/juju-gui/experimental

Proposed by Gary Poster
Status: Merged
Merged at revision: 1149
Proposed branch: lp://staging/~gary/juju-gui/exportBugs
Merge into: lp://staging/juju-gui/experimental
Diff against target: 182 lines (+74/-12)
5 files modified
app/models/models.js (+7/-3)
app/store/env/fakebackend.js (+7/-3)
test/data/wp-deployer.yaml (+2/-5)
test/test_fakebackend.js (+12/-1)
test/test_model.js (+46/-0)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/exportBugs
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+192286@code.staging.launchpad.net

Description of the change

Fix export and import bugs

Our support for exporting and importing config values and expose flags was buggy. This fixes four discrete but related bugs.

 - Exporting config values would exclude those that had false-y default values.
 - We did not export the expose flag.
 - Importing config values did not work.
 - We called the expose flag "exposed", which is not what the actual delpoyer expects.

To qa, open up the sandbox, deploy apache with "enable_modules" set to something or other, and expose it. Then export the environment. When you look at the service in the file, you should see "expose: true" and "enable_modules: mod_proxy" or whatever value you set. Then reload the GUI and drag the file into the sandbox. When the service has loaded, you should see that it is exposed, and when you look at the config in the inspector, you should see your value in the "enable_modules" field.

https://codereview.appspot.com/15400052/

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

Reviewers: mp+192286_code.launchpad.net,

Message:
Please take a look.

Description:
Fix export and import bugs

Our support for exporting and importing config values and expose flags
was buggy. This fixes four discrete but related bugs.

  - Exporting config values would exclude those that had false-y default
values.
  - We did not export the expose flag.
  - Importing config values did not work.
  - We called the expose flag "exposed", which is not what the actual
delpoyer expects.

To qa, open up the sandbox, deploy apache with "enable_modules" set to
something or other, and expose it. Then export the environment. When
you look at the service in the file, you should see "expose: true" and
"enable_modules: mod_proxy" or whatever value you set. Then reload the
GUI and drag the file into the sandbox. When the service has loaded,
you should see that it is exposed, and when you look at the config in
the inspector, you should see your value in the "enable_modules" field.

https://code.launchpad.net/~gary/juju-gui/exportBugs/+merge/192286

(do not edit description out of merge proposal)

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

Affected files (+76, -12 lines):
   A [revision details]
   M app/models/models.js
   M app/store/env/fakebackend.js
   M test/data/wp-deployer.yaml
   M test/test_fakebackend.js
   M test/test_model.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-10-15 08:16:18 +0000
+++ test/test_fakebackend.js 2013-10-23 05:23:16 +0000
@@ -528,6 +528,10 @@
        });
      });

+ beforeEach(function() {
+ fakebackend = utils.makeFakeBackend();
+ });
+
      afterEach(function() {
        if (fakebackend) {
          fakebackend.destroy();
@@ -555,9 +559,16 @@

              // Verify config.
              var wordpress = fakebackend.db.services.getById('wordpress');
+ var wordpressCharm = fakebackend.db.charms.getById(
+ 'cs:precise/wordpress-15');
              var mysql = fakebackend.db.services.getById('mysql');
- assert.equal(wordpress.get('config.engine'), 'nginx');
+ // This value is different from the default (nginx).
+
assert.equal(wordpressCharm.get('options.engine.default'), 'nginx');
+ assert.equal(wordpress.get('config.engine'), 'apache');
+ // This value is the default, as provided by the charm.
              assert.equal(wordpress.get('config.tuning'), 'single');
+ assert.isTrue(wordpress.get('exposed'));
+ assert.isFalse(mysql.get('exposed'));

              // Constraints
              var constraints = mysql.get('constraints');

Index: test/test_model.js
=== modified file 'test/test_model.js'
--- test/test_model.js 2013-10-16 11:55:56 +0000
+++ test/test_model.js 2013-10-23 03:34:59 +0000
@@...

Read more...

Revision history for this message
Jeff Pihach (hatch) wrote :

Thanks for this fix!
LGTM QA OK!

https://codereview.appspot.com/15400052/diff/1/app/models/models.js
File app/models/models.js (right):

https://codereview.appspot.com/15400052/diff/1/app/models/models.js#newcode1193
app/models/models.js:1193: if (service.get('exposed')) {
Maybe we should change what the deployer expects or our service
attribute to match instead of doing this conversion.

https://codereview.appspot.com/15400052/diff/1/test/test_fakebackend.js
File test/test_fakebackend.js (right):

https://codereview.appspot.com/15400052/diff/1/test/test_fakebackend.js#newcode532
test/test_fakebackend.js:532: fakebackend = utils.makeFakeBackend();
How did this work before?

https://codereview.appspot.com/15400052/

Revision history for this message
Gary Poster (gary) wrote :

*** Submitted:

Fix export and import bugs

Our support for exporting and importing config values and expose flags
was buggy. This fixes four discrete but related bugs.

  - Exporting config values would exclude those that had false-y default
values.
  - We did not export the expose flag.
  - Importing config values did not work.
  - We called the expose flag "exposed", which is not what the actual
delpoyer expects.

To qa, open up the sandbox, deploy apache with "enable_modules" set to
something or other, and expose it. Then export the environment. When
you look at the service in the file, you should see "expose: true" and
"enable_modules: mod_proxy" or whatever value you set. Then reload the
GUI and drag the file into the sandbox. When the service has loaded,
you should see that it is exposed, and when you look at the config in
the inspector, you should see your value in the "enable_modules" field.

R=jeff.pihach
CC=
https://codereview.appspot.com/15400052

https://codereview.appspot.com/15400052/

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