Skip to content

Commit b5033bd

Browse files
authored
Merge pull request #195 from AtaxyaNetwork/iso-name
Fix iso_name + don't destroy iso when using iso_name
2 parents d9d8f05 + 7fb81b3 commit b5033bd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

builder/xenserver/common/step_upload_vdi.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type StepUploadVdi struct {
1616
VdiNameFunc func() string
1717
ImagePathFunc func() string
1818
VdiUuidKey string
19+
PreserveVdi bool
1920
}
2021

2122
func (self *StepUploadVdi) uploadVdi(ctx context.Context, state multistep.StateBag) multistep.StepAction {
@@ -105,7 +106,7 @@ func (self *StepUploadVdi) Cleanup(state multistep.StateBag) {
105106

106107
vdiName := self.VdiNameFunc()
107108

108-
if config.ShouldKeepVM(state) {
109+
if config.ShouldKeepVM(state) || self.PreserveVdi {
109110
return
110111
}
111112

builder/xenserver/iso/builder.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
254254
&xscommon.StepFindOrUploadVdi{
255255
xscommon.StepUploadVdi{
256256
VdiNameFunc: func() string {
257+
if self.config.ISOName != "" {
258+
return self.config.ISOName
259+
}
257260
if len(self.config.ISOUrls) > 0 {
258261
return path.Base(self.config.ISOUrls[0])
259262
}
@@ -265,7 +268,8 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
265268
}
266269
return ""
267270
},
268-
VdiUuidKey: "iso_vdi_uuid",
271+
VdiUuidKey: "iso_vdi_uuid",
272+
PreserveVdi: self.config.ISOName != "",
269273
},
270274
},
271275
&xscommon.StepFindVdi{

0 commit comments

Comments
 (0)