Skip to content

Commit

Permalink
update to add flavors and disk size
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Jan 14, 2018
1 parent 1619213 commit ecd83aa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
17 changes: 9 additions & 8 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import:
- package: github.com/mitchellh/multistep
version: 391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d
- package: github.com/sandwichcloud/deli-cli
version: 0.0.10
version: 0.0.14
2 changes: 2 additions & 0 deletions sandwich/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func (builder *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache)
},
&StepRunInstance{
Name: builder.config.ImageName,
FlavorID: builder.config.FlavorID,
Disk: builder.config.Disk,
SourceImageID: builder.config.SourceImageID,
NetworkID: builder.config.NetworkID,
UserData: builder.config.UserData,
Expand Down
7 changes: 4 additions & 3 deletions sandwich/run_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type RunConfig struct {

SourceImageID string `mapstructure:"source_image_id"`
FlavorID string `mapstructure:"flavor_id"`
Disk int `mapstructure:"disk"`
NetworkID string `mapstructure:"network_id"`
UserData string `mapstructure:"user_data"`
Tags map[string]string `mapstructure:"tags"`
Expand Down Expand Up @@ -49,9 +50,9 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
errs = append(errs, errors.New("network_id must be specified"))
}

//if c.FlavorID == "" {
// errs = append(errs, errors.New("flavor_id must be specified"))
//}
if c.FlavorID == "" {
errs = append(errs, errors.New("flavor_id must be specified"))
}

return errs
}
4 changes: 3 additions & 1 deletion sandwich/step_run_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

type StepRunInstance struct {
Name string
FlavorID string
Disk int
SourceImageID string
NetworkID string
UserData string
Expand Down Expand Up @@ -42,7 +44,7 @@ func (s *StepRunInstance) Run(state multistep.StateBag) multistep.StepAction {
s.Tags = make(map[string]string)
}

instance, err := instanceClient.Create(s.Name, s.SourceImageID, config.RegionID, "", s.NetworkID, "", keyPairIDs, s.Tags)
instance, err := instanceClient.Create(s.Name, s.SourceImageID, config.RegionID, "", s.NetworkID, "", s.FlavorID, s.Disk, keyPairIDs, s.Tags)
if err != nil {
err := fmt.Errorf("Error creating source instance: %s", err)
state.Put("error", err)
Expand Down

0 comments on commit ecd83aa

Please sign in to comment.