Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
667c5394
Commit
667c5394
authored
Jun 15, 2015
by
Marc Siegfriedt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use template for additional disks
parent
899cd7b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
builder/vmware/iso/builder.go
builder/vmware/iso/builder.go
+15
-14
builder/vmware/iso/step_create_vmx.go
builder/vmware/iso/step_create_vmx.go
+24
-2
No files found.
builder/vmware/iso/builder.go
100644 → 100755
View file @
667c5394
...
...
@@ -36,20 +36,21 @@ type Config struct {
vmwcommon
.
ToolsConfig
`mapstructure:",squash"`
vmwcommon
.
VMXConfig
`mapstructure:",squash"`
AdditionalDiskSize
[]
uint
`mapstructure:"disk_additional_size"`
DiskName
string
`mapstructure:"vmdk_name"`
DiskSize
uint
`mapstructure:"disk_size"`
DiskTypeId
string
`mapstructure:"disk_type_id"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestOSType
string
`mapstructure:"guest_os_type"`
ISOChecksum
string
`mapstructure:"iso_checksum"`
ISOChecksumType
string
`mapstructure:"iso_checksum_type"`
ISOUrls
[]
string
`mapstructure:"iso_urls"`
Version
string
`mapstructure:"version"`
VMName
string
`mapstructure:"vm_name"`
BootCommand
[]
string
`mapstructure:"boot_command"`
SkipCompaction
bool
`mapstructure:"skip_compaction"`
VMXTemplatePath
string
`mapstructure:"vmx_template_path"`
AdditionalDiskSize
[]
uint
`mapstructure:"disk_additional_size"`
DiskName
string
`mapstructure:"vmdk_name"`
DiskSize
uint
`mapstructure:"disk_size"`
DiskTypeId
string
`mapstructure:"disk_type_id"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestOSType
string
`mapstructure:"guest_os_type"`
ISOChecksum
string
`mapstructure:"iso_checksum"`
ISOChecksumType
string
`mapstructure:"iso_checksum_type"`
ISOUrls
[]
string
`mapstructure:"iso_urls"`
Version
string
`mapstructure:"version"`
VMName
string
`mapstructure:"vm_name"`
BootCommand
[]
string
`mapstructure:"boot_command"`
SkipCompaction
bool
`mapstructure:"skip_compaction"`
VMXTemplatePath
string
`mapstructure:"vmx_template_path"`
VMXDiskTemplatePath
string
`mapstructure:"vmx_disk_template_path"`
RemoteType
string
`mapstructure:"remote_type"`
RemoteDatastore
string
`mapstructure:"remote_datastore"`
...
...
builder/vmware/iso/step_create_vmx.go
100644 → 100755
View file @
667c5394
...
...
@@ -76,7 +76,29 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
DiskName
:
config
.
DiskName
,
}
diskTemplate
,
err
:=
interpolate
.
Render
(
DefaultAdditionalDiskTemplate
,
&
ctx
)
diskTemplate
:=
DefaultAdditionalDiskTemplate
if
config
.
VMXDiskTemplatePath
!=
""
{
f
,
err
:=
os
.
Open
(
config
.
VMXDiskTemplatePath
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error reading VMX disk template: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
defer
f
.
Close
()
rawBytes
,
err
:=
ioutil
.
ReadAll
(
f
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error reading VMX disk template: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
diskTemplate
=
string
(
rawBytes
)
}
diskContents
,
err
:=
interpolate
.
Render
(
diskTemplate
,
&
ctx
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing VMX template for additional disk: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
...
...
@@ -84,7 +106,7 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
vmxTemplate
+=
disk
Template
vmxTemplate
+=
disk
Contents
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment