2016-07-27 15:25:19 -04:00
|
|
|
//
|
|
|
|
// This file is automatically generated by scripts/generate-plugins.go -- Do not edit!
|
|
|
|
//
|
|
|
|
|
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"regexp"
|
|
|
|
"strings"
|
|
|
|
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
|
|
|
"github.com/hashicorp/packer/packer/plugin"
|
2016-07-27 15:25:19 -04:00
|
|
|
|
2017-04-17 09:04:52 -04:00
|
|
|
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
2017-04-04 16:39:01 -04:00
|
|
|
amazonchrootbuilder "github.com/hashicorp/packer/builder/amazon/chroot"
|
|
|
|
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
|
|
|
amazonebssurrogatebuilder "github.com/hashicorp/packer/builder/amazon/ebssurrogate"
|
|
|
|
amazonebsvolumebuilder "github.com/hashicorp/packer/builder/amazon/ebsvolume"
|
|
|
|
amazoninstancebuilder "github.com/hashicorp/packer/builder/amazon/instance"
|
|
|
|
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
2019-06-02 15:26:03 -04:00
|
|
|
azurechrootbuilder "github.com/hashicorp/packer/builder/azure/chroot"
|
2020-01-06 16:36:49 -05:00
|
|
|
azuredtlbuilder "github.com/hashicorp/packer/builder/azure/dtl"
|
2017-04-04 16:39:01 -04:00
|
|
|
cloudstackbuilder "github.com/hashicorp/packer/builder/cloudstack"
|
|
|
|
digitaloceanbuilder "github.com/hashicorp/packer/builder/digitalocean"
|
|
|
|
dockerbuilder "github.com/hashicorp/packer/builder/docker"
|
|
|
|
filebuilder "github.com/hashicorp/packer/builder/file"
|
|
|
|
googlecomputebuilder "github.com/hashicorp/packer/builder/googlecompute"
|
2018-10-17 06:15:47 -04:00
|
|
|
hcloudbuilder "github.com/hashicorp/packer/builder/hcloud"
|
2019-01-23 08:04:05 -05:00
|
|
|
hyperonebuilder "github.com/hashicorp/packer/builder/hyperone"
|
2017-04-04 16:39:01 -04:00
|
|
|
hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso"
|
2017-09-11 13:15:43 -04:00
|
|
|
hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx"
|
2019-08-09 03:00:23 -04:00
|
|
|
jdcloudbuilder "github.com/hashicorp/packer/builder/jdcloud"
|
2019-04-15 17:22:25 -04:00
|
|
|
linodebuilder "github.com/hashicorp/packer/builder/linode"
|
2015-12-24 17:48:40 -05:00
|
|
|
lxcbuilder "github.com/hashicorp/packer/builder/lxc"
|
2017-09-05 18:23:22 -04:00
|
|
|
lxdbuilder "github.com/hashicorp/packer/builder/lxd"
|
2018-01-11 04:57:53 -05:00
|
|
|
ncloudbuilder "github.com/hashicorp/packer/builder/ncloud"
|
2017-04-04 16:39:01 -04:00
|
|
|
nullbuilder "github.com/hashicorp/packer/builder/null"
|
|
|
|
oneandonebuilder "github.com/hashicorp/packer/builder/oneandone"
|
|
|
|
openstackbuilder "github.com/hashicorp/packer/builder/openstack"
|
2018-01-17 16:07:41 -05:00
|
|
|
oracleclassicbuilder "github.com/hashicorp/packer/builder/oracle/classic"
|
2017-09-12 11:30:39 -04:00
|
|
|
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
2019-02-11 17:43:16 -05:00
|
|
|
oscbsubuilder "github.com/hashicorp/packer/builder/osc/bsu"
|
2019-01-30 13:48:51 -05:00
|
|
|
oscbsusurrogatebuilder "github.com/hashicorp/packer/builder/osc/bsusurrogate"
|
2019-03-07 12:10:16 -05:00
|
|
|
oscbsuvolumebuilder "github.com/hashicorp/packer/builder/osc/bsuvolume"
|
2019-02-15 12:41:36 -05:00
|
|
|
oscchrootbuilder "github.com/hashicorp/packer/builder/osc/chroot"
|
2017-04-04 16:39:01 -04:00
|
|
|
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
|
|
|
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
|
|
|
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
2019-04-11 12:52:21 -04:00
|
|
|
proxmoxbuilder "github.com/hashicorp/packer/builder/proxmox"
|
2017-04-04 16:39:01 -04:00
|
|
|
qemubuilder "github.com/hashicorp/packer/builder/qemu"
|
2017-04-06 05:19:17 -04:00
|
|
|
scalewaybuilder "github.com/hashicorp/packer/builder/scaleway"
|
2019-02-04 09:16:38 -05:00
|
|
|
tencentcloudcvmbuilder "github.com/hashicorp/packer/builder/tencentcloud/cvm"
|
2017-04-04 16:39:01 -04:00
|
|
|
tritonbuilder "github.com/hashicorp/packer/builder/triton"
|
2019-06-13 03:16:49 -04:00
|
|
|
uclouduhostbuilder "github.com/hashicorp/packer/builder/ucloud/uhost"
|
2019-01-11 17:06:15 -05:00
|
|
|
vagrantbuilder "github.com/hashicorp/packer/builder/vagrant"
|
2017-04-04 16:39:01 -04:00
|
|
|
virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso"
|
|
|
|
virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf"
|
2019-02-16 08:32:22 -05:00
|
|
|
virtualboxvmbuilder "github.com/hashicorp/packer/builder/virtualbox/vm"
|
2017-04-04 16:39:01 -04:00
|
|
|
vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso"
|
|
|
|
vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx"
|
2020-01-07 19:59:31 -05:00
|
|
|
vsphereclonebuilder "github.com/hashicorp/packer/builder/vsphere/clone"
|
|
|
|
vsphereisobuilder "github.com/hashicorp/packer/builder/vsphere/iso"
|
2020-03-10 03:16:38 -04:00
|
|
|
yandexbuilder "github.com/hashicorp/packer/builder/yandex"
|
|
|
|
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
|
|
|
amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import"
|
|
|
|
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
|
|
|
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
|
|
|
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
|
|
|
digitaloceanimportpostprocessor "github.com/hashicorp/packer/post-processor/digitalocean-import"
|
|
|
|
dockerimportpostprocessor "github.com/hashicorp/packer/post-processor/docker-import"
|
|
|
|
dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push"
|
|
|
|
dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save"
|
|
|
|
dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag"
|
|
|
|
exoscaleimportpostprocessor "github.com/hashicorp/packer/post-processor/exoscale-import"
|
|
|
|
googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export"
|
|
|
|
googlecomputeimportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-import"
|
|
|
|
manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest"
|
|
|
|
shelllocalpostprocessor "github.com/hashicorp/packer/post-processor/shell-local"
|
|
|
|
ucloudimportpostprocessor "github.com/hashicorp/packer/post-processor/ucloud-import"
|
|
|
|
vagrantpostprocessor "github.com/hashicorp/packer/post-processor/vagrant"
|
|
|
|
vagrantcloudpostprocessor "github.com/hashicorp/packer/post-processor/vagrant-cloud"
|
2017-04-04 16:39:01 -04:00
|
|
|
vspherepostprocessor "github.com/hashicorp/packer/post-processor/vsphere"
|
2017-07-10 20:52:48 -04:00
|
|
|
vspheretemplatepostprocessor "github.com/hashicorp/packer/post-processor/vsphere-template"
|
2020-04-26 19:20:30 -04:00
|
|
|
yandexexportpostprocessor "github.com/hashicorp/packer/post-processor/yandex-export"
|
2020-03-10 03:16:38 -04:00
|
|
|
ansibleprovisioner "github.com/hashicorp/packer/provisioner/ansible"
|
|
|
|
ansiblelocalprovisioner "github.com/hashicorp/packer/provisioner/ansible-local"
|
|
|
|
azuredtlartifactprovisioner "github.com/hashicorp/packer/provisioner/azure-dtlartifact"
|
|
|
|
breakpointprovisioner "github.com/hashicorp/packer/provisioner/breakpoint"
|
|
|
|
chefclientprovisioner "github.com/hashicorp/packer/provisioner/chef-client"
|
|
|
|
chefsoloprovisioner "github.com/hashicorp/packer/provisioner/chef-solo"
|
|
|
|
convergeprovisioner "github.com/hashicorp/packer/provisioner/converge"
|
|
|
|
fileprovisioner "github.com/hashicorp/packer/provisioner/file"
|
|
|
|
inspecprovisioner "github.com/hashicorp/packer/provisioner/inspec"
|
|
|
|
powershellprovisioner "github.com/hashicorp/packer/provisioner/powershell"
|
|
|
|
puppetmasterlessprovisioner "github.com/hashicorp/packer/provisioner/puppet-masterless"
|
|
|
|
puppetserverprovisioner "github.com/hashicorp/packer/provisioner/puppet-server"
|
|
|
|
saltmasterlessprovisioner "github.com/hashicorp/packer/provisioner/salt-masterless"
|
|
|
|
shellprovisioner "github.com/hashicorp/packer/provisioner/shell"
|
|
|
|
shelllocalprovisioner "github.com/hashicorp/packer/provisioner/shell-local"
|
|
|
|
sleepprovisioner "github.com/hashicorp/packer/provisioner/sleep"
|
2017-04-04 16:39:01 -04:00
|
|
|
windowsrestartprovisioner "github.com/hashicorp/packer/provisioner/windows-restart"
|
|
|
|
windowsshellprovisioner "github.com/hashicorp/packer/provisioner/windows-shell"
|
2016-07-27 15:25:19 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type PluginCommand struct {
|
|
|
|
Meta
|
|
|
|
}
|
|
|
|
|
|
|
|
var Builders = map[string]packer.Builder{
|
2020-03-10 03:16:38 -04:00
|
|
|
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
|
|
|
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
|
|
|
"amazon-ebs": new(amazonebsbuilder.Builder),
|
|
|
|
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
|
|
|
"amazon-ebsvolume": new(amazonebsvolumebuilder.Builder),
|
|
|
|
"amazon-instance": new(amazoninstancebuilder.Builder),
|
|
|
|
"azure-arm": new(azurearmbuilder.Builder),
|
|
|
|
"azure-chroot": new(azurechrootbuilder.Builder),
|
|
|
|
"azure-dtl": new(azuredtlbuilder.Builder),
|
|
|
|
"cloudstack": new(cloudstackbuilder.Builder),
|
|
|
|
"digitalocean": new(digitaloceanbuilder.Builder),
|
|
|
|
"docker": new(dockerbuilder.Builder),
|
|
|
|
"file": new(filebuilder.Builder),
|
|
|
|
"googlecompute": new(googlecomputebuilder.Builder),
|
|
|
|
"hcloud": new(hcloudbuilder.Builder),
|
|
|
|
"hyperone": new(hyperonebuilder.Builder),
|
|
|
|
"hyperv-iso": new(hypervisobuilder.Builder),
|
|
|
|
"hyperv-vmcx": new(hypervvmcxbuilder.Builder),
|
|
|
|
"jdcloud": new(jdcloudbuilder.Builder),
|
|
|
|
"linode": new(linodebuilder.Builder),
|
|
|
|
"lxc": new(lxcbuilder.Builder),
|
|
|
|
"lxd": new(lxdbuilder.Builder),
|
|
|
|
"ncloud": new(ncloudbuilder.Builder),
|
|
|
|
"null": new(nullbuilder.Builder),
|
|
|
|
"oneandone": new(oneandonebuilder.Builder),
|
|
|
|
"openstack": new(openstackbuilder.Builder),
|
|
|
|
"oracle-classic": new(oracleclassicbuilder.Builder),
|
|
|
|
"oracle-oci": new(oracleocibuilder.Builder),
|
|
|
|
"osc-bsu": new(oscbsubuilder.Builder),
|
|
|
|
"osc-bsusurrogate": new(oscbsusurrogatebuilder.Builder),
|
|
|
|
"osc-bsuvolume": new(oscbsuvolumebuilder.Builder),
|
|
|
|
"osc-chroot": new(oscchrootbuilder.Builder),
|
|
|
|
"parallels-iso": new(parallelsisobuilder.Builder),
|
|
|
|
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
|
|
|
"profitbricks": new(profitbricksbuilder.Builder),
|
|
|
|
"proxmox": new(proxmoxbuilder.Builder),
|
|
|
|
"qemu": new(qemubuilder.Builder),
|
|
|
|
"scaleway": new(scalewaybuilder.Builder),
|
|
|
|
"tencentcloud-cvm": new(tencentcloudcvmbuilder.Builder),
|
|
|
|
"triton": new(tritonbuilder.Builder),
|
|
|
|
"ucloud-uhost": new(uclouduhostbuilder.Builder),
|
|
|
|
"vagrant": new(vagrantbuilder.Builder),
|
|
|
|
"virtualbox-iso": new(virtualboxisobuilder.Builder),
|
|
|
|
"virtualbox-ovf": new(virtualboxovfbuilder.Builder),
|
|
|
|
"virtualbox-vm": new(virtualboxvmbuilder.Builder),
|
|
|
|
"vmware-iso": new(vmwareisobuilder.Builder),
|
|
|
|
"vmware-vmx": new(vmwarevmxbuilder.Builder),
|
|
|
|
"vsphere-clone": new(vsphereclonebuilder.Builder),
|
|
|
|
"vsphere-iso": new(vsphereisobuilder.Builder),
|
|
|
|
"yandex": new(yandexbuilder.Builder),
|
2016-07-27 15:25:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
var Provisioners = map[string]packer.Provisioner{
|
2020-03-10 03:16:38 -04:00
|
|
|
"ansible": new(ansibleprovisioner.Provisioner),
|
|
|
|
"ansible-local": new(ansiblelocalprovisioner.Provisioner),
|
|
|
|
"azure-dtlartifact": new(azuredtlartifactprovisioner.Provisioner),
|
|
|
|
"breakpoint": new(breakpointprovisioner.Provisioner),
|
|
|
|
"chef-client": new(chefclientprovisioner.Provisioner),
|
|
|
|
"chef-solo": new(chefsoloprovisioner.Provisioner),
|
|
|
|
"converge": new(convergeprovisioner.Provisioner),
|
|
|
|
"file": new(fileprovisioner.Provisioner),
|
|
|
|
"inspec": new(inspecprovisioner.Provisioner),
|
|
|
|
"powershell": new(powershellprovisioner.Provisioner),
|
|
|
|
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
|
|
|
|
"puppet-server": new(puppetserverprovisioner.Provisioner),
|
2016-07-27 15:25:19 -04:00
|
|
|
"salt-masterless": new(saltmasterlessprovisioner.Provisioner),
|
2020-03-10 03:16:38 -04:00
|
|
|
"shell": new(shellprovisioner.Provisioner),
|
|
|
|
"shell-local": new(shelllocalprovisioner.Provisioner),
|
|
|
|
"sleep": new(sleepprovisioner.Provisioner),
|
2016-07-27 15:25:19 -04:00
|
|
|
"windows-restart": new(windowsrestartprovisioner.Provisioner),
|
2020-03-10 03:16:38 -04:00
|
|
|
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
2016-07-27 15:25:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
var PostProcessors = map[string]packer.PostProcessor{
|
2020-03-10 03:16:38 -04:00
|
|
|
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
|
|
|
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
|
|
|
"artifice": new(artificepostprocessor.PostProcessor),
|
|
|
|
"checksum": new(checksumpostprocessor.PostProcessor),
|
|
|
|
"compress": new(compresspostprocessor.PostProcessor),
|
|
|
|
"digitalocean-import": new(digitaloceanimportpostprocessor.PostProcessor),
|
|
|
|
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
|
|
|
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
|
|
|
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
|
|
|
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
|
|
|
"exoscale-import": new(exoscaleimportpostprocessor.PostProcessor),
|
|
|
|
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
|
|
|
|
"googlecompute-import": new(googlecomputeimportpostprocessor.PostProcessor),
|
|
|
|
"manifest": new(manifestpostprocessor.PostProcessor),
|
|
|
|
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
|
|
|
"ucloud-import": new(ucloudimportpostprocessor.PostProcessor),
|
|
|
|
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
|
|
|
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
|
|
|
"vsphere": new(vspherepostprocessor.PostProcessor),
|
|
|
|
"vsphere-template": new(vspheretemplatepostprocessor.PostProcessor),
|
2020-04-26 19:20:30 -04:00
|
|
|
"yandex-export": new(yandexexportpostprocessor.PostProcessor),
|
2016-07-27 15:25:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
|
|
|
|
|
|
|
|
func (c *PluginCommand) Run(args []string) int {
|
|
|
|
// This is an internal call (users should not call this directly) so we're
|
|
|
|
// not going to do much input validation. If there's a problem we'll often
|
|
|
|
// just crash. Error handling should be added to facilitate debugging.
|
|
|
|
log.Printf("args: %#v", args)
|
|
|
|
if len(args) != 1 {
|
|
|
|
c.Ui.Error("Wrong number of args")
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plugin will match something like "packer-builder-amazon-ebs"
|
|
|
|
parts := pluginRegexp.FindStringSubmatch(args[0])
|
|
|
|
if len(parts) != 3 {
|
|
|
|
c.Ui.Error(fmt.Sprintf("Error parsing plugin argument [DEBUG]: %#v", parts))
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
pluginType := parts[1] // capture group 1 (builder|post-processor|provisioner)
|
|
|
|
pluginName := parts[2] // capture group 2 (.+)
|
|
|
|
|
|
|
|
server, err := plugin.Server()
|
|
|
|
if err != nil {
|
|
|
|
c.Ui.Error(fmt.Sprintf("Error starting plugin server: %s", err))
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
switch pluginType {
|
|
|
|
case "builder":
|
|
|
|
builder, found := Builders[pluginName]
|
|
|
|
if !found {
|
|
|
|
c.Ui.Error(fmt.Sprintf("Could not load builder: %s", pluginName))
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
server.RegisterBuilder(builder)
|
|
|
|
case "provisioner":
|
|
|
|
provisioner, found := Provisioners[pluginName]
|
|
|
|
if !found {
|
|
|
|
c.Ui.Error(fmt.Sprintf("Could not load provisioner: %s", pluginName))
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
server.RegisterProvisioner(provisioner)
|
|
|
|
case "post-processor":
|
|
|
|
postProcessor, found := PostProcessors[pluginName]
|
|
|
|
if !found {
|
|
|
|
c.Ui.Error(fmt.Sprintf("Could not load post-processor: %s", pluginName))
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
server.RegisterPostProcessor(postProcessor)
|
|
|
|
}
|
|
|
|
|
|
|
|
server.Serve()
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*PluginCommand) Help() string {
|
|
|
|
helpText := `
|
|
|
|
Usage: packer plugin PLUGIN
|
|
|
|
|
|
|
|
Runs an internally-compiled version of a plugin from the packer binary.
|
|
|
|
|
|
|
|
NOTE: this is an internal command and you should not call it yourself.
|
|
|
|
`
|
|
|
|
|
|
|
|
return strings.TrimSpace(helpText)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PluginCommand) Synopsis() string {
|
|
|
|
return "internal plugin command"
|
|
|
|
}
|