Merge lp:~bac/juju-gui/send-bundle-id-to-deployer into lp:juju-gui/experimental

Proposed by Brad Crittenden
Status: Merged
Merged at revision: 1202
Proposed branch: lp:~bac/juju-gui/send-bundle-id-to-deployer
Merge into: lp:juju-gui/experimental
Diff against target: 195 lines (+34/-21)
5 files modified
app/app.js (+2/-1)
app/assets/javascripts/bundle-import-helpers.js (+9/-3)
app/store/env/go.js (+11/-7)
app/subapps/browser/views/bundle.js (+1/-1)
test/test_bundle_import_helpers.js (+11/-9)
To merge this branch: bzr merge lp:~bac/juju-gui/send-bundle-id-to-deployer
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+195598@code.launchpad.net

Description of the change

Send the bundle ID when deploying.

By sending the bundle ID to the server, the deployment statistics can be
updated on Charmworld for that bundle.

QA:

In the latest charm trunk:
% juju switch ec2
% juju bootstrap
% make deploy
% juju set juju-gui "juju-gui-source=lp:~bac/juju-gui/send-bundle-id-to-deployer"
% juju set juju-gui "charmworld-url=http://staging.jujucharms.com"

Search for a simple bundle. Jorge's are good. In this example I'll use mediawiki-simple.

Look at the bundle on staging:
http://staging.jujucharms.com/bundle/~jorge/mediawiki-simple/mediawiki-simple

Note the Downloads statistics.

Go to your juju-gui instance on ec2.
Search for jorge.
Pick the bundle you want (mediawiki-simple in this case).
Deploy it.
Only when all service are successfully deployed, green, and relations built
will the deployment statistics get updated. At that time go back to staging
and see that the downloads have been incremented.

https://codereview.appspot.com/28440043/

To post a comment you must log in.
1204. By Brad Crittenden

Fix param doc for deployBundle.

Revision history for this message
Brad Crittenden (bac) wrote :
Download full text (8.1 KiB)

Reviewers: mp+195598_code.launchpad.net,

Message:
Please take a look.

Description:
Send the bundle ID when deploying.

By sending the bundle ID to the server, the deployment statistics can be
updated on Charmworld for that bundle.

QA:

In the latest charm trunk:
% juju switch ec2
% juju bootstrap
% make deploy
% juju set juju-gui
"juju-gui-source=lp:~bac/juju-gui/send-bundle-id-to-deployer"
% juju set juju-gui "charmworld-url=http://staging.jujucharms.com"

Search for a simple bundle. Jorge's are good. In this example I'll use
mediawiki-simple.

Look at the bundle on staging:
http://staging.jujucharms.com/bundle/~jorge/mediawiki-simple/mediawiki-simple

Note the Downloads statistics.

Go to your juju-gui instance on ec2.
Search for jorge.
Pick the bundle you want (mediawiki-simple in this case).
Deploy it.
Only when all service are successfully deployed, green, and relations
built
will the deployment statistics get updated. At that time go back to
staging
and see that the downloads have been incremented.

https://code.launchpad.net/~bac/juju-gui/send-bundle-id-to-deployer/+merge/195598

(do not edit description out of merge proposal)

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

Affected files (+26, -14 lines):
   A [revision details]
   M app/app.js
   M app/assets/javascripts/bundle-import-helpers.js
   M app/store/env/go.js
   M app/subapps/browser/views/bundle.js
   M test/test_bundle_import_helpers.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: app/app.js
=== modified file 'app/app.js'
--- app/app.js 2013-11-15 13:46:35 +0000
+++ app/app.js 2013-11-18 13:27:49 +0000
@@ -595,13 +595,14 @@
        // Grab a reference of these for the nested event calls below.
        var env = this.env;
        var db = this.db;
- cfg.deployBundle = function(bundle) {
+ cfg.deployBundle = function(bundle, bundleId) {
          // The other views will hand us an Object vs a YAML string. The
import
          // helpers want the yaml string instead.
          importHelpers.deployBundle(
              Y.JSON.stringify({
                bundle: bundle
              }),
+ bundleId,
              env,
              db
          );

Index: test/test_bundle_import_helpers.js
=== modified file 'test/test_bundle_import_helpers.js'
--- test/test_bundle_import_helpers.js 2013-11-15 13:46:35 +0000
+++ test/test_bundle_import_helpers.js 2013-11-18 13:57:40 +0000
@@ -55,7 +55,7 @@
        };

        // Start the process by deploying the bundle.
- ns.BundleHelpers.deployBundle('test bundle', env, db);
+ ns.BundleHelpers.deployBundle('test bundle', undefined, env, db);
      });

      it('errors when the bundle import fails from the env', function(done) {
@@ -65,14 +65,14 @@
          done();
        };

- env.deployerImport = function(bundle, name, callback) {
+ env.deployerImport = function(bundle, name, bundleid, callback) {...

Read more...

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

LGTM Thanks for the discussion on this!

You can either do the comment below or make a ticket for someone else to
follow-up with at a later time.

https://codereview.appspot.com/28440043/diff/1/app/store/env/go.js
File app/store/env/go.js (right):

https://codereview.appspot.com/28440043/diff/1/app/store/env/go.js#newcode431
app/store/env/go.js:431: else if (Y.Lang.isFunction(bundleID) &&
callback === undefined) {
We should change this method to accept a configuration object instead of
relying on this munging.

https://codereview.appspot.com/28440043/

1205. By Brad Crittenden

Pass an object with bundle name and id to deploy functions.

1206. By Brad Crittenden

lint

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

*** Submitted:

Send the bundle ID when deploying.

By sending the bundle ID to the server, the deployment statistics can be
updated on Charmworld for that bundle.

QA:

In the latest charm trunk:
% juju switch ec2
% juju bootstrap
% make deploy
% juju set juju-gui
"juju-gui-source=lp:~bac/juju-gui/send-bundle-id-to-deployer"
% juju set juju-gui "charmworld-url=http://staging.jujucharms.com"

Search for a simple bundle. Jorge's are good. In this example I'll use
mediawiki-simple.

Look at the bundle on staging:
http://staging.jujucharms.com/bundle/~jorge/mediawiki-simple/mediawiki-simple

Note the Downloads statistics.

Go to your juju-gui instance on ec2.
Search for jorge.
Pick the bundle you want (mediawiki-simple in this case).
Deploy it.
Only when all service are successfully deployed, green, and relations
built
will the deployment statistics get updated. At that time go back to
staging
and see that the downloads have been incremented.

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

https://codereview.appspot.com/28440043/

Revision history for this message
Benjamin Saller (bcsaller) wrote :

I realize this is out of band but I'd like to change the API for deployer
to take a bundle archive similar to how charms work. We intend to have
bundles with custom hooks in the future and those should ship with the
deployer YAML. We can discuss this again as I get closer with some of the
other needed changes, but this is a heads up.

On Mon, Nov 18, 2013 at 10:33 AM, Brad Crittenden <email address hidden> wrote:

> *** Submitted:
>
> Send the bundle ID when deploying.
>
> By sending the bundle ID to the server, the deployment statistics can be
> updated on Charmworld for that bundle.
>
> QA:
>
> In the latest charm trunk:
> % juju switch ec2
> % juju bootstrap
> % make deploy
> % juju set juju-gui
> "juju-gui-source=lp:~bac/juju-gui/send-bundle-id-to-deployer"
> % juju set juju-gui "charmworld-url=http://staging.jujucharms.com"
>
> Search for a simple bundle. Jorge's are good. In this example I'll use
> mediawiki-simple.
>
> Look at the bundle on staging:
>
> http://staging.jujucharms.com/bundle/~jorge/mediawiki-simple/mediawiki-simple
>
> Note the Downloads statistics.
>
> Go to your juju-gui instance on ec2.
> Search for jorge.
> Pick the bundle you want (mediawiki-simple in this case).
> Deploy it.
> Only when all service are successfully deployed, green, and relations
> built
> will the deployment statistics get updated. At that time go back to
> staging
> and see that the downloads have been incremented.
>
> R=jeff.pihach
> CC=
> https://codereview.appspot.com/28440043
>
>
> https://codereview.appspot.com/28440043/
>
> --
>
> https://code.launchpad.net/~bac/juju-gui/send-bundle-id-to-deployer/+merge/195598
> Your team Juju GUI Hackers is requested to review the proposed merge of
> lp:~bac/juju-gui/send-bundle-id-to-deployer into lp:juju-gui.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/app.js'
--- app/app.js 2013-11-15 13:46:35 +0000
+++ app/app.js 2013-11-18 18:25:29 +0000
@@ -595,13 +595,14 @@
595 // Grab a reference of these for the nested event calls below.595 // Grab a reference of these for the nested event calls below.
596 var env = this.env;596 var env = this.env;
597 var db = this.db;597 var db = this.db;
598 cfg.deployBundle = function(bundle) {598 cfg.deployBundle = function(bundle, bundleId) {
599 // The other views will hand us an Object vs a YAML string. The import599 // The other views will hand us an Object vs a YAML string. The import
600 // helpers want the yaml string instead.600 // helpers want the yaml string instead.
601 importHelpers.deployBundle(601 importHelpers.deployBundle(
602 Y.JSON.stringify({602 Y.JSON.stringify({
603 bundle: bundle603 bundle: bundle
604 }),604 }),
605 bundleId,
605 env,606 env,
606 db607 db
607 );608 );
608609
=== modified file 'app/assets/javascripts/bundle-import-helpers.js'
--- app/assets/javascripts/bundle-import-helpers.js 2013-11-15 19:04:20 +0000
+++ app/assets/javascripts/bundle-import-helpers.js 2013-11-18 18:25:29 +0000
@@ -27,12 +27,13 @@
27 to deploy the bundle to the environment.27 to deploy the bundle to the environment.
2828
29 @method deployBundle29 @method deployBundle
30 @param {Object} bundle Bundle data.30 @param {String} bundle Bundle YAML data.
31 @param {String} bundleId Bundle ID for Charmworld. May be null.
31 @param {Environment} env Environment with access to the bundle back end.32 @param {Environment} env Environment with access to the bundle back end.
32 calls.33 calls.
33 @param {Database} db The app Database with access to the NotificationList.34 @param {Database} db The app Database with access to the NotificationList.
34 */35 */
35 deployBundle: function(bundle, env, db, customCallback) {36 deployBundle: function(bundle, bundleId, env, db, customCallback) {
36 var notifications = db.notifications;37 var notifications = db.notifications;
3738
38 var defaultCallback = function(result) {39 var defaultCallback = function(result) {
@@ -57,9 +58,13 @@
57 };58 };
5859
59 if (Y.Lang.isFunction(env.deployerImport)) {60 if (Y.Lang.isFunction(env.deployerImport)) {
61 var bundleData = {
62 name: null,
63 id: bundleId
64 };
60 env.deployerImport(65 env.deployerImport(
61 bundle,66 bundle,
62 null,67 bundleData,
63 customCallback ? customCallback : defaultCallback68 customCallback ? customCallback : defaultCallback
64 );69 );
65 } else {70 } else {
@@ -104,6 +109,7 @@
104 reader.onload = function(e) {109 reader.onload = function(e) {
105 ns.BundleHelpers.deployBundle(110 ns.BundleHelpers.deployBundle(
106 e.target.result,111 e.target.result,
112 undefined,
107 env,113 env,
108 db,114 db,
109 function(result) {115 function(result) {
110116
=== modified file 'app/store/env/go.js'
--- app/store/env/go.js 2013-11-15 13:46:35 +0000
+++ app/store/env/go.js 2013-11-18 18:25:29 +0000
@@ -416,27 +416,31 @@
416 *416 *
417 * @method deployerImport417 * @method deployerImport
418 * @param {String} yamlData to import.418 * @param {String} yamlData to import.
419 * @param {String} [bundleName] Bundle name to import.419 * @param {Object} bundleData Object describing the bundle. Has name and
420 * id. May be null.
420 * @param {Function} callback to trigger.421 * @param {Function} callback to trigger.
421 * @return {Number} Request Id.422 * @return {Number} Request Id.
422 */423 */
423 deployerImport: function(yamlData, bundleName, callback) {424 deployerImport: function(yamlData, bundleData, callback) {
424 var intermediateCallback;425 var intermediateCallback;
426 var name, id;
425427
426 if (Y.Lang.isFunction(bundleName) && callback === undefined) {
427 callback = bundleName;
428 bundleName = undefined;
429 }
430 if (callback) {428 if (callback) {
431 intermediateCallback = Y.bind(this.handleDeployerImport,429 intermediateCallback = Y.bind(this.handleDeployerImport,
432 this, callback);430 this, callback);
433 }431 }
432 if (Y.Lang.isValue(bundleData)) {
433 name = bundleData.name;
434 id = bundleData.id;
435 }
436
434 this._send_rpc({437 this._send_rpc({
435 Type: 'Deployer',438 Type: 'Deployer',
436 Request: 'Import',439 Request: 'Import',
437 Params: {440 Params: {
438 YAML: yamlData,441 YAML: yamlData,
439 Name: undefined442 Name: name,
443 BundleID: id
440 }444 }
441 }, intermediateCallback);445 }, intermediateCallback);
442 },446 },
443447
=== modified file 'app/subapps/browser/views/bundle.js'
--- app/subapps/browser/views/bundle.js 2013-11-14 18:53:43 +0000
+++ app/subapps/browser/views/bundle.js 2013-11-18 18:25:29 +0000
@@ -93,7 +93,7 @@
93 } else {93 } else {
94 this.fire('viewNavigate', {change: {charmID: null}});94 this.fire('viewNavigate', {change: {charmID: null}});
95 }95 }
96 this.get('deployBundle')(bundle.get('data'));96 this.get('deployBundle')(bundle.get('data'), bundle.get('id'));
97 },97 },
9898
99 /**99 /**
100100
=== modified file 'test/test_bundle_import_helpers.js'
--- test/test_bundle_import_helpers.js 2013-11-15 13:46:35 +0000
+++ test/test_bundle_import_helpers.js 2013-11-18 18:25:29 +0000
@@ -55,7 +55,7 @@
55 };55 };
5656
57 // Start the process by deploying the bundle.57 // Start the process by deploying the bundle.
58 ns.BundleHelpers.deployBundle('test bundle', env, db);58 ns.BundleHelpers.deployBundle('test bundle', undefined, env, db);
59 });59 });
6060
61 it('errors when the bundle import fails from the env', function(done) {61 it('errors when the bundle import fails from the env', function(done) {
@@ -65,14 +65,14 @@
65 done();65 done();
66 };66 };
6767
68 env.deployerImport = function(bundle, name, callback) {68 env.deployerImport = function(bundle, bundleData, callback) {
69 callback({69 callback({
70 err: 'Abort abort!'70 err: 'Abort abort!'
71 });71 });
72 };72 };
7373
74 // Start the process by deploying the bundle.74 // Start the process by deploying the bundle.
75 ns.BundleHelpers.deployBundle('test bundle', env, db);75 ns.BundleHelpers.deployBundle('test bundle', '~jorge/wiki/wiki', env, db);
76 });76 });
7777
78 it('provides deployBundle helper for working through env', function(done) {78 it('provides deployBundle helper for working through env', function(done) {
@@ -87,10 +87,12 @@
8787
88 // Stub out the env call to make sure we check the params and call the88 // Stub out the env call to make sure we check the params and call the
89 // provided callback.89 // provided callback.
90 env.deployerImport = function(bundle, name, callback) {90 env.deployerImport = function(bundle, bundleData, callback) {
91 assert.equal(bundle, 'test bundle');91 assert.equal(bundle, 'test bundle');
92 assert.equal(bundleData.id, '~jorge/wiki/wiki');
92 assert.equal(93 assert.equal(
93 name, null, 'The name is not currently supported or passed.');94 bundleData.name, null,
95 'The name is not currently supported or passed.');
94 // This is the default callback from the deployBundle method.96 // This is the default callback from the deployBundle method.
95 callback({97 callback({
96 err: undefined,98 err: undefined,
@@ -108,12 +110,12 @@
108 ns.BundleHelpers._watchDeployment = _watchDeployment;110 ns.BundleHelpers._watchDeployment = _watchDeployment;
109111
110 // Make sure we did in fact post our notification to the user.112 // Make sure we did in fact post our notification to the user.
111 assert.equal(hitNotifications, true);113 assert.equal(true, hitNotifications);
112 done();114 done();
113 };115 };
114116
115 // Start the process by deploying the bundle.117 // Start the process by deploying the bundle.
116 ns.BundleHelpers.deployBundle('test bundle', env, db);118 ns.BundleHelpers.deployBundle('test bundle', '~jorge/wiki/wiki', env, db);
117 });119 });
118120
119 it('provides a notification when a deploy watch updates', function(done) {121 it('provides a notification when a deploy watch updates', function(done) {
@@ -223,7 +225,7 @@
223225
224 // Stub out the env call to make sure we check the params and call the226 // Stub out the env call to make sure we check the params and call the
225 // provided callback.227 // provided callback.
226 env.deployerImport = function(bundle, name, callback) {228 env.deployerImport = function(bundle, bundleData, callback) {
227 callback({229 callback({
228 err: undefined,230 err: undefined,
229 DeploymentId: 10231 DeploymentId: 10
@@ -295,7 +297,7 @@
295 };297 };
296298
297 // Start the process by deploying the bundle.299 // Start the process by deploying the bundle.
298 ns.BundleHelpers.deployBundle('test bundle', env, db);300 ns.BundleHelpers.deployBundle('test bundle', undefined, env, db);
299301
300 });302 });
301303

Subscribers

People subscribed via source and target branches