Skip to content

Commit

Permalink
Merge branch 'release-0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
aminjam committed Jan 3, 2015
2 parents a3748f9 + 802e43d commit 19f8562
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
Binary file modified bin/hipops
Binary file not shown.
25 changes: 21 additions & 4 deletions parser/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ type playbook struct {
Apps []string
}

func (p *playbook) baseDuplicate() *playbook {
dup := &playbook{}
dup.Name = p.Name
dup.Play = p.Play
dup.State = p.State
dup.Inventory = p.Inventory
dup.User = p.User
dup.State = p.State
dupContainers := make([]*plugins.Container, len(p.Containers))
for i, _ := range p.Containers {
dupContainers[i] = p.Containers[i].BaseDuplicate()
}
dup.Containers = dupContainers
return dup
}

func (p *playbook) configure(plugin *plugins.Plugin) error {
if p.Inventory == "" {
return errors.New(utilities.INVENTORY_MISSING)
Expand Down Expand Up @@ -144,15 +160,16 @@ func (sc *Scenario) Parse(plugin *plugins.Plugin) ([]*plugins.Action, error) {

if len(p.Apps) != 0 {
for _, appString := range p.Apps {
subAction := action.BaseDuplicate()
p.Name = utilities.ParseTemplate("{{.App.Name}}", sc, appString)
app, err := sc.findApp(p.Name)
subPlaybook := p.baseDuplicate()
subAction := action.BaseDuplicate()
app, err := sc.findApp(subPlaybook.Name)
if err != nil {
return nil, err
}
sc.configureContainers(p, plugin, appString)
sc.configureContainers(subPlaybook, plugin, appString)
app.toAction(subAction)
p.toAction(subAction)
subPlaybook.toAction(subAction)
actions[counter] = subAction
counter++
}
Expand Down
8 changes: 8 additions & 0 deletions plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,11 @@ func (c *Container) Configure() {
c.Params = fmt.Sprintf("--name %s %s", c.Name, c.Params)
}
}

func (a *Container) BaseDuplicate() *Container {
dup := &Container{}
dup.Params = a.Params
dup.Name = a.Name
dup.State = a.State
return dup
}
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main
var GitCommit string

// The main version number that is being run at the moment.
const Version = "0.1.1"
const Version = "0.1.2"

// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
Expand Down

0 comments on commit 19f8562

Please sign in to comment.