it compiles :)
This commit is contained in:
parent
8aa716cd4c
commit
46c3113613
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/hashicorp/go-cleanhttp"
|
"github.com/hashicorp/go-cleanhttp"
|
||||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||||
"github.com/hashicorp/go-oracle-terraform/opc"
|
"github.com/hashicorp/go-oracle-terraform/opc"
|
||||||
|
ocommon "github.com/hashicorp/packer/builder/oracle/common"
|
||||||
"github.com/hashicorp/packer/common"
|
"github.com/hashicorp/packer/common"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"github.com/hashicorp/packer/helper/communicator"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -68,8 +69,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
&stepCreateInstance{},
|
&stepCreateInstance{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: commHost,
|
Host: ocommon.CommHost,
|
||||||
SSHConfig: SSHConfig(
|
SSHConfig: ocommon.SSHConfig(
|
||||||
b.config.Comm.SSHUsername,
|
b.config.Comm.SSHUsername,
|
||||||
b.config.Comm.SSHPassword),
|
b.config.Comm.SSHPassword),
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,6 +24,7 @@ type Config struct {
|
||||||
apiEndpointURL *url.URL
|
apiEndpointURL *url.URL
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
|
ImageName string `mapstructure:"image_name"`
|
||||||
Shape string `mapstructure:"shape"`
|
Shape string `mapstructure:"shape"`
|
||||||
ImageList string `json:"image_list"`
|
ImageList string `json:"image_list"`
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,14 @@ type stepCreateIPReservation struct{}
|
||||||
func (s *stepCreateIPReservation) Run(state multistep.StateBag) multistep.StepAction {
|
func (s *stepCreateIPReservation) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
ui.Say("Creating IP reservation...")
|
ui.Say("Creating IP reservation...")
|
||||||
client := state.Get("client", client).(*compute.ComputeClient)
|
client := state.Get("client").(*compute.ComputeClient)
|
||||||
iprClient := client.IPReservations()
|
iprClient := client.IPReservations()
|
||||||
if err != nil {
|
|
||||||
log.Printf("Error getting IPReservations Client: %s", err)
|
|
||||||
return multistep.ActionHalt
|
|
||||||
}
|
|
||||||
// TODO: add optional Name and Tags
|
// TODO: add optional Name and Tags
|
||||||
IPInput := &iprClient.CreateIPReservationInput{
|
IPInput := &compute.CreateIPReservationInput{
|
||||||
ParentPool: compute.PublicReservationPool,
|
ParentPool: compute.PublicReservationPool,
|
||||||
Permanent: true,
|
Permanent: true,
|
||||||
}
|
}
|
||||||
ipRes, err := iprClient.CreateIPReservation(createIPReservation)
|
ipRes, err := iprClient.CreateIPReservation(IPInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error creating IP Reservation: %s", err)
|
log.Printf("Error creating IP Reservation: %s", err)
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
@ -33,3 +29,7 @@ func (s *stepCreateIPReservation) Run(state multistep.StateBag) multistep.StepAc
|
||||||
log.Printf("debug: ipRes is %#v", ipRes)
|
log.Printf("debug: ipRes is %#v", ipRes)
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *stepCreateIPReservation) Cleanup(state multistep.StateBag) {
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
|
@ -11,10 +11,9 @@ import (
|
||||||
type stepCreateInstance struct{}
|
type stepCreateInstance struct{}
|
||||||
|
|
||||||
func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction {
|
func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui.Say("Creating Instance...")
|
|
||||||
|
|
||||||
// get variables from state
|
// get variables from state
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
|
ui.Say("Creating Instance...")
|
||||||
config := state.Get("config").(Config)
|
config := state.Get("config").(Config)
|
||||||
client := state.Get("client").(*compute.ComputeClient)
|
client := state.Get("client").(*compute.ComputeClient)
|
||||||
sshPublicKey := state.Get("publicKey").(string)
|
sshPublicKey := state.Get("publicKey").(string)
|
||||||
|
@ -27,7 +26,7 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
||||||
Name: config.ImageName,
|
Name: config.ImageName,
|
||||||
Shape: config.Shape,
|
Shape: config.Shape,
|
||||||
ImageList: config.ImageList,
|
ImageList: config.ImageList,
|
||||||
SSHKeys: []string{},
|
SSHKeys: []string{sshPublicKey},
|
||||||
Attributes: map[string]interface{}{},
|
Attributes: map[string]interface{}{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +39,10 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
||||||
}
|
}
|
||||||
|
|
||||||
state.Put("instance_id", instanceInfo.ID)
|
state.Put("instance_id", instanceInfo.ID)
|
||||||
|
ui.Say(fmt.Sprintf("Created instance (%s).", instanceInfo.ID))
|
||||||
ui.Say(fmt.Sprintf("Created instance (%s).", instanceID))
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stepCreateInstance) Cleanup(state multistep.StateBag) {
|
||||||
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package classic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/mitchellh/multistep"
|
|
||||||
)
|
|
||||||
|
|
||||||
type stepInstanceInfo struct{}
|
|
||||||
|
|
||||||
func (s *stepInstanceInfo) Run(state multistep.StateBag) multistep.StepAction {
|
|
||||||
ui.Say("Getting Instance Info...")
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
|
||||||
instanceID := state.Get("instance_id").(string)
|
|
||||||
endpoint_path := "/instance/%s", instanceID // GET
|
|
||||||
|
|
||||||
// https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/op-instance-%7Bname%7D-get.html
|
|
||||||
|
|
||||||
}
|
|
|
@ -19,15 +19,15 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
instanceID := state.Get("instance_id").(string)
|
instanceID := state.Get("instance_id").(string)
|
||||||
|
|
||||||
// get instances client
|
// get instances client
|
||||||
snapshotClient := client.SnapshotsClient()
|
snapshotClient := client.Snapshots()
|
||||||
|
|
||||||
// Instances Input
|
// Instances Input
|
||||||
createSnapshotInput := &CreateSnapshotInput{
|
snapshotInput := &compute.CreateSnapshotInput{
|
||||||
Instance: instanceID,
|
Instance: instanceID,
|
||||||
MachineImage: config.ImageName,
|
MachineImage: config.ImageName,
|
||||||
}
|
}
|
||||||
|
|
||||||
snap, err := snapshotClient.CreateSnapshot(input)
|
snap, err := snapshotClient.CreateSnapshot(snapshotInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("Problem creating snapshot: %s", err)
|
err = fmt.Errorf("Problem creating snapshot: %s", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
|
@ -36,4 +36,9 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Say(fmt.Sprintf("Created snapshot (%s).", snap.Name))
|
ui.Say(fmt.Sprintf("Created snapshot (%s).", snap.Name))
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stepSnapshot) Cleanup(state multistep.StateBag) {
|
||||||
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
&stepInstanceInfo{},
|
&stepInstanceInfo{},
|
||||||
&communicator.StepConnect{
|
&communicator.StepConnect{
|
||||||
Config: &b.config.Comm,
|
Config: &b.config.Comm,
|
||||||
Host: commHost,
|
Host: ocommon.CommHost,
|
||||||
SSHConfig: SSHConfig(
|
SSHConfig: ocommon.SSHConfig(
|
||||||
b.config.Comm.SSHUsername,
|
b.config.Comm.SSHUsername,
|
||||||
b.config.Comm.SSHPassword),
|
b.config.Comm.SSHPassword),
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package oci
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
packerssh "github.com/hashicorp/packer/communicator/ssh"
|
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
|
||||||
"golang.org/x/crypto/ssh"
|
|
||||||
)
|
|
||||||
|
|
||||||
func commHost(state multistep.StateBag) (string, error) {
|
|
||||||
ipAddress := state.Get("instance_ip").(string)
|
|
||||||
return ipAddress, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SSHConfig returns a function that can be used for the SSH communicator
|
|
||||||
// config for connecting to the instance created over SSH using the private key
|
|
||||||
// or password.
|
|
||||||
func SSHConfig(username, password string) func(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
|
||||||
return func(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
|
||||||
privateKey, hasKey := state.GetOk("privateKey")
|
|
||||||
if hasKey {
|
|
||||||
|
|
||||||
signer, err := ssh.ParsePrivateKey([]byte(privateKey.(string)))
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Error setting up SSH config: %s", err)
|
|
||||||
}
|
|
||||||
return &ssh.ClientConfig{
|
|
||||||
User: username,
|
|
||||||
Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)},
|
|
||||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
|
||||||
}, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ssh.ClientConfig{
|
|
||||||
User: username,
|
|
||||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
|
||||||
Auth: []ssh.AuthMethod{
|
|
||||||
ssh.Password(password),
|
|
||||||
ssh.KeyboardInteractive(packerssh.PasswordKeyboardInteractive(password)),
|
|
||||||
},
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,65 +14,67 @@ import (
|
||||||
"github.com/hashicorp/packer/packer/plugin"
|
"github.com/hashicorp/packer/packer/plugin"
|
||||||
|
|
||||||
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
||||||
|
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
||||||
amazonchrootbuilder "github.com/hashicorp/packer/builder/amazon/chroot"
|
amazonchrootbuilder "github.com/hashicorp/packer/builder/amazon/chroot"
|
||||||
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
||||||
amazonebssurrogatebuilder "github.com/hashicorp/packer/builder/amazon/ebssurrogate"
|
amazonebssurrogatebuilder "github.com/hashicorp/packer/builder/amazon/ebssurrogate"
|
||||||
amazonebsvolumebuilder "github.com/hashicorp/packer/builder/amazon/ebsvolume"
|
amazonebsvolumebuilder "github.com/hashicorp/packer/builder/amazon/ebsvolume"
|
||||||
amazoninstancebuilder "github.com/hashicorp/packer/builder/amazon/instance"
|
|
||||||
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
|
||||||
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"
|
|
||||||
hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso"
|
|
||||||
hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx"
|
|
||||||
lxcbuilder "github.com/hashicorp/packer/builder/lxc"
|
|
||||||
lxdbuilder "github.com/hashicorp/packer/builder/lxd"
|
|
||||||
nullbuilder "github.com/hashicorp/packer/builder/null"
|
|
||||||
oneandonebuilder "github.com/hashicorp/packer/builder/oneandone"
|
|
||||||
openstackbuilder "github.com/hashicorp/packer/builder/openstack"
|
|
||||||
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
|
||||||
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
|
||||||
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
|
||||||
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
|
||||||
qemubuilder "github.com/hashicorp/packer/builder/qemu"
|
|
||||||
tritonbuilder "github.com/hashicorp/packer/builder/triton"
|
|
||||||
virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso"
|
|
||||||
virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf"
|
|
||||||
vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso"
|
|
||||||
vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx"
|
|
||||||
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
|
||||||
amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import"
|
amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import"
|
||||||
|
amazoninstancebuilder "github.com/hashicorp/packer/builder/amazon/instance"
|
||||||
|
ansiblelocalprovisioner "github.com/hashicorp/packer/provisioner/ansible-local"
|
||||||
|
ansibleprovisioner "github.com/hashicorp/packer/provisioner/ansible"
|
||||||
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
||||||
atlaspostprocessor "github.com/hashicorp/packer/post-processor/atlas"
|
atlaspostprocessor "github.com/hashicorp/packer/post-processor/atlas"
|
||||||
|
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
||||||
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
||||||
|
chefclientprovisioner "github.com/hashicorp/packer/provisioner/chef-client"
|
||||||
|
chefsoloprovisioner "github.com/hashicorp/packer/provisioner/chef-solo"
|
||||||
|
cloudstackbuilder "github.com/hashicorp/packer/builder/cloudstack"
|
||||||
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
||||||
|
convergeprovisioner "github.com/hashicorp/packer/provisioner/converge"
|
||||||
|
digitaloceanbuilder "github.com/hashicorp/packer/builder/digitalocean"
|
||||||
|
dockerbuilder "github.com/hashicorp/packer/builder/docker"
|
||||||
dockerimportpostprocessor "github.com/hashicorp/packer/post-processor/docker-import"
|
dockerimportpostprocessor "github.com/hashicorp/packer/post-processor/docker-import"
|
||||||
dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push"
|
dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push"
|
||||||
dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save"
|
dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save"
|
||||||
dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag"
|
dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag"
|
||||||
googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export"
|
filebuilder "github.com/hashicorp/packer/builder/file"
|
||||||
manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest"
|
|
||||||
shelllocalpostprocessor "github.com/hashicorp/packer/post-processor/shell-local"
|
|
||||||
vagrantpostprocessor "github.com/hashicorp/packer/post-processor/vagrant"
|
|
||||||
vagrantcloudpostprocessor "github.com/hashicorp/packer/post-processor/vagrant-cloud"
|
|
||||||
vspherepostprocessor "github.com/hashicorp/packer/post-processor/vsphere"
|
|
||||||
vspheretemplatepostprocessor "github.com/hashicorp/packer/post-processor/vsphere-template"
|
|
||||||
ansibleprovisioner "github.com/hashicorp/packer/provisioner/ansible"
|
|
||||||
ansiblelocalprovisioner "github.com/hashicorp/packer/provisioner/ansible-local"
|
|
||||||
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"
|
fileprovisioner "github.com/hashicorp/packer/provisioner/file"
|
||||||
|
googlecomputebuilder "github.com/hashicorp/packer/builder/googlecompute"
|
||||||
|
googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export"
|
||||||
|
hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso"
|
||||||
|
hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx"
|
||||||
|
lxcbuilder "github.com/hashicorp/packer/builder/lxc"
|
||||||
|
lxdbuilder "github.com/hashicorp/packer/builder/lxd"
|
||||||
|
manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest"
|
||||||
|
nullbuilder "github.com/hashicorp/packer/builder/null"
|
||||||
|
oneandonebuilder "github.com/hashicorp/packer/builder/oneandone"
|
||||||
|
openstackbuilder "github.com/hashicorp/packer/builder/openstack"
|
||||||
|
oracleclassicbuilder "github.com/hashicorp/packer/builder/oracle/classic"
|
||||||
|
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
||||||
|
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
||||||
|
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
||||||
powershellprovisioner "github.com/hashicorp/packer/provisioner/powershell"
|
powershellprovisioner "github.com/hashicorp/packer/provisioner/powershell"
|
||||||
|
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
||||||
puppetmasterlessprovisioner "github.com/hashicorp/packer/provisioner/puppet-masterless"
|
puppetmasterlessprovisioner "github.com/hashicorp/packer/provisioner/puppet-masterless"
|
||||||
puppetserverprovisioner "github.com/hashicorp/packer/provisioner/puppet-server"
|
puppetserverprovisioner "github.com/hashicorp/packer/provisioner/puppet-server"
|
||||||
|
qemubuilder "github.com/hashicorp/packer/builder/qemu"
|
||||||
saltmasterlessprovisioner "github.com/hashicorp/packer/provisioner/salt-masterless"
|
saltmasterlessprovisioner "github.com/hashicorp/packer/provisioner/salt-masterless"
|
||||||
shellprovisioner "github.com/hashicorp/packer/provisioner/shell"
|
shelllocalpostprocessor "github.com/hashicorp/packer/post-processor/shell-local"
|
||||||
shelllocalprovisioner "github.com/hashicorp/packer/provisioner/shell-local"
|
shelllocalprovisioner "github.com/hashicorp/packer/provisioner/shell-local"
|
||||||
|
shellprovisioner "github.com/hashicorp/packer/provisioner/shell"
|
||||||
|
tritonbuilder "github.com/hashicorp/packer/builder/triton"
|
||||||
|
vagrantcloudpostprocessor "github.com/hashicorp/packer/post-processor/vagrant-cloud"
|
||||||
|
vagrantpostprocessor "github.com/hashicorp/packer/post-processor/vagrant"
|
||||||
|
virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso"
|
||||||
|
virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf"
|
||||||
|
vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso"
|
||||||
|
vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx"
|
||||||
|
vspherepostprocessor "github.com/hashicorp/packer/post-processor/vsphere"
|
||||||
|
vspheretemplatepostprocessor "github.com/hashicorp/packer/post-processor/vsphere-template"
|
||||||
windowsrestartprovisioner "github.com/hashicorp/packer/provisioner/windows-restart"
|
windowsrestartprovisioner "github.com/hashicorp/packer/provisioner/windows-restart"
|
||||||
windowsshellprovisioner "github.com/hashicorp/packer/provisioner/windows-shell"
|
windowsshellprovisioner "github.com/hashicorp/packer/provisioner/windows-shell"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PluginCommand struct {
|
type PluginCommand struct {
|
||||||
|
@ -80,74 +82,78 @@ type PluginCommand struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var Builders = map[string]packer.Builder{
|
var Builders = map[string]packer.Builder{
|
||||||
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
||||||
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
||||||
"amazon-ebs": new(amazonebsbuilder.Builder),
|
"amazon-ebs": new(amazonebsbuilder.Builder),
|
||||||
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
||||||
"amazon-ebsvolume": new(amazonebsvolumebuilder.Builder),
|
"amazon-ebsvolume": new(amazonebsvolumebuilder.Builder),
|
||||||
"amazon-instance": new(amazoninstancebuilder.Builder),
|
"amazon-instance": new(amazoninstancebuilder.Builder),
|
||||||
"azure-arm": new(azurearmbuilder.Builder),
|
"azure-arm": new(azurearmbuilder.Builder),
|
||||||
"cloudstack": new(cloudstackbuilder.Builder),
|
"cloudstack": new(cloudstackbuilder.Builder),
|
||||||
"digitalocean": new(digitaloceanbuilder.Builder),
|
"digitalocean": new(digitaloceanbuilder.Builder),
|
||||||
"docker": new(dockerbuilder.Builder),
|
"docker": new(dockerbuilder.Builder),
|
||||||
"file": new(filebuilder.Builder),
|
"file": new(filebuilder.Builder),
|
||||||
"googlecompute": new(googlecomputebuilder.Builder),
|
"googlecompute": new(googlecomputebuilder.Builder),
|
||||||
"hyperv-iso": new(hypervisobuilder.Builder),
|
"hyperv-iso": new(hypervisobuilder.Builder),
|
||||||
"hyperv-vmcx": new(hypervvmcxbuilder.Builder),
|
"hyperv-vmcx": new(hypervvmcxbuilder.Builder),
|
||||||
"lxc": new(lxcbuilder.Builder),
|
"lxc": new(lxcbuilder.Builder),
|
||||||
"lxd": new(lxdbuilder.Builder),
|
"lxd": new(lxdbuilder.Builder),
|
||||||
"null": new(nullbuilder.Builder),
|
"null": new(nullbuilder.Builder),
|
||||||
"oneandone": new(oneandonebuilder.Builder),
|
"oneandone": new(oneandonebuilder.Builder),
|
||||||
"openstack": new(openstackbuilder.Builder),
|
"openstack": new(openstackbuilder.Builder),
|
||||||
"oracle-oci": new(oracleocibuilder.Builder),
|
"oracle-classic": new(oracleclassicbuilder.Builder),
|
||||||
"parallels-iso": new(parallelsisobuilder.Builder),
|
"oracle-oci": new(oracleocibuilder.Builder),
|
||||||
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
"parallels-iso": new(parallelsisobuilder.Builder),
|
||||||
"profitbricks": new(profitbricksbuilder.Builder),
|
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
||||||
"qemu": new(qemubuilder.Builder),
|
"profitbricks": new(profitbricksbuilder.Builder),
|
||||||
"triton": new(tritonbuilder.Builder),
|
"qemu": new(qemubuilder.Builder),
|
||||||
"virtualbox-iso": new(virtualboxisobuilder.Builder),
|
"triton": new(tritonbuilder.Builder),
|
||||||
"virtualbox-ovf": new(virtualboxovfbuilder.Builder),
|
"virtualbox-iso": new(virtualboxisobuilder.Builder),
|
||||||
"vmware-iso": new(vmwareisobuilder.Builder),
|
"virtualbox-ovf": new(virtualboxovfbuilder.Builder),
|
||||||
"vmware-vmx": new(vmwarevmxbuilder.Builder),
|
"vmware-iso": new(vmwareisobuilder.Builder),
|
||||||
|
"vmware-vmx": new(vmwarevmxbuilder.Builder),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var Provisioners = map[string]packer.Provisioner{
|
var Provisioners = map[string]packer.Provisioner{
|
||||||
"ansible": new(ansibleprovisioner.Provisioner),
|
"ansible": new(ansibleprovisioner.Provisioner),
|
||||||
"ansible-local": new(ansiblelocalprovisioner.Provisioner),
|
"ansible-local": new(ansiblelocalprovisioner.Provisioner),
|
||||||
"chef-client": new(chefclientprovisioner.Provisioner),
|
"chef-client": new(chefclientprovisioner.Provisioner),
|
||||||
"chef-solo": new(chefsoloprovisioner.Provisioner),
|
"chef-solo": new(chefsoloprovisioner.Provisioner),
|
||||||
"converge": new(convergeprovisioner.Provisioner),
|
"converge": new(convergeprovisioner.Provisioner),
|
||||||
"file": new(fileprovisioner.Provisioner),
|
"file": new(fileprovisioner.Provisioner),
|
||||||
"powershell": new(powershellprovisioner.Provisioner),
|
"powershell": new(powershellprovisioner.Provisioner),
|
||||||
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
|
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
|
||||||
"puppet-server": new(puppetserverprovisioner.Provisioner),
|
"puppet-server": new(puppetserverprovisioner.Provisioner),
|
||||||
"salt-masterless": new(saltmasterlessprovisioner.Provisioner),
|
"salt-masterless": new(saltmasterlessprovisioner.Provisioner),
|
||||||
"shell": new(shellprovisioner.Provisioner),
|
"shell": new(shellprovisioner.Provisioner),
|
||||||
"shell-local": new(shelllocalprovisioner.Provisioner),
|
"shell-local": new(shelllocalprovisioner.Provisioner),
|
||||||
"windows-restart": new(windowsrestartprovisioner.Provisioner),
|
"windows-restart": new(windowsrestartprovisioner.Provisioner),
|
||||||
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var PostProcessors = map[string]packer.PostProcessor{
|
var PostProcessors = map[string]packer.PostProcessor{
|
||||||
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
||||||
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
||||||
"artifice": new(artificepostprocessor.PostProcessor),
|
"artifice": new(artificepostprocessor.PostProcessor),
|
||||||
"atlas": new(atlaspostprocessor.PostProcessor),
|
"atlas": new(atlaspostprocessor.PostProcessor),
|
||||||
"checksum": new(checksumpostprocessor.PostProcessor),
|
"checksum": new(checksumpostprocessor.PostProcessor),
|
||||||
"compress": new(compresspostprocessor.PostProcessor),
|
"compress": new(compresspostprocessor.PostProcessor),
|
||||||
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
||||||
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
||||||
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
||||||
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
||||||
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
|
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
|
||||||
"manifest": new(manifestpostprocessor.PostProcessor),
|
"manifest": new(manifestpostprocessor.PostProcessor),
|
||||||
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
||||||
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
||||||
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
||||||
"vsphere": new(vspherepostprocessor.PostProcessor),
|
"vsphere": new(vspherepostprocessor.PostProcessor),
|
||||||
"vsphere-template": new(vspheretemplatepostprocessor.PostProcessor),
|
"vsphere-template": new(vspheretemplatepostprocessor.PostProcessor),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
|
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
|
||||||
|
|
||||||
func (c *PluginCommand) Run(args []string) int {
|
func (c *PluginCommand) Run(args []string) int {
|
||||||
|
|
Loading…
Reference in New Issue