Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Adds set_config to the ECS supported methods. #188

Merged
merged 2 commits into from Mar 21, 2014

Conversation

hatched
Copy link
Contributor

@hatched hatched commented Mar 20, 2014

This branch adds hierarchical command functionality to the ECS along with the set_config env method.

To QA

  • Open the GUI using the ecs flag.
  • Drag the liferay from the charmbrowser and click the deploy button once.
  • Open the console and run app.ecs.changeSet and make note of the id (service-xxx).
  • Run the following substituting the id with the appropriate one app.ecs.setConfig('service-xxx', {'http-port': "80802"}, null, {'http-port': "8080"}, function() {});.
  • Run app.ecs.changeSet and there should now be two entries in the 'commands' array the second of which should have the method property set to 'set_config'.

Jeff added 2 commits March 20, 2014 09:58
Added heirarcical command execution.
Added tests for the set_config functionality.
@jujugui
Copy link
Contributor

jujugui commented Mar 20, 2014

Test PASSed.
Refer to this link for build results: http://ci.jujugui.org:8080/job/juju-gui/578/

var changeSet = this.changeSet[key];
var length = changeSet.commands.push(command);
// Add next function to execute to previous next() command.
changeSet.commands[length - 2].next = this._execute.bind(this, command);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you flesh this out a little bit more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing you mean flesh out the comment more...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, it would be nice at this point to have a documentation on how you intend to design the changeSet data structure.
For example, does it allow to add a command to a nested key?

E.g. suppose you have the following lazy actions:

  1. add a new machine;
  2. create an LXC container inside the machine in 1;
  3. add a unit to the LXC in 2.
    The execution order is obviously important here, and we two nesting levels.

Here is another example:

  1. add a unit to a machine;
  2. remove that unit.
    This should result in a no-op when the queryset is committed. Will this kind of logic be handled here?

Another example (sorry, I write too much):

  1. create a new service;
  2. change settings for that service;
  3. change settings for that service again.
    In this case, I guess the more convenient thing to do is ignoring 2. With the current approach, it looks like we would execute both 2 and 3.

I'd like to knwo what do you think about the following.
What about having a single addCommand(changeSet, key, command) method allowing for nested keys? e.g. "machine-new-1.lxc-new-1.django/2"? If this is crazy, please ignore me.

Another question: it seems you designed commands to be a linked-list-like array. I am ok with that if we are sure we can easily traverse the tree and modify/remove existing keys. Right now it seems the only traversing enabled automatically executes the next command, and this feels dangerous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per our hangout the underlying structure will change to a list which will then have convenience methods to parse and execute based on internal record references to their hierarchy.

@frankban
Copy link
Member

This branch is nice Jeff.
I just have some questions and documentation requests.
The other comments are just minor fixes.
Thank you!

@hatched
Copy link
Contributor Author

hatched commented Mar 21, 2014

Landing as per our hangout discussion with the data structure changes to be coming in the follow-up branches. Thanks for the reviews! :shipit:

@jujugui
Copy link
Contributor

jujugui commented Mar 21, 2014

Build failed: Attempt to land pull request failed
build url: http://ci.jujugui.org:8080/job/juju-gui-merge/198

@jujugui
Copy link
Contributor

jujugui commented Mar 21, 2014

Status: merge request accepted. Url: http://ci.jujugui.org:8080/job/juju-gui-merge

jujugui added a commit that referenced this pull request Mar 21, 2014
This branch adds hierarchical command functionality to the ECS along with the set_config env method.

__To QA__
- Open the GUI using the `ecs` flag.
- Drag the liferay from the charmbrowser and click the deploy button once.
- Open the console and run `app.ecs.changeSet` and make note of the id (service-xxx).
- Run the following substituting the id with the appropriate one `app.ecs.setConfig('service-xxx', {'http-port': "80802"}, null, {'http-port': "8080"}, function() {});`.
- Run `app.ecs.changeSet` and there should now be two entries in the 'commands' array the second of which should have the method property set to 'set_config'.
@jujugui jujugui merged commit 21ee0c8 into juju:develop Mar 21, 2014
@hatched hatched deleted the esm-setconfig branch March 21, 2014 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants