Skip to content

Commit

Permalink
Merge pull request juju#12 from frankban/new-format
Browse files Browse the repository at this point in the history
bundlechanges: remove format inconsistencies.

Specifically:
- handle service constraints;
- avoid passing the number of units (always 1) to addUnit GUIArgs;
- use a placeholder for the addService charm, pointing to the corresponding
  addCharm change, to be replaced with the fully resolved charm id.

Note that this is a backward incompatible change and both juju-core and 
the Juju GUI will need to be updated.
  • Loading branch information
jujugui committed Oct 13, 2015
2 parents 4a00e08 + 0b9f01f commit b2d0b09
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 66 deletions.
9 changes: 5 additions & 4 deletions changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (ch *AddServiceChange) GUIArgs() []interface{} {
if options == nil {
options = make(map[string]interface{}, 0)
}
return []interface{}{ch.Params.Charm, ch.Params.Service, options}
return []interface{}{ch.Params.Charm, ch.Params.Service, options, ch.Params.Constraints}
}

// AddServiceParams holds parameters for deploying a Juju service.
Expand All @@ -223,7 +223,8 @@ type AddServiceParams struct {
Service string
// Options holds service options.
Options map[string]interface{}
// TODO frankban: add support for service constraints.
// Constraints holds the optional service constraints.
Constraints string
}

// newAddUnitChange creates a new change for adding a service unit.
Expand All @@ -246,9 +247,9 @@ type AddUnitChange struct {

// GUIArgs implements Change.GUIArgs.
func (ch *AddUnitChange) GUIArgs() []interface{} {
args := []interface{}{ch.Params.Service, 1, nil}
args := []interface{}{ch.Params.Service, nil}
if ch.Params.To != "" {
args[2] = ch.Params.To
args[1] = ch.Params.To
}
return args
}
Expand Down

0 comments on commit b2d0b09

Please sign in to comment.