create image list
This commit is contained in:
parent
fa54a64d28
commit
84bb5d2f6f
|
@ -125,6 +125,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
uploadImageCommand: b.config.BuilderUploadImageCommand,
|
||||
imageName: b.config.ImageName,
|
||||
},
|
||||
&stepListImages{},
|
||||
&common.StepCleanupTempKeys{
|
||||
Comm: &b.config.Comm,
|
||||
},
|
||||
|
@ -164,6 +165,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
return nil, rawErr.(error)
|
||||
}
|
||||
|
||||
// TODO fix me
|
||||
// If there is no snapshot, then just return
|
||||
if _, ok := state.GetOk("snapshot"); !ok {
|
||||
return nil, nil
|
||||
|
|
|
@ -102,6 +102,7 @@ func (s *stepCreateImage) Run(_ context.Context, state multistep.StateBag) multi
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
log.Printf("Registered machine image: %+v", mi)
|
||||
state.Put("machine_image", mi.Name)
|
||||
/*
|
||||
Registered machine image: &{
|
||||
Account:/Compute-ptstest/cloud_storage
|
||||
|
@ -120,16 +121,15 @@ func (s *stepCreateImage) Run(_ context.Context, state multistep.StateBag) multi
|
|||
}
|
||||
*/
|
||||
/* TODO:
|
||||
* POST /machineimage/ (DONE)
|
||||
POST /imagelist/
|
||||
POST /imagelistentry/
|
||||
* POST /machineimage/ DONE
|
||||
POST /imagelist/ DONE
|
||||
POST /imagelistentry/ DONE
|
||||
in that order.
|
||||
* re-use step_list_images
|
||||
* re-use step_list_images DONE
|
||||
* Documentation
|
||||
* Configuration (master/builder images & entry, destination stuff, etc)
|
||||
* split master/builder image/connection config. i.e. build anything, master only linux
|
||||
* correct artifact
|
||||
* segments go in to sub-directory (entry)
|
||||
* correct artifact DONE
|
||||
*/
|
||||
|
||||
return multistep.ActionContinue
|
||||
|
|
|
@ -45,12 +45,12 @@ func (s *stepListImages) Run(_ context.Context, state multistep.StateBag) multis
|
|||
}
|
||||
|
||||
// Now create and image list entry for the image into that list.
|
||||
snap := state.Get("snapshot").(*compute.Snapshot)
|
||||
machineImage := state.Get("machine_image").(string)
|
||||
version := len(imList.Entries) + 1
|
||||
entriesClient := client.ImageListEntries()
|
||||
entriesInput := compute.CreateImageListEntryInput{
|
||||
Name: config.DestImageList,
|
||||
MachineImages: []string{config.Identifier(snap.MachineImage)},
|
||||
MachineImages: []string{config.Identifier(machineImage)},
|
||||
Version: version,
|
||||
}
|
||||
entryInfo, err := entriesClient.CreateImageListEntry(&entriesInput)
|
||||
|
|
|
@ -39,6 +39,7 @@ func (s *stepSnapshot) Run(_ context.Context, state multistep.StateBag) multiste
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
state.Put("snapshot", snap)
|
||||
state.Put("machine_image", snap.MachineImage)
|
||||
ui.Message(fmt.Sprintf("Created snapshot: %s.", snap.Name))
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue