remove duplicates
This commit is contained in:
parent
8ed50608b1
commit
4f5d3face2
|
@ -63,7 +63,7 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
if len(c.SnapshotRegions) > 0 {
|
if len(c.SnapshotRegions) > 0 {
|
||||||
regionSet := make(map[string]struct{})
|
regionSet := make(map[string]struct{})
|
||||||
regions := make([]string, 0, len(c.SnapshotRegions))
|
regions := make([]string, 0, len(c.SnapshotRegions))
|
||||||
|
regionSet[c.Region] = struct{}{}
|
||||||
for _, region := range c.SnapshotRegions {
|
for _, region := range c.SnapshotRegions {
|
||||||
// If we already saw the region, then don't look again
|
// If we already saw the region, then don't look again
|
||||||
if _, ok := regionSet[region]; ok {
|
if _, ok := regionSet[region]; ok {
|
||||||
|
@ -76,6 +76,7 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
regions = append(regions, region)
|
regions = append(regions, region)
|
||||||
}
|
}
|
||||||
c.SnapshotRegions = regions
|
c.SnapshotRegions = regions
|
||||||
|
|
||||||
for transfer := range c.SnapshotRegions {
|
for transfer := range c.SnapshotRegions {
|
||||||
transferRequest := &godo.ActionRequest{
|
transferRequest := &godo.ActionRequest{
|
||||||
"type": "transfer",
|
"type": "transfer",
|
||||||
|
@ -89,13 +90,7 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
ui.Say(fmt.Sprintf("Transfering Snapshot ID: %d", imageTransfer.ID))
|
ui.Say(fmt.Sprintf("Transfering Snapshot ID: %d", imageTransfer.ID))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Say(fmt.Sprintf("Snapshot region: %d", len(regions)))
|
|
||||||
// ui.Say(fmt.Sprintf("Snapshot regions: %s", strings.Join(c.SnapshotRegions[:], ",")))
|
|
||||||
|
|
||||||
//client.ImageActions.Transfer(context.TODO(), )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageId int
|
var imageId int
|
||||||
|
|
Loading…
Reference in New Issue