Compare commits
2 Commits
main
...
ddelnano/d
Author | SHA1 | Date | |
---|---|---|---|
|
e199af7bae | ||
|
4a2061de91 |
2
.github/workflows/go-test.yml
vendored
2
.github/workflows/go-test.yml
vendored
@ -19,6 +19,6 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "1.20"
|
||||
go-version: 1.18
|
||||
- name: Run go tests
|
||||
run: go test -race -count 1 ./... -timeout=3m
|
||||
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "1.20"
|
||||
go-version: 1.18
|
||||
- name: Describe plugin
|
||||
id: plugin_describe
|
||||
run: echo "::set-output name=api_version::$(go run . describe | jq -r '.api_version')"
|
||||
@ -36,10 +36,10 @@ jobs:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: release --clean
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -1 +0,0 @@
|
||||
1.20.11
|
@ -1,4 +1,3 @@
|
||||
version: 2
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
env:
|
||||
@ -71,4 +70,4 @@ release:
|
||||
draft: false
|
||||
|
||||
changelog:
|
||||
disable: true
|
||||
skip: true
|
||||
|
28
README.md
28
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
This builder plugin extends packer.io to support building images for XenServer.
|
||||
|
||||
This is a fork of the original builder since the original project was abandoned and no longer compiled with recent versions of Go or worked with Xenserver 7.6 and later.
|
||||
This is a fork of the original builder since the original project was abandoned and no longer compilied with recent versions of Go or worked with Xenserver 7.6 and later.
|
||||
|
||||
It improves the original project in the following ways:
|
||||
1. Developed alongside the [Xenorchestra terraform provider](https://github.com/ddelnano/terraform-provider-xenorchestra) to ensure the hashicorp ecosystem is interoperable.
|
||||
@ -13,7 +13,6 @@ It improves the original project in the following ways:
|
||||
At the time of this writing the packer builder has been verified to work with Xenserver 7.6 and can launch VMs with the packer output through the xenorchestra terraform provider.
|
||||
|
||||
The following list contains things that are incomplete but will be worked on soon:
|
||||
|
||||
- The documentation is still in an inconsistent state with upstream
|
||||
- XVA builder is untested
|
||||
- Lots of dead code to remove from upstream
|
||||
@ -25,7 +24,7 @@ The packer builder can be installed via `packer init` as long as the packer temp
|
||||
packer {
|
||||
required_plugins {
|
||||
xenserver= {
|
||||
version = ">= v0.6.0"
|
||||
version = ">= v0.3.2"
|
||||
source = "github.com/ddelnano/xenserver"
|
||||
}
|
||||
}
|
||||
@ -45,32 +44,19 @@ If you are using an older version of packer or are still using json templates yo
|
||||
### Dependencies
|
||||
* Packer >= v1.7.1 (https://packer.io)
|
||||
* XenServer / Citrix Hypervisor > 7.6
|
||||
* Golang 1.20
|
||||
* Golang 1.18
|
||||
|
||||
## Compile the plugin
|
||||
|
||||
Once you have installed Packer, you must compile this plugin and install the
|
||||
resulting binary.
|
||||
|
||||
Documentation for Plugins directory: [Official Docs](https://developer.hashicorp.com/packer/docs/configure#packer-s-plugin-directory)
|
||||
|
||||
### Linux/MacOS
|
||||
|
||||
```shell
|
||||
go build -o packer-plugin-xenserver
|
||||
$ go build -o packer-plugin-xenserver
|
||||
|
||||
# Add the plugin to the location packer expects it to be installed in
|
||||
mkdir -p ~/.packer.d/plugins/
|
||||
cp packer-plugin-xenserver ~/.packer.d/plugins
|
||||
```
|
||||
|
||||
### Windows (Powershell)
|
||||
|
||||
```powershell
|
||||
go build -o packer-plugin-xenserver
|
||||
|
||||
mkdir "%APPDATA%\packer.d\plugins"
|
||||
cp packer-plugin-xenserver "%APPDATA%\packer.d\plugins"
|
||||
# Add the builder to the location packer expects it to be installed in
|
||||
$ mkdir -p ~/.packer.d/plugins/
|
||||
$ cp builder-xenserver-iso ~/.packer.d/plugins/packer-builder-xenserver-iso
|
||||
```
|
||||
|
||||
# Documentation
|
||||
|
@ -13,10 +13,9 @@ import (
|
||||
)
|
||||
|
||||
type CommonConfig struct {
|
||||
Username string `mapstructure:"remote_username"`
|
||||
Password string `mapstructure:"remote_password"`
|
||||
HostIp string `mapstructure:"remote_host"`
|
||||
HostSshPort uint `mapstructure:"remote_ssh_port"`
|
||||
Username string `mapstructure:"remote_username"`
|
||||
Password string `mapstructure:"remote_password"`
|
||||
HostIp string `mapstructure:"remote_host"`
|
||||
|
||||
VMName string `mapstructure:"vm_name"`
|
||||
VMDescription string `mapstructure:"vm_description"`
|
||||
@ -65,10 +64,6 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig
|
||||
|
||||
// Set default values
|
||||
|
||||
if c.HostSshPort == 0 {
|
||||
c.HostSshPort = 22
|
||||
}
|
||||
|
||||
if c.HostPortMin == 0 {
|
||||
c.HostPortMin = 5900
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ type Config struct {
|
||||
VCPUsMax uint `mapstructure:"vcpus_max"`
|
||||
VCPUsAtStartup uint `mapstructure:"vcpus_atstartup"`
|
||||
VMMemory uint `mapstructure:"vm_memory"`
|
||||
DiskName string `mapstructure:"disk_name"`
|
||||
DiskSize uint `mapstructure:"disk_size"`
|
||||
CloneTemplate string `mapstructure:"clone_template"`
|
||||
VMOtherConfig map[string]string `mapstructure:"vm_other_config"`
|
||||
@ -35,7 +34,6 @@ type Config struct {
|
||||
SourcePath string `mapstructure:"source_path"`
|
||||
|
||||
Firmware string `mapstructure:"firmware"`
|
||||
SkipSetTemplate bool `mapstructure:"skip_set_template"`
|
||||
|
||||
ctx interpolate.Context
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ type FlatConfig struct {
|
||||
Username *string `mapstructure:"remote_username" cty:"remote_username" hcl:"remote_username"`
|
||||
Password *string `mapstructure:"remote_password" cty:"remote_password" hcl:"remote_password"`
|
||||
HostIp *string `mapstructure:"remote_host" cty:"remote_host" hcl:"remote_host"`
|
||||
HostSshPort *uint `mapstructure:"remote_ssh_port" cty:"remote_ssh_port" hcl:"remote_ssh_port"`
|
||||
VMName *string `mapstructure:"vm_name" cty:"vm_name" hcl:"vm_name"`
|
||||
VMDescription *string `mapstructure:"vm_description" cty:"vm_description" hcl:"vm_description"`
|
||||
SrName *string `mapstructure:"sr_name" cty:"sr_name" hcl:"sr_name"`
|
||||
@ -99,7 +98,6 @@ type FlatConfig struct {
|
||||
VCPUsMax *uint `mapstructure:"vcpus_max" cty:"vcpus_max" hcl:"vcpus_max"`
|
||||
VCPUsAtStartup *uint `mapstructure:"vcpus_atstartup" cty:"vcpus_atstartup" hcl:"vcpus_atstartup"`
|
||||
VMMemory *uint `mapstructure:"vm_memory" cty:"vm_memory" hcl:"vm_memory"`
|
||||
DiskName *string `mapstructure:"disk_name" cty:"disk_name" hcl:"disk_name"`
|
||||
DiskSize *uint `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"`
|
||||
CloneTemplate *string `mapstructure:"clone_template" cty:"clone_template" hcl:"clone_template"`
|
||||
VMOtherConfig map[string]string `mapstructure:"vm_other_config" cty:"vm_other_config" hcl:"vm_other_config"`
|
||||
@ -111,7 +109,6 @@ type FlatConfig struct {
|
||||
RawInstallTimeout *string `mapstructure:"install_timeout" cty:"install_timeout" hcl:"install_timeout"`
|
||||
SourcePath *string `mapstructure:"source_path" cty:"source_path" hcl:"source_path"`
|
||||
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
||||
SkipSetTemplate *bool `mapstructure:"skip_set_template" cty:"skip_set_template" hcl:"skip_set_template"`
|
||||
}
|
||||
|
||||
// FlatMapstructure returns a new FlatConfig.
|
||||
@ -137,7 +134,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||
"remote_username": &hcldec.AttrSpec{Name: "remote_username", Type: cty.String, Required: false},
|
||||
"remote_password": &hcldec.AttrSpec{Name: "remote_password", Type: cty.String, Required: false},
|
||||
"remote_host": &hcldec.AttrSpec{Name: "remote_host", Type: cty.String, Required: false},
|
||||
"remote_ssh_port": &hcldec.AttrSpec{Name: "remote_ssh_port", Type: cty.Number, Required: false},
|
||||
"vm_name": &hcldec.AttrSpec{Name: "vm_name", Type: cty.String, Required: false},
|
||||
"vm_description": &hcldec.AttrSpec{Name: "vm_description", Type: cty.String, Required: false},
|
||||
"sr_name": &hcldec.AttrSpec{Name: "sr_name", Type: cty.String, Required: false},
|
||||
@ -215,7 +211,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||
"vcpus_max": &hcldec.AttrSpec{Name: "vcpus_max", Type: cty.Number, Required: false},
|
||||
"vcpus_atstartup": &hcldec.AttrSpec{Name: "vcpus_atstartup", Type: cty.Number, Required: false},
|
||||
"vm_memory": &hcldec.AttrSpec{Name: "vm_memory", Type: cty.Number, Required: false},
|
||||
"disk_name": &hcldec.AttrSpec{Name: "disk_name", Type: cty.String, Required: false},
|
||||
"disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false},
|
||||
"clone_template": &hcldec.AttrSpec{Name: "clone_template", Type: cty.String, Required: false},
|
||||
"vm_other_config": &hcldec.AttrSpec{Name: "vm_other_config", Type: cty.Map(cty.String), Required: false},
|
||||
@ -227,7 +222,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||
"install_timeout": &hcldec.AttrSpec{Name: "install_timeout", Type: cty.String, Required: false},
|
||||
"source_path": &hcldec.AttrSpec{Name: "source_path", Type: cty.String, Required: false},
|
||||
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
||||
"skip_set_template": &hcldec.AttrSpec{Name: "skip_set_template", Type: cty.Bool, Required: false},
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
|
||||
func SSHAddress(state multistep.StateBag) (string, error) {
|
||||
sshIP := state.Get("ssh_address").(string)
|
||||
sshHostPort := state.Get("ssh_port").(uint)
|
||||
sshHostPort := 22
|
||||
return fmt.Sprintf("%s:%d", sshIP, sshHostPort), nil
|
||||
}
|
||||
|
||||
@ -114,10 +114,10 @@ func ExecuteGuestSSHCmd(state multistep.StateBag, cmd string) (stdout string, er
|
||||
return doExecuteSSHCmd(cmd, localAddress, sshConfig)
|
||||
}
|
||||
|
||||
func forward(local_conn net.Conn, config *gossh.ClientConfig, server string, server_ssh_port int, remote_dest string, remote_port uint) error {
|
||||
func forward(local_conn net.Conn, config *gossh.ClientConfig, server, remote_dest string, remote_port uint) error {
|
||||
defer local_conn.Close()
|
||||
|
||||
ssh_client_conn, err := gossh.Dial("tcp", fmt.Sprintf("%s:%d", server, server_ssh_port), config)
|
||||
ssh_client_conn, err := gossh.Dial("tcp", server+":22", config)
|
||||
if err != nil {
|
||||
log.Printf("local ssh.Dial error: %s", err)
|
||||
return err
|
||||
@ -157,7 +157,7 @@ func forward(local_conn net.Conn, config *gossh.ClientConfig, server string, ser
|
||||
return nil
|
||||
}
|
||||
|
||||
func ssh_port_forward(local_listener net.Listener, remote_port int, remote_dest, host string, host_ssh_port int, username, password string) error {
|
||||
func ssh_port_forward(local_listener net.Listener, remote_port int, remote_dest, host, username, password string) error {
|
||||
|
||||
config := &gossh.ClientConfig{
|
||||
User: username,
|
||||
@ -176,7 +176,7 @@ func ssh_port_forward(local_listener net.Listener, remote_port int, remote_dest,
|
||||
}
|
||||
|
||||
// Forward to a remote port
|
||||
go forward(local_connection, config, host, host_ssh_port, remote_dest, uint(remote_port))
|
||||
go forward(local_connection, config, host, remote_dest, uint(remote_port))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -122,7 +122,7 @@ func (self *StepCreateInstance) Run(ctx context.Context, state multistep.StateBa
|
||||
ui.Say(fmt.Sprintf("Using the following SR for the VM: %s", sr))
|
||||
|
||||
vdi, err := c.GetClient().VDI.Create(c.GetSessionRef(), xenapi.VDIRecord{
|
||||
NameLabel: config.DiskName,
|
||||
NameLabel: "Packer-disk",
|
||||
VirtualSize: int(config.DiskSize * 1024 * 1024),
|
||||
Type: "user",
|
||||
Sharable: false,
|
||||
|
@ -35,11 +35,10 @@ func (self *StepForwardPortOverSSH) Run(ctx context.Context, state multistep.Sta
|
||||
ui.Say(fmt.Sprintf("Creating a local port forward over SSH on local port %d", sshHostPort))
|
||||
|
||||
hostAddress, _ := state.Get("ssh_address").(string)
|
||||
hostSshPort, _ := state.Get("ssh_port").(int)
|
||||
remotePort, _ := self.RemotePort(state)
|
||||
remoteDest, _ := self.RemoteDest(state)
|
||||
|
||||
go ssh_port_forward(l, remotePort, remoteDest, hostAddress, hostSshPort, config.Username, config.Password)
|
||||
go ssh_port_forward(l, remotePort, remoteDest, hostAddress, config.Username, config.Password)
|
||||
ui.Say(fmt.Sprintf("Port forward setup. %d ---> %s:%d on %s", sshHostPort, remoteDest, remotePort, hostAddress))
|
||||
|
||||
// Provide the local port to future steps.
|
||||
|
@ -13,7 +13,6 @@ type StepSetVmHostSshAddress struct{}
|
||||
func (self *StepSetVmHostSshAddress) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
||||
c := state.Get("client").(*Connection)
|
||||
config := state.Get("config").(Config)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
ui.Say("Step: Set SSH address to VM host IP")
|
||||
@ -38,9 +37,6 @@ func (self *StepSetVmHostSshAddress) Run(ctx context.Context, state multistep.St
|
||||
state.Put("ssh_address", address)
|
||||
ui.Say(fmt.Sprintf("Set host SSH address to '%s'.", address))
|
||||
|
||||
state.Put("ssh_port", config.HostSshPort)
|
||||
ui.Say(fmt.Sprintf("Set host SSH port to %d.", config.HostSshPort))
|
||||
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ type StepTypeBootCommand struct {
|
||||
Ctx interpolate.Context
|
||||
}
|
||||
|
||||
func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("config").(Config)
|
||||
func (self *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("commonconfig").(CommonConfig)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
c := state.Get("client").(*Connection)
|
||||
httpPort := state.Get("http_port").(int)
|
||||
@ -74,8 +74,7 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
}
|
||||
locationPieces := strings.SplitAfter(location, "/")
|
||||
consoleHost := strings.TrimSuffix(locationPieces[2], "/")
|
||||
ui.Say("Connecting to VNC over XAPI...")
|
||||
log.Printf("Connecting to host: %s", consoleHost)
|
||||
ui.Say(fmt.Sprintf("Connecting to the VM console VNC over xapi via %s", consoleHost))
|
||||
conn, err := net.Dial("tcp", fmt.Sprintf("%s:443", consoleHost))
|
||||
|
||||
if err != nil {
|
||||
@ -96,7 +95,7 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
httpReq := fmt.Sprintf("CONNECT %s HTTP/1.0\r\nHost: %s\r\nCookie: session_id=%s\r\n\r\n", consoleLocation, consoleHost, c.session)
|
||||
fmt.Printf("Sending the follow http req: %v", httpReq)
|
||||
|
||||
ui.Message(fmt.Sprintf("Making HTTP request to initiate VNC connection: %s", httpReq))
|
||||
ui.Say(fmt.Sprintf("Making HTTP request to initiate VNC connection: %s", httpReq))
|
||||
_, err = io.WriteString(tlsConn, httpReq)
|
||||
|
||||
if err != nil {
|
||||
@ -115,9 +114,9 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
ui.Message(fmt.Sprintf("Received response: %s", string(buffer)))
|
||||
ui.Say(fmt.Sprintf("Received response: %s", string(buffer)))
|
||||
|
||||
vncClient, err := vnc.Client(tlsConn, &vnc.ClientConfig{Exclusive: !config.PackerDebug})
|
||||
vncClient, err := vnc.Client(tlsConn, &vnc.ClientConfig{Exclusive: true})
|
||||
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error establishing VNC session: %s", err)
|
||||
@ -143,7 +142,7 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
localIp := strings.Split(envVar, " ")[0]
|
||||
ui.Message(fmt.Sprintf("Found local IP: %s", localIp))
|
||||
|
||||
step.Ctx.Data = &bootCommandTemplateData{
|
||||
self.Ctx.Data = &bootCommandTemplateData{
|
||||
config.VMName,
|
||||
localIp,
|
||||
uint(httpPort),
|
||||
@ -152,7 +151,7 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
ui.Say("Typing boot commands over VNC...")
|
||||
for _, command := range config.BootCommand {
|
||||
|
||||
command, err := interpolate.Render(command, &step.Ctx)
|
||||
command, err := interpolate.Render(command, &self.Ctx)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error preparing boot command: %s", err)
|
||||
state.Put("error", err)
|
||||
@ -168,10 +167,12 @@ func (step *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateB
|
||||
vncSendString(vncClient, command)
|
||||
}
|
||||
|
||||
ui.Say("Finished typing.")
|
||||
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
func (step *StepTypeBootCommand) Cleanup(multistep.StateBag) {}
|
||||
func (self *StepTypeBootCommand) Cleanup(multistep.StateBag) {}
|
||||
|
||||
// Taken from qemu's builder plugin - not an exported function.
|
||||
func vncSendString(c *vnc.ClientConn, original string) {
|
||||
|
@ -53,10 +53,6 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, warns []stri
|
||||
self.config.RawInstallTimeout = "200m"
|
||||
}
|
||||
|
||||
if self.config.DiskName == "" {
|
||||
self.config.DiskName = "Packer-disk"
|
||||
}
|
||||
|
||||
if self.config.DiskSize == 0 {
|
||||
self.config.DiskSize = 40000
|
||||
}
|
||||
@ -290,14 +286,7 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
|
||||
},
|
||||
new(commonsteps.StepProvision),
|
||||
new(xscommon.StepShutdown),
|
||||
}
|
||||
|
||||
if !self.config.SkipSetTemplate {
|
||||
steps = append(steps,
|
||||
new(xscommon.StepSetVmToTemplate))
|
||||
}
|
||||
|
||||
steps = append(steps,
|
||||
new(xscommon.StepSetVmToTemplate),
|
||||
&xscommon.StepDetachVdi{
|
||||
VdiUuidKey: "iso_vdi_uuid",
|
||||
},
|
||||
@ -310,7 +299,8 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
|
||||
&xscommon.StepDetachVdi{
|
||||
VdiUuidKey: "floppy_vdi_uuid",
|
||||
},
|
||||
new(xscommon.StepExport))
|
||||
new(xscommon.StepExport),
|
||||
}
|
||||
|
||||
if self.config.ISOName == "" {
|
||||
steps = append(download_steps, steps...)
|
||||
|
@ -61,10 +61,6 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
|
||||
if b.config.KeepVM != "never" {
|
||||
t.Errorf("bad keep instance: %s", b.config.KeepVM)
|
||||
}
|
||||
|
||||
if b.config.HostSshPort != 22 {
|
||||
t.Errorf("bad ssh port: %d", b.config.HostSshPort)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_DiskSize(t *testing.T) {
|
||||
|
@ -55,10 +55,6 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
|
||||
if b.config.KeepVM != "never" {
|
||||
t.Errorf("bad keep instance: %s", b.config.KeepVM)
|
||||
}
|
||||
|
||||
if b.config.HostSshPort != 22 {
|
||||
t.Errorf("bad ssh port: %d", b.config.HostSshPort)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuilderPrepare_Format(t *testing.T) {
|
||||
|
@ -26,7 +26,7 @@ func (self *stepImportInstance) Run(ctx context.Context, state multistep.StateBa
|
||||
ui.Say("Step: Import Instance")
|
||||
|
||||
if config.SourcePath == "" {
|
||||
log.Println("Skipping importing instance - no `source_path` configured.")
|
||||
log.Println("Skipping imporing instance - no `source_path` configured.")
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ the OS, then shutting it down. The result of the XenServer builder is a
|
||||
directory containing all the files necessary to run the virtual machine
|
||||
portably.
|
||||
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
There are many configuration options available for the XenServer builder.
|
||||
@ -33,21 +34,21 @@ each category, the available options are alphabetized and described.
|
||||
"md5:{$checksum}". The type of the checksum can also be omitted and
|
||||
Packer will try to infer it based on string length. Valid values are
|
||||
"none", "{$checksum}", "md5:{$checksum}", "sha1:{$checksum}",
|
||||
"sha256:{$checksum}", "sha512:{$checksum}" or "file:{$path}". Here is
|
||||
an example list of valid checksum values:
|
||||
* `md5:090992ba9fd140077b0661cb75f7ce13`
|
||||
* `090992ba9fd140077b0661cb75f7ce13`
|
||||
* `sha1:ebfb681885ddf1234c18094a45bbeafd91467911`
|
||||
* `ebfb681885ddf1234c18094a45bbeafd91467911`
|
||||
* `sha256:ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93`
|
||||
* `ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93`
|
||||
* `file:http://releases.ubuntu.com/20.04/SHA256SUMS`
|
||||
* `file:file://./local/path/file.sum`
|
||||
* `file:./local/path/file.sum`
|
||||
* `none`
|
||||
* Although the checksum will not be verified when it is set to "none",
|
||||
this is not recommended since these files can be very large and
|
||||
corruption does happen from time to time.
|
||||
"sha256:{$checksum}", "sha512:{$checksum}" or "file:{$path}". Here is a
|
||||
list of valid checksum values:
|
||||
* md5:090992ba9fd140077b0661cb75f7ce13
|
||||
* 090992ba9fd140077b0661cb75f7ce13
|
||||
* sha1:ebfb681885ddf1234c18094a45bbeafd91467911
|
||||
* ebfb681885ddf1234c18094a45bbeafd91467911
|
||||
* sha256:ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93
|
||||
* ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93
|
||||
* file:http://releases.ubuntu.com/20.04/SHA256SUMS
|
||||
* file:file://./local/path/file.sum
|
||||
* file:./local/path/file.sum
|
||||
* none
|
||||
Although the checksum will not be verified when it is set to "none",
|
||||
this is not recommended since these files can be very large and
|
||||
corruption does happen from time to time.
|
||||
|
||||
|
||||
* `iso_url` (string) - A URL to the ISO containing the installation image.
|
||||
@ -55,10 +56,7 @@ each category, the available options are alphabetized and described.
|
||||
If this is an HTTP URL, Packer will download it and cache it between
|
||||
runs.
|
||||
|
||||
* `remote_host` (string) - The host of the Xenserver / XCP-ng pool primary. Typically, these will be specified through
|
||||
environment variables as seen in the [examples](../../../examples).
|
||||
|
||||
* `remote_ssh_port` (integer) - The port that SSH will be listening on in the Xenserver / XCP-ng pool primary. By default this is 22.
|
||||
* `remote_host` (string) - The host of the Xenserver / XCP-ng pool primary. Typically these will be specified through environment variables as seen in the [examples](../../../examples).
|
||||
|
||||
* `remote_username` (string) - The XenServer username used to access the remote machine.
|
||||
|
||||
@ -74,12 +72,11 @@ each category, the available options are alphabetized and described.
|
||||
be to type just enough to initialize the operating system installer. Special
|
||||
keys can be typed as well, and are covered in the section below on the boot
|
||||
command. If this is not specified, it is assumed the installer will start
|
||||
itself. See the [Ubuntu](../../../examples/ubuntu) and [centos](../../../examples/centos) examples to see how these
|
||||
are used to launch autoinstall and kickstart respectively.
|
||||
itself. See the [Ubuntu](../../../examples/ubuntu) and [centos](../../../examples/centos) examples to see how these are used to launch autoinstall and kickstart respectively.
|
||||
|
||||
* `boot_wait` (string) - The time to wait after booting the initial virtual
|
||||
machine before typing the `boot_command`. The value of this should be
|
||||
a duration. Examples are `5s` and `1m30s` which will cause Packer to wait
|
||||
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
|
||||
five seconds and one minute 30 seconds, respectively. If this isn't specified,
|
||||
the default is 10 seconds.
|
||||
|
||||
@ -89,9 +86,6 @@ each category, the available options are alphabetized and described.
|
||||
run `xe template-list`. Setting the correct value hints to XenServer how to
|
||||
optimize the virtual hardware to work best with that operating system.
|
||||
|
||||
* `disk_name` (string) - The name of the hard disk to create for the VM.
|
||||
By default, the name is "Packer-disk".
|
||||
|
||||
* `disk_size` (integer) - The size, in megabytes, of the hard disk to create
|
||||
for the VM. By default, this is 40000 (about 40 GB).
|
||||
|
||||
@ -114,9 +108,9 @@ each category, the available options are alphabetized and described.
|
||||
this is only useful with "keep_vm" set to "always" or "on_success".
|
||||
|
||||
* `http_directory` (string) - Path to a directory to serve using an HTTP
|
||||
server. The files in this directory will be available over HTTP which will
|
||||
server. The files in this directory will be available over HTTP that will
|
||||
be requestable from the virtual machine. This is useful for hosting
|
||||
kickstart files and so on. By default, this is `""`, which means no HTTP
|
||||
kickstart files and so on. By default this is "", which means no HTTP
|
||||
server will be started. The address and port of the HTTP server will be
|
||||
available as variables in `boot_command`. This is covered in more detail
|
||||
below.
|
||||
@ -126,7 +120,7 @@ each category, the available options are alphabetized and described.
|
||||
Because Packer often runs in parallel, Packer will choose a randomly available
|
||||
port in this range to run the HTTP server. If you want to force the HTTP
|
||||
server to be on one port, make this minimum and maximum port the same.
|
||||
By default, the values are 8000 and 9000, respectively.
|
||||
By default the values are 8000 and 9000, respectively.
|
||||
|
||||
* `install_timeout` (string) - The amount of time to wait after booting the VM
|
||||
for the installer to shut itself down.
|
||||
@ -136,55 +130,41 @@ each category, the available options are alphabetized and described.
|
||||
* `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
|
||||
Packer will try these in order. If anything goes wrong attempting to download
|
||||
or while downloading a single URL, it will move on to the next. All URLs
|
||||
must point to the same file (same checksum). By default, this is empty
|
||||
must point to the same file (same checksum). By default this is empty
|
||||
and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified.
|
||||
|
||||
* `tools_iso_name` (string) - Choose the tools iso you want to use.
|
||||
Usually "guest-tools.iso", or "xs-tools.iso". Not setting this variable causes no tools-related
|
||||
ISO to be attached.
|
||||
* `tools_iso_name` (string) - Choose the tools iso you want to use.
|
||||
Usually "guest-tools.iso", or "xs-tools.iso". Not setting this variable won't plug any tools.
|
||||
|
||||
* `keep_vm` (string) - Determine when to keep the VM and when to clean it up. This
|
||||
can be `always`, `never` or `on_success`. The default is `never`, and Packer
|
||||
can be "always", "never" or "on_success". By default this is "never", and Packer
|
||||
always deletes the VM regardless of whether the process succeeded and an artifact
|
||||
was produced. `always` asks Packer to leave the VM at the end of the process
|
||||
regardless of success. `on_success` requests that the VM only be cleaned up if an
|
||||
was produced. "always" asks Packer to leave the VM at the end of the process
|
||||
regardless of success. "on_success" requests that the VM only be cleaned up if an
|
||||
artifact was produced. The latter is useful for debugging templates that fail.
|
||||
|
||||
* `ip_getter` (string) - Defines the method by which the IP of the guest machine is
|
||||
identified. Options are: `auto`, `tools`, `http`. The default is `auto`, which will
|
||||
attempt both methods. `tools` requires that the guest tools be installed and functional
|
||||
inside the quest machine.
|
||||
|
||||
* `skip_set_template` (bool) - If you want to get the full XVA, to be able to import the VM directly
|
||||
instead of using the output template, you can set this to `true`.
|
||||
|
||||
* `network_names` (array of strings) - A list of networks identified by their name label which
|
||||
* `network_names` (array of strings) - A list of networks identified by their name label which
|
||||
will be used for the VM during creation. The first network will correspond to the VM's
|
||||
first network interface (VIF), the second will correspond to the second VIF and so on.
|
||||
|
||||
* `export_network_names` (array of strings) - A list of networks identified by their name label which
|
||||
will be attached to the export. The first network will correspond to the VM's
|
||||
first network interface (VIF), the second will correspond to the second VIF and so on.
|
||||
first network interface (VIF), the second will corespond to the second VIF and so on.
|
||||
|
||||
* `output_directory` (string) - This is the path to the directory where the
|
||||
resulting virtual machine will be created. This may be relative or absolute.
|
||||
If relative, the path is relative to the working directory when `packer`
|
||||
is executed. This directory must not exist or be empty prior to running the builder.
|
||||
By default, this is "output-BUILDNAME" where "BUILDNAME" is the name
|
||||
By default this is "output-BUILDNAME" where "BUILDNAME" is the name
|
||||
of the build.
|
||||
|
||||
* `platform_args` (object of key/value strings) - The platform args.
|
||||
Defaults to
|
||||
|
||||
```json
|
||||
Defaults to
|
||||
```javascript
|
||||
{
|
||||
"viridian": "false",
|
||||
"nx": "true",
|
||||
"pae": "true",
|
||||
"apic": "true",
|
||||
"timeoffset": "0",
|
||||
"acpi": "1",
|
||||
"cores-per-socket": "1"
|
||||
"viridian": "false",
|
||||
"nx": "true",
|
||||
"pae": "true",
|
||||
"apic": "true",
|
||||
"timeoffset": "0",
|
||||
"acpi": "1",
|
||||
"cores-per-socket": "1"
|
||||
}
|
||||
```
|
||||
|
||||
@ -193,12 +173,6 @@ each category, the available options are alphabetized and described.
|
||||
will shut down the VM gracefully through the Xen api's vm shutdown command. Unless
|
||||
you have special requirements this should typically be left to its default.
|
||||
|
||||
* `sr_name` (string) - The SR to use for storing the disk for the VM that Packer
|
||||
creates. By default, the default SR of the system will be used.
|
||||
|
||||
* `sr_iso_name` (string) - The SR to use for uploading the provided ISO.
|
||||
By default, the default SR of the system will be used.
|
||||
|
||||
* `ssh_host_port_min` and `ssh_host_port_max` (integer) - The minimum and
|
||||
maximum port to use for the SSH port on the host machine which is forwarded
|
||||
to the SSH port on the guest machine. Because Packer often runs in parallel,
|
||||
@ -206,50 +180,48 @@ each category, the available options are alphabetized and described.
|
||||
host port.
|
||||
|
||||
* `ssh_key_path` (string) - Path to a private key to use for authenticating
|
||||
with SSH. By default, this is not set (key-based auth won't be used).
|
||||
with SSH. By default this is not set (key-based auth won't be used).
|
||||
The associated public key is expected to already be configured on the
|
||||
VM being prepared by some other process (kickstart, etc.).
|
||||
|
||||
* `ssh_password` (string) - The password for `ssh_username` to use to
|
||||
authenticate with SSH. By default, this is the empty string.
|
||||
authenticate with SSH. By default this is the empty string.
|
||||
|
||||
* `ssh_port` (integer) - The port that SSH will be listening on in the guest
|
||||
virtual machine. By default, this is `22`.
|
||||
virtual machine. By default this is 22.
|
||||
|
||||
* `ssh_wait_timeout` (string) - The duration to wait for SSH to become
|
||||
available. By default, this is `20m`, or 20 minutes. **Note**: that this should
|
||||
available. By default this is "20m", or 20 minutes. Note that this should
|
||||
be quite long since the timer begins as soon as the virtual machine is booted.
|
||||
|
||||
* `tools_iso_name` (string) - The name of the XenServer Tools ISO. Defaults to
|
||||
`xs-tools.iso`.
|
||||
"xs-tools.iso".
|
||||
|
||||
* `vm_description` (string) - The description of the new virtual
|
||||
machine. By default, this is an empty string.
|
||||
machine. By default this is the empty string.
|
||||
|
||||
* `vm_name` (string) - This is the name of the new virtual
|
||||
machine, without the file extension. By default, this is
|
||||
`packer-BUILDNAME-TIMESTAMP`, where "BUILDNAME" is the name of the build.
|
||||
machine, without the file extension. By default this is
|
||||
"packer-BUILDNAME-TIMESTAMP", where "BUILDNAME" is the name of the build.
|
||||
|
||||
* `vcpus_max` (integer) - The maximum number of VCPUs for the VM.
|
||||
By default, this is `1`.
|
||||
By default this is 1.
|
||||
|
||||
* `vcpus_atstartup` (integer) - The number of startup VCPUs for the VM.
|
||||
By default, this is `1`.
|
||||
By default this is 1.
|
||||
|
||||
* `vm_memory` (integer) - The size, in megabytes, of the amount of memory to
|
||||
allocate for the VM. By default, this is `1024` (1 GB).
|
||||
allocate for the VM. By default, this is 1024 (1 GB).
|
||||
|
||||
* `vm_tags` (array of strings) - A list of tags to add to the VM
|
||||
|
||||
## Differences with other Packer builders
|
||||
|
||||
Currently, the XenServer builder has some quirks when compared with other Packer builders.
|
||||
Currently the XenServer builder has some quirks when compared with other Packer builders.
|
||||
|
||||
The builder currently only works remotely.
|
||||
|
||||
The installer is expected to shut down the VM to indicate that it has completed. This is in contrast to other builders,
|
||||
which instead detect completion by a successful SSH connection. The reason for this difference is that currently the
|
||||
builder has no way of knowing what the IP address of the VM is without starting it on the HIMN.
|
||||
The installer is expected to shut down the VM to indicate that it has completed. This is in contrast to other builders, which instead detect completion by a successful SSH connection. The reason for this difference is that currently the builder has no way of knowing what the IP address of the VM is without starting it on the HIMN.
|
||||
|
||||
## Boot Command
|
||||
|
||||
@ -262,8 +234,8 @@ As documented above, the `boot_command` is an array of strings. The
|
||||
strings are all typed in sequence. It is an array only to improve readability
|
||||
within the template.
|
||||
|
||||
The boot command is "typed" character by character over a VNC connection
|
||||
to the machine, simulating a human actually typing on the keyboard. There are
|
||||
The boot command is "typed" character for character over a VNC connection
|
||||
to the machine, simulating a human actually typing the keyboard. There are
|
||||
a set of special keys available. If these are in your boot command, they
|
||||
will be replaced by the proper key:
|
||||
|
||||
@ -294,7 +266,6 @@ will be replaced by the proper key:
|
||||
|
||||
In addition to the special keys, each command to type is treated as a
|
||||
configuration template.
|
||||
|
||||
The available variables are:
|
||||
|
||||
* `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server
|
||||
|
@ -1,7 +1,7 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
xenserver= {
|
||||
version = ">= v0.6.0"
|
||||
version = ">= v0.3.2"
|
||||
source = "github.com/ddelnano/xenserver"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
xenserver= {
|
||||
version = ">= v0.6.0"
|
||||
version = ">= v0.3.2"
|
||||
source = "github.com/ddelnano/xenserver"
|
||||
}
|
||||
}
|
||||
|
67
go.mod
67
go.mod
@ -1,30 +1,29 @@
|
||||
module github.com/xenserver/packer-builder-xenserver
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/amfranz/go-xmlrpc-client v0.0.0-20190612172737-76858463955d
|
||||
github.com/hashicorp/hcl/v2 v2.20.1
|
||||
github.com/hashicorp/packer-plugin-sdk v0.3.0
|
||||
github.com/hashicorp/hcl/v2 v2.17.0
|
||||
github.com/hashicorp/packer-plugin-sdk v0.4.0
|
||||
github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed
|
||||
github.com/terra-farm/go-xen-api-client v0.0.2
|
||||
github.com/zclconf/go-cty v1.14.4
|
||||
golang.org/x/crypto v0.24.0
|
||||
github.com/zclconf/go-cty v1.13.2
|
||||
golang.org/x/crypto v0.11.0
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.110.0 // indirect
|
||||
cloud.google.com/go/compute v1.19.1 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||
cloud.google.com/go/iam v0.13.0 // indirect
|
||||
cloud.google.com/go/storage v1.28.1 // indirect
|
||||
cloud.google.com/go v0.105.0 // indirect
|
||||
cloud.google.com/go/compute v1.12.1 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.1.1 // indirect
|
||||
cloud.google.com/go/iam v0.6.0 // indirect
|
||||
cloud.google.com/go/storage v1.27.0 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
|
||||
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/armon/go-metrics v0.3.9 // indirect
|
||||
github.com/aws/aws-sdk-go v1.40.34 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.114 // indirect
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
||||
github.com/dylanmei/iso8601 v0.1.0 // indirect
|
||||
@ -32,18 +31,18 @@ require (
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/gofrs/uuid v4.0.0+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
|
||||
github.com/hashicorp/consul/api v1.10.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter/gcs/v2 v2.1.0 // indirect
|
||||
github.com/hashicorp/go-getter/s3/v2 v2.1.0 // indirect
|
||||
github.com/hashicorp/go-getter/v2 v2.1.0 // indirect
|
||||
github.com/hashicorp/go-getter/gcs/v2 v2.2.0 // indirect
|
||||
github.com/hashicorp/go-getter/s3/v2 v2.2.0 // indirect
|
||||
github.com/hashicorp/go-getter/v2 v2.2.0 // indirect
|
||||
github.com/hashicorp/go-hclog v0.16.2 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
@ -51,7 +50,7 @@ require (
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||
github.com/hashicorp/go-version v1.3.0 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/serf v0.9.5 // indirect
|
||||
@ -60,6 +59,7 @@ require (
|
||||
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/klauspost/compress v1.11.2 // indirect
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect
|
||||
github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0 // indirect
|
||||
@ -78,27 +78,24 @@ require (
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pkg/sftp v1.13.2 // indirect
|
||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.6 // indirect
|
||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
golang.org/x/oauth2 v0.7.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/term v0.21.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/oauth2 v0.1.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.10.0 // indirect
|
||||
golang.org/x/term v0.10.0 // indirect
|
||||
golang.org/x/text v0.11.0 // indirect
|
||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/api v0.114.0 // indirect
|
||||
google.golang.org/api v0.101.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.56.3 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187
|
||||
|
18
main.go
18
main.go
@ -6,16 +6,30 @@ import (
|
||||
|
||||
"github.com/xenserver/packer-builder-xenserver/builder/xenserver/iso"
|
||||
"github.com/xenserver/packer-builder-xenserver/builder/xenserver/xva"
|
||||
"github.com/xenserver/packer-builder-xenserver/version"
|
||||
|
||||
"github.com/hashicorp/packer-plugin-sdk/plugin"
|
||||
"github.com/hashicorp/packer-plugin-sdk/version"
|
||||
)
|
||||
|
||||
var (
|
||||
// Version is the main version number that is being run at the moment.
|
||||
Version = "v0.3.0"
|
||||
|
||||
// VersionPrerelease is A pre-release marker for the Version. If this is ""
|
||||
// (empty string) then it means that it is a final release. Otherwise, this
|
||||
// is a pre-release such as "dev" (in development), "beta", "rc1", etc.
|
||||
VersionPrerelease = ""
|
||||
|
||||
// PluginVersion is used by the plugin set to allow Packer to recognize
|
||||
// what version this plugin is.
|
||||
PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
|
||||
)
|
||||
|
||||
func main() {
|
||||
pps := plugin.NewSet()
|
||||
pps.RegisterBuilder("iso", new(iso.Builder))
|
||||
pps.RegisterBuilder("xva", new(xva.Builder))
|
||||
pps.SetVersion(version.PluginVersion)
|
||||
pps.SetVersion(PluginVersion)
|
||||
err := pps.Run()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err.Error())
|
||||
|
@ -1,19 +0,0 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer-plugin-sdk/version"
|
||||
)
|
||||
|
||||
var (
|
||||
// Version is the main version number that is being run at the moment.
|
||||
Version = "v0.6.0"
|
||||
|
||||
// VersionPrerelease is A pre-release marker for the Version. If this is ""
|
||||
// (empty string) then it means that it is a final release. Otherwise, this
|
||||
// is a pre-release such as "dev" (in development), "beta", "rc1", etc.
|
||||
VersionPrerelease = "dev"
|
||||
|
||||
// PluginVersion is used by the plugin set to allow Packer to recognize
|
||||
// what version this plugin is.
|
||||
PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
|
||||
)
|
Loading…
Reference in New Issue
Block a user