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