From 4939ea1a3bbd259a3a2edb07e5bc551267f43d05 Mon Sep 17 00:00:00 2001 From: Tadas Medisauskas Date: Thu, 22 Dec 2016 14:59:25 +0000 Subject: [PATCH 01/58] Add support for Hyper-V admins security group --- builder/hyperv/common/driver_ps_4.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/builder/hyperv/common/driver_ps_4.go b/builder/hyperv/common/driver_ps_4.go index 030ee8f55..ae125259a 100644 --- a/builder/hyperv/common/driver_ps_4.go +++ b/builder/hyperv/common/driver_ps_4.go @@ -64,7 +64,7 @@ func (d *HypervPS4Driver) Verify() error { return err } - if err := d.verifyElevatedMode(); err != nil { + if err := d.verifyHypervPermissions(); err != nil { return err } @@ -293,16 +293,28 @@ func (d *HypervPS4Driver) verifyPSHypervModule() error { return nil } -func (d *HypervPS4Driver) verifyElevatedMode() error { +func (d *HypervPS4Driver) verifyHypervPermissions() error { - log.Printf("Enter method: %s", "verifyElevatedMode") + log.Printf("Enter method: %s", "verifyHypervPermissions") - isAdmin, _ := powershell.IsCurrentUserAnAdministrator() + hypervAdminCmd := "([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole('Hyper-V Administrators')" - if !isAdmin { - err := fmt.Errorf("%s", "Please restart your shell in elevated mode") + var ps powershell.PowerShellCmd + cmdOut, err := ps.Output(hypervAdminCmd) + if err != nil { return err } + res := strings.TrimSpace(string(cmdOut)) + + if res == "False" { + isAdmin, _ := powershell.IsCurrentUserAnAdministrator() + + if !isAdmin { + err := fmt.Errorf("%s", "Current user is not a member of 'Hyper-V Administrators' or 'Administrators' group") + return err + } + } + return nil } From 85e85ddb470bab99fec1ef09edd1c1e8329a71aa Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Sat, 21 Jan 2017 21:45:08 -0800 Subject: [PATCH 02/58] communicator/winrm: make directory upload behave more like scp changes behavior to be in-line with the docs. Resolves #3562 --- communicator/winrm/communicator.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/communicator/winrm/communicator.go b/communicator/winrm/communicator.go index c0676d01f..d3c6ee46d 100644 --- a/communicator/winrm/communicator.go +++ b/communicator/winrm/communicator.go @@ -5,6 +5,8 @@ import ( "io" "log" "os" + "path/filepath" + "strings" "sync" "github.com/masterzen/winrm" @@ -129,6 +131,9 @@ func (c *Communicator) Upload(path string, input io.Reader, _ *os.FileInfo) erro // UploadDir implementation of communicator.Communicator interface func (c *Communicator) UploadDir(dst string, src string, exclude []string) error { + if !strings.HasSuffix(src, "/") { + dst = fmt.Sprintf("%s\\%s", dst, filepath.Base(src)) + } log.Printf("Uploading dir '%s' to '%s'", src, dst) wcp, err := c.newCopyClient() if err != nil { From 4eed1b8377b83441a941612629b1031af4641ceb Mon Sep 17 00:00:00 2001 From: hfinucane Date: Wed, 22 Feb 2017 10:32:49 -0800 Subject: [PATCH 03/58] Fix example `device_setup_commands` appears to no longer be a real name. --- website/source/docs/builders/amazon-chroot.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/builders/amazon-chroot.html.md b/website/source/docs/builders/amazon-chroot.html.md index 97f575b2e..227e96b94 100644 --- a/website/source/docs/builders/amazon-chroot.html.md +++ b/website/source/docs/builders/amazon-chroot.html.md @@ -370,7 +370,7 @@ provisioning commands to install the os and bootloader. "ami_name": "packer-from-scratch {{timestamp}}" "from_scratch": true, "ami_virtualization_type": "hvm", - "device_setup_commands": [ + "pre_mount_commands": [ "parted {{.Device}} mklabel msdos mkpart primary 1M 100% set 1 boot on print", "mkfs.ext4 {{.Device}}1" ], From 52d4514d6a40350cf079561d45353c7577ff23fc Mon Sep 17 00:00:00 2001 From: huiyang Date: Fri, 3 Mar 2017 15:32:51 -0800 Subject: [PATCH 04/58] builder/parallels-iso: Configuration of disk type, plain or expanding --- builder/parallels/iso/builder.go | 10 +++++ builder/parallels/iso/builder_test.go | 41 +++++++++++++++++++ builder/parallels/iso/step_create_disk.go | 1 + command/plugin.go | 2 +- .../docs/builders/parallels-iso.html.md | 15 +++++-- 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index 8aefdf762..cfe6241a8 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -37,6 +37,7 @@ type Config struct { BootCommand []string `mapstructure:"boot_command"` DiskSize uint `mapstructure:"disk_size"` + DiskType string `mapstructure:"disk_type"` GuestOSType string `mapstructure:"guest_os_type"` HardDriveInterface string `mapstructure:"hard_drive_interface"` HostInterfaces []string `mapstructure:"host_interfaces"` @@ -87,6 +88,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.DiskSize = 40000 } + if b.config.DiskType == "" { + b.config.DiskType = "expand" + } + if b.config.HardDriveInterface == "" { b.config.HardDriveInterface = "sata" } @@ -104,6 +109,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName) } + if b.config.DiskType != "expand" && b.config.DiskType != "plain" { + errs = packer.MultiErrorAppend( + errs, errors.New("disk_type can only be expand, or plain")) + } + if b.config.HardDriveInterface != "ide" && b.config.HardDriveInterface != "sata" && b.config.HardDriveInterface != "scsi" { errs = packer.MultiErrorAppend( errs, errors.New("hard_drive_interface can only be ide, sata, or scsi")) diff --git a/builder/parallels/iso/builder_test.go b/builder/parallels/iso/builder_test.go index 7be21bd59..668ec1c07 100644 --- a/builder/parallels/iso/builder_test.go +++ b/builder/parallels/iso/builder_test.go @@ -130,6 +130,47 @@ func TestBuilderPrepare_DiskSize(t *testing.T) { } } +func TestBuilderPrepare_DiskType(t *testing.T) { + var b Builder + config := testConfig() + + // Test a default boot_wait + delete(config, "disk_type") + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("err: %s", err) + } + + if b.config.DiskType != "expand" { + t.Fatalf("bad: %s", b.config.DiskType) + } + + // Test with a bad + config["disk_type"] = "fake" + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err == nil { + t.Fatal("should have error") + } + + // Test with a good + config["disk_type"] = "plain" + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } +} + func TestBuilderPrepare_HardDriveInterface(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/parallels/iso/step_create_disk.go b/builder/parallels/iso/step_create_disk.go index e8f458f82..1737dcf6a 100644 --- a/builder/parallels/iso/step_create_disk.go +++ b/builder/parallels/iso/step_create_disk.go @@ -22,6 +22,7 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction { command := []string{ "set", vmName, "--device-add", "hdd", + "--type", config.DiskType, "--size", strconv.FormatUint(uint64(config.DiskSize), 10), "--iface", config.HardDriveInterface, } diff --git a/command/plugin.go b/command/plugin.go index 8f09f0a74..bb76efbfe 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -75,8 +75,8 @@ type PluginCommand struct { var Builders = map[string]packer.Builder{ "amazon-chroot": new(amazonchrootbuilder.Builder), "amazon-ebs": new(amazonebsbuilder.Builder), - "amazon-ebsvolume": new(amazonebsvolumebuilder.Builder), "amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder), + "amazon-ebsvolume": new(amazonebsvolumebuilder.Builder), "amazon-instance": new(amazoninstancebuilder.Builder), "azure-arm": new(azurearmbuilder.Builder), "cloudstack": new(cloudstackbuilder.Builder), diff --git a/website/source/docs/builders/parallels-iso.html.md b/website/source/docs/builders/parallels-iso.html.md index 09bf750d7..4f3d73c4f 100644 --- a/website/source/docs/builders/parallels-iso.html.md +++ b/website/source/docs/builders/parallels-iso.html.md @@ -105,6 +105,13 @@ builder. - `disk_size` (integer) - The size, in megabytes, of the hard disk to create for the VM. By default, this is 40000 (about 40 GB). +- `disk_type` (string) - The type for image file based virtual disk drives, + defaults to `expand`. Valid options are `expand` (expanding disk) that the + image file is small initially and grows in size as you add data to it, and + `plain` (plain disk) that the image file has a fixed size from the moment it + is created (i.e the space is allocated for the drive fully). Plain disks + perform faster than expanding disks. + - `floppy_files` (array of strings) - A list of files to place onto a floppy disk that is attached when the VM is booted. This is most useful for unattended Windows installs, which look for an `Autounattend.xml` file on @@ -273,7 +280,7 @@ proper key: - `` `` - Simulates pressing and holding the alt key. -- `` `` - Simulates pressing and holding the ctrl key. +- `` `` - Simulates pressing and holding the ctrl key. - `` `` - Simulates pressing and holding the shift key. @@ -287,9 +294,9 @@ proper key: sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. -When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, -otherwise they will be held down until the machine reboots. Use lowercase -characters as well inside modifiers. +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, +otherwise they will be held down until the machine reboots. Use lowercase +characters as well inside modifiers. For example: to simulate ctrl+c use `c`. From 37feec41d9fe625a8c19a76d8f1d29063b0875b6 Mon Sep 17 00:00:00 2001 From: Kerim Satirli Date: Mon, 6 Mar 2017 09:44:07 +0100 Subject: [PATCH 05/58] fixes broken link to EBS surrogate page --- website/source/docs/builders/amazon.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/builders/amazon.html.md b/website/source/docs/builders/amazon.html.md index 50c39b901..82aab89af 100644 --- a/website/source/docs/builders/amazon.html.md +++ b/website/source/docs/builders/amazon.html.md @@ -28,7 +28,7 @@ Packer supports the following builders at the moment: newcomers**. However, it is also the fastest way to build an EBS-backed AMI since no new EC2 instance needs to be launched. -- [amazon-ebssurrogate](/docs/builders/amazone-ebssurrogate.html) - Create EBS +- [amazon-ebssurrogate](/docs/builders/amazon-ebssurrogate.html) - Create EBS -backed AMIs from scratch. Works similarly to the `chroot` builder but does not require running in AWS. This is an **advanced builder and should not be used by newcomers**. From ded2693ee7f74b197655027c211b47d99c08b480 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Sun, 5 Mar 2017 16:55:48 +0300 Subject: [PATCH 06/58] Add floppy size limitation notice. Should help people dealing with #4570 and #3328 because packer copies `floppy_files` to floppy without any error even if they exceed 1.44 MB limit. `floppy_dirs`throws error about FAT size limit exceeded but without mentioning that real issue is the floppy size limit: ``` Build 'qemu' errored: Error adding path virtio_iso to floppy: FAT FULL ``` --- website/source/docs/builders/qemu.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/source/docs/builders/qemu.html.md b/website/source/docs/builders/qemu.html.md index 381e8872f..28fe8400e 100644 --- a/website/source/docs/builders/qemu.html.md +++ b/website/source/docs/builders/qemu.html.md @@ -172,13 +172,13 @@ Linux server and have not enabled X11 forwarding (`ssh -X`). is attached as the first floppy device. Currently, no support exists for creating sub-directories on the floppy. Wildcard characters (\*, ?, and \[\]) are allowed. Directory names are also allowed, which will add all - the files found in the directory to the floppy. + the files found in the directory to the floppy. The summary size of the listed files must not exceed 1.44 MB. The supported ways to move large files into the OS are using `http_directory` or [the file provisioner]( https://www.packer.io/docs/provisioners/file.html). - `floppy_dirs` (array of strings) - A list of directories to place onto the floppy disk recursively. This is similar to the `floppy_files` option except that the directory structure is preserved. This is useful for when your floppy disk includes drivers or if you just want to organize it's - contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. + contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. The maximum summary size of all files in the listed directories are the same as in `floppy_files`. - `format` (string) - Either "qcow2" or "raw", this specifies the output format of the virtual machine image. This defaults to `qcow2`. From 5ac53907c28114185435eb1ed188c9511ddfda94 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 6 Mar 2017 10:25:32 -0800 Subject: [PATCH 07/58] docs/qemu: reformat --- website/source/docs/builders/qemu.html.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/website/source/docs/builders/qemu.html.md b/website/source/docs/builders/qemu.html.md index 28fe8400e..813ef0a6c 100644 --- a/website/source/docs/builders/qemu.html.md +++ b/website/source/docs/builders/qemu.html.md @@ -172,13 +172,18 @@ Linux server and have not enabled X11 forwarding (`ssh -X`). is attached as the first floppy device. Currently, no support exists for creating sub-directories on the floppy. Wildcard characters (\*, ?, and \[\]) are allowed. Directory names are also allowed, which will add all - the files found in the directory to the floppy. The summary size of the listed files must not exceed 1.44 MB. The supported ways to move large files into the OS are using `http_directory` or [the file provisioner]( https://www.packer.io/docs/provisioners/file.html). + the files found in the directory to the floppy. The summary size of the + listed files must not exceed 1.44 MB. The supported ways to move large + files into the OS are using `http_directory` or [the file provisioner]( + https://www.packer.io/docs/provisioners/file.html). - `floppy_dirs` (array of strings) - A list of directories to place onto the floppy disk recursively. This is similar to the `floppy_files` option except that the directory structure is preserved. This is useful for when your floppy disk includes drivers or if you just want to organize it's - contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. The maximum summary size of all files in the listed directories are the same as in `floppy_files`. + contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. + The maximum summary size of all files in the listed directories are the + same as in `floppy_files`. - `format` (string) - Either "qcow2" or "raw", this specifies the output format of the virtual machine image. This defaults to `qcow2`. @@ -417,7 +422,10 @@ command, they will be replaced by the proper key: - ` ` - Add user defined time.Duration pause before sending any additional keys. For example `` or `` -When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `c`. +When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, +otherwise they will be held down until the machine reboots. Use lowercase +characters as well inside modifiers. For example: to simulate ctrl+c use +`c`. In addition to the special keys, each command to type is treated as a [configuration template](/docs/templates/configuration-templates.html). The From 57d2fede3f880a07d0c1fa8b1252869eb687d644 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 6 Mar 2017 13:08:34 -0800 Subject: [PATCH 08/58] the digitalocean ubuntu user is root --- website/source/docs/builders/digitalocean.html.md | 7 ++++--- .../source/intro/getting-started/parallel-builds.html.md | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/website/source/docs/builders/digitalocean.html.md b/website/source/docs/builders/digitalocean.html.md index b63bb103d..c8ce84f39 100644 --- a/website/source/docs/builders/digitalocean.html.md +++ b/website/source/docs/builders/digitalocean.html.md @@ -88,8 +88,9 @@ access tokens: { "type": "digitalocean", "api_token": "YOUR API KEY", - "image": "ubuntu-12-04-x64", - "region": "nyc2", - "size": "512mb" + "image": "ubuntu-14-04-x64", + "region": "nyc3", + "size": "512mb", + "ssh_username": "root" } ``` diff --git a/website/source/intro/getting-started/parallel-builds.html.md b/website/source/intro/getting-started/parallel-builds.html.md index 0125cf9df..c1e5703e8 100644 --- a/website/source/intro/getting-started/parallel-builds.html.md +++ b/website/source/intro/getting-started/parallel-builds.html.md @@ -68,7 +68,7 @@ array. "image": "ubuntu-14-04-x64", "region": "nyc3", "size": "512mb", - "ssh_username": "ubuntu" + "ssh_username": "root" } ``` @@ -106,7 +106,7 @@ The entire template should now look like this: "image": "ubuntu-14-04-x64", "region": "nyc3", "size": "512mb", - "ssh_username": "ubuntu" + "ssh_username": "root" }], "provisioners": [{ "type": "shell", From b3c6ef9f6bff04dc568f4c6efef6613eaf9939e9 Mon Sep 17 00:00:00 2001 From: huiyang Date: Tue, 7 Mar 2017 18:22:23 -0800 Subject: [PATCH 09/58] Skip disk compaction for plain disks --- builder/parallels/iso/builder.go | 6 ++++++ builder/parallels/iso/builder_test.go | 18 ++++++++++++++++-- .../source/docs/builders/parallels-iso.html.md | 10 ++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index cfe6241a8..e53509c50 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -114,6 +114,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, errors.New("disk_type can only be expand, or plain")) } + if b.config.DiskType == "plain" && !b.config.SkipCompaction { + b.config.SkipCompaction = true + warnings = append(warnings, + "'skip_compaction' is enforced to be true for plain disks.") + } + if b.config.HardDriveInterface != "ide" && b.config.HardDriveInterface != "sata" && b.config.HardDriveInterface != "scsi" { errs = packer.MultiErrorAppend( errs, errors.New("hard_drive_interface can only be ide, sata, or scsi")) diff --git a/builder/parallels/iso/builder_test.go b/builder/parallels/iso/builder_test.go index 668ec1c07..b43da12f9 100644 --- a/builder/parallels/iso/builder_test.go +++ b/builder/parallels/iso/builder_test.go @@ -134,7 +134,7 @@ func TestBuilderPrepare_DiskType(t *testing.T) { var b Builder config := testConfig() - // Test a default boot_wait + // Test a default disk_type delete(config, "disk_type") warns, err := b.Prepare(config) if len(warns) > 0 { @@ -159,8 +159,21 @@ func TestBuilderPrepare_DiskType(t *testing.T) { t.Fatal("should have error") } - // Test with a good + // Test with plain disk with wrong setting for compaction config["disk_type"] = "plain" + config["skip_compaction"] = false + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) == 0 { + t.Fatalf("should have warning") + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } + + // Test with plain disk with correct setting for compaction + config["disk_type"] = "plain" + config["skip_compaction"] = true b = Builder{} warns, err = b.Prepare(config) if len(warns) > 0 { @@ -169,6 +182,7 @@ func TestBuilderPrepare_DiskType(t *testing.T) { if err != nil { t.Fatalf("should not have error: %s", err) } + } func TestBuilderPrepare_HardDriveInterface(t *testing.T) { diff --git a/website/source/docs/builders/parallels-iso.html.md b/website/source/docs/builders/parallels-iso.html.md index 4f3d73c4f..fa221b7ed 100644 --- a/website/source/docs/builders/parallels-iso.html.md +++ b/website/source/docs/builders/parallels-iso.html.md @@ -110,7 +110,8 @@ builder. image file is small initially and grows in size as you add data to it, and `plain` (plain disk) that the image file has a fixed size from the moment it is created (i.e the space is allocated for the drive fully). Plain disks - perform faster than expanding disks. + perform faster than expanding disks. `skip_compaction` will be set to true + automatically for plain disks. - `floppy_files` (array of strings) - A list of files to place onto a floppy disk that is attached when the VM is booted. This is most useful for @@ -225,9 +226,10 @@ builder. "5m", or five minutes. - `skip_compaction` (boolean) - Virtual disk image is compacted at the end of - the build process using `prl_disk_tool` utility. In certain rare cases, this - might corrupt the resulting disk image. If you find this to be the case, - you can disable compaction using this configuration value. + the build process using `prl_disk_tool` utility (except for the case that + `disk_type` is set to `plain`). In certain rare cases, this might corrupt + the resulting disk image. If you find this to be the case, you can disable + compaction using this configuration value. - `vm_name` (string) - This is the name of the PVM directory for the new virtual machine, without the file extension. By default this is From 2300b102b7f87c73c62f4ac0c90e6f5fe1130dea Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Wed, 8 Mar 2017 18:12:37 +0100 Subject: [PATCH 10/58] amazon: Step Region Copy crashing on device mapping Closes #4635 --- builder/amazon/common/step_ami_region_copy.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index 1f4e65738..96496fe47 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -2,7 +2,6 @@ package common import ( "fmt" - "sync" "github.com/aws/aws-sdk-go/aws" @@ -128,7 +127,7 @@ func amiRegionCopy(state multistep.StateBag, config *AccessConfig, name string, } for _, blockDeviceMapping := range describeImageResp.Images[0].BlockDeviceMappings { - if blockDeviceMapping.Ebs != nil { + if blockDeviceMapping.Ebs != nil && blockDeviceMapping.Ebs.SnapshotId != nil { snapshotIds = append(snapshotIds, *blockDeviceMapping.Ebs.SnapshotId) } } From eac5b6392d5382c46ad494b184a0ac5944abc3b4 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Wed, 8 Mar 2017 19:44:07 +0100 Subject: [PATCH 11/58] googlecompute: Correct values for on_host_maintenance If preemptible is true then on_host_maintenance must be TERMINATE. Also corrected order in docs. Closes #4620 --- builder/googlecompute/config.go | 19 ++++++++++++------- .../docs/builders/googlecompute.html.md | 11 +++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index 78141bed4..330ea5900 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -93,15 +93,20 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { if c.ImageDescription == "" { c.ImageDescription = "Created by Packer" } - // Setting OnHostMaintenance Correct Defaults - // "MIGRATE" : Possible if Preemptible is false - // "TERMINATE": Posssible if Preemptible is true - if c.OnHostMaintenance == "" && c.Preemptible { - c.OnHostMaintenance = "MIGRATE" - } - if c.OnHostMaintenance == "" && !c.Preemptible { + if c.OnHostMaintenance == "MIGRATE" && c.Preemptible { + errs = packer.MultiErrorAppend(errs, + errors.New("on_host_maintenance must be TERMINATE when using preemptible instances.")) + } + // Setting OnHostMaintenance Correct Defaults + // "MIGRATE" : Possible and default if Preemptible is false + // "TERMINATE": Required if Preemptible is true + if c.Preemptible { c.OnHostMaintenance = "TERMINATE" + } else { + if c.OnHostMaintenance == "" { + c.OnHostMaintenance = "MIGRATE" + } } // Make sure user sets a valid value for on_host_maintenance option diff --git a/website/source/docs/builders/googlecompute.html.md b/website/source/docs/builders/googlecompute.html.md index 97dac1a70..9f41bef9b 100644 --- a/website/source/docs/builders/googlecompute.html.md +++ b/website/source/docs/builders/googlecompute.html.md @@ -177,15 +177,14 @@ builder. - `omit_external_ip` (boolean) - If true, the instance will not have an external IP. `use_internal_ip` must be true if this property is true. -- `preemptible` (boolean) - If true, launch a preembtible instance. - - `on_host_maintenance` (string) - Sets Host Maintenance Option. Valid choices are `MIGRATE` and `TERMINATE`. Please see [GCE Instance Scheduling Options](https://cloud.google.com/compute/docs/instances/setting-instance-scheduling-options), - as not all machine_types support `MIGRATE` (i.e. machines with GPUs). The - default value depends on preemtability. - - when preemptible == true, defaults to `TERMINATE` - - when preemptible == false, defaults to `MIGRATE` + as not all machine_types support `MIGRATE` (i.e. machines with GPUs). + If preemptible is true this can only be `TERMINATE`. If preemptible + is false, it defaults to `MIGRATE` + +- `preemptible` (boolean) - If true, launch a preembtible instance. - `region` (string) - The region in which to launch the instance. Defaults to to the region hosting the specified `zone`. From 2f50d7bea5761adc5f7468a343625a3e8b01bc35 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Wed, 8 Mar 2017 19:47:08 +0100 Subject: [PATCH 12/58] googlecompute: Added missing disk_name option to docs. --- website/source/docs/builders/googlecompute.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/source/docs/builders/googlecompute.html.md b/website/source/docs/builders/googlecompute.html.md index 9f41bef9b..6b3924874 100644 --- a/website/source/docs/builders/googlecompute.html.md +++ b/website/source/docs/builders/googlecompute.html.md @@ -145,6 +145,9 @@ builder. - `address` (string) - The name of a pre-allocated static external IP address. Note, must be the name and not the actual IP address. +- `disk_name` (string) - The name of the disk, if unset the instance name will be + used. + - `disk_size` (integer) - The size of the disk in GB. This defaults to `10`, which is 10GB. From 24264ef0dc85df3e5b6cb438fbf5e267a75ca95e Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 8 Mar 2017 11:22:54 -0800 Subject: [PATCH 13/58] Update middleman-hashicorp --- website/Gemfile | 5 +--- website/Gemfile.lock | 62 +++++++++++++++++++++----------------------- website/Makefile | 32 +++++++++-------------- website/README.md | 34 ++++++++---------------- website/Vagrantfile | 27 ------------------- website/packer.json | 18 +++++-------- 6 files changed, 59 insertions(+), 119 deletions(-) delete mode 100644 website/Vagrantfile diff --git a/website/Gemfile b/website/Gemfile index 76e7fafef..f9b604b3c 100644 --- a/website/Gemfile +++ b/website/Gemfile @@ -1,6 +1,3 @@ source "https://rubygems.org" -gem "middleman-hashicorp", - git: "https://github.com/hashicorp/middleman-hashicorp.git" - -gem "htmlbeautifier" +gem "middleman-hashicorp", "0.3.12" diff --git a/website/Gemfile.lock b/website/Gemfile.lock index b5fe9cc0f..ff3b5b7b0 100644 --- a/website/Gemfile.lock +++ b/website/Gemfile.lock @@ -1,30 +1,17 @@ -GIT - remote: https://github.com/hashicorp/middleman-hashicorp.git - revision: 462267352881543bbc5d2606f1ca17a6165ac8ec - specs: - middleman-hashicorp (0.3.5) - bootstrap-sass (~> 3.3) - builder (~> 3.2) - middleman (~> 3.4) - middleman-livereload (~> 3.4) - middleman-syntax (~> 3.0) - redcarpet (~> 3.3) - GEM remote: https://rubygems.org/ specs: - activesupport (4.2.7.1) + activesupport (4.2.8) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - autoprefixer-rails (6.5.3) + autoprefixer-rails (6.7.6) execjs bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) - builder (3.2.2) + builder (3.2.3) capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -35,7 +22,7 @@ GEM coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) compass (1.0.3) chunky_png (~> 1.2) compass-core (~> 1.0.2) @@ -52,19 +39,18 @@ GEM eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) erubis (2.7.0) - eventmachine (1.2.0.1) + eventmachine (1.2.3) execjs (2.7.0) - ffi (1.9.14) + ffi (1.9.18) haml (4.0.7) tilt hike (1.2.3) hooks (0.4.1) uber (~> 0.0.14) - htmlbeautifier (1.2.0) http_parser.rb (0.6.0) i18n (0.7.0) - json (1.8.3) - kramdown (1.12.0) + json (2.0.3) + kramdown (1.13.2) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -91,6 +77,14 @@ GEM rack (>= 1.4.5, < 2.0) thor (>= 0.15.2, < 2.0) tilt (~> 1.4.1, < 2.0) + middleman-hashicorp (0.3.12) + bootstrap-sass (~> 3.3) + builder (~> 3.2) + middleman (~> 3.4) + middleman-livereload (~> 3.4) + middleman-syntax (~> 3.0) + redcarpet (~> 3.3) + turbolinks (~> 5.0) middleman-livereload (3.4.6) em-websocket (~> 0.5.1) middleman-core (>= 3.3) @@ -107,9 +101,9 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) - minitest (5.9.1) + minitest (5.10.1) multi_json (1.12.1) - nokogiri (1.6.8.1) + nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) padrino-helpers (0.12.8.1) i18n (~> 0.6, >= 0.6.7) @@ -123,11 +117,11 @@ GEM rack-test (0.6.3) rack (>= 1.0) rb-fsevent (0.9.8) - rb-inotify (0.9.7) + rb-inotify (0.9.8) ffi (>= 0.5.0) - redcarpet (3.3.4) - rouge (2.0.6) - sass (3.4.22) + redcarpet (3.4.0) + rouge (2.0.7) + sass (3.4.23) sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) @@ -138,9 +132,12 @@ GEM sprockets-sass (1.3.1) sprockets (~> 2.0) tilt (~> 1.1) - thor (0.19.1) - thread_safe (0.3.5) + thor (0.19.4) + thread_safe (0.3.6) tilt (1.4.1) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) tzinfo (1.2.2) thread_safe (~> 0.1) uber (0.0.15) @@ -154,8 +151,7 @@ PLATFORMS ruby DEPENDENCIES - htmlbeautifier - middleman-hashicorp! + middleman-hashicorp (= 0.3.12) BUNDLED WITH - 1.13.6 + 1.14.6 diff --git a/website/Makefile b/website/Makefile index bdb362513..91a898c3a 100644 --- a/website/Makefile +++ b/website/Makefile @@ -1,22 +1,14 @@ -all: build +VERSION?="0.3.12" -init: - bundle +website: + @echo "==> Starting website in Docker..." + @docker run \ + --interactive \ + --rm \ + --tty \ + --publish "4567:4567" \ + --publish "35729:35729" \ + --volume "$(shell pwd):/website" \ + hashicorp/middleman-hashicorp:${VERSION} -docker-dev: - docker run -it --expose 4567 -p 4567:4567 -v "$(PWD)":/usr/src/app -w /usr/src/app ruby:2.3.1 \ - bash -c "apt-get update && apt-get -qy install curl git libgmp3-dev nodejs && \ - gem install bundler && bundle install && make dev" - -dev: init - PACKER_DISABLE_DOWNLOAD_FETCH=true PACKER_VERSION=1.0 bundle exec middleman server - -build: init - PACKER_DISABLE_DOWNLOAD_FETCH=true PACKER_VERSION=1.0 bundle exec middleman build - -format: - bundle exec htmlbeautifier -t 2 source/*.erb - bundle exec htmlbeautifier -t 2 source/layouts/*.erb - @pandoc -v > /dev/null || echo "pandoc must be installed in order to format markdown content" - pandoc -v > /dev/null && find . -iname "*.html.md" | xargs -I{} bash -c "pandoc -r markdown -w markdown --tab-stop=4 --atx-headers -s --columns=80 {} > {}.new"\; || true - pandoc -v > /dev/null && find . -iname "*.html.md" | xargs -I{} bash -c "mv {}.new {}"\; || true +.PHONY: website diff --git a/website/README.md b/website/README.md index e86ccc60e..64085fffc 100644 --- a/website/README.md +++ b/website/README.md @@ -1,33 +1,21 @@ -# Packer Website +# Vault Website -This subdirectory contains the entire source for the [Packer website](http://www.packer.io). -This is a [Middleman](http://middlemanapp.com) project, which builds a static -site from these source files. +This subdirectory contains the entire source for the [Packer Website][packer]. +This is a [Middleman][middleman] project, which builds a static site from these +source files. ## Contributions Welcome! If you find a typo or you feel like you can improve the HTML, CSS, or -JavaScript, we welcome contributions. Feel free to open issues or pull -requests like any normal GitHub project, and we'll merge it in. +JavaScript, we welcome contributions. Feel free to open issues or pull requests +like any normal GitHub project, and we'll merge it in. ## Running the Site Locally -Running the site locally is simple. Clone this repo and run the following -commands: +Running the site locally is simple. Clone this repo and run `make website`. -``` -make dev -``` +Then open up `http://localhost:4567`. Note that some URLs you may need to append +".html" to make them work (in the navigation). -Then open up `localhost:4567`. Note that some URLs you may need to append -".html" to make them work (in the navigation and such). - -## Keeping Tidy - -To keep the source code nicely formatted, there is a `make format` target. This -runs `htmlbeautify` and `pandoc` to reformat the source code so it's nicely formatted. - - make format - -Note that you will need to install pandoc yourself. `make format` will skip it -if you don't have it installed. \ No newline at end of file +[middleman]: https://www.middlemanapp.com +[vault]: https://www.packer.io diff --git a/website/Vagrantfile b/website/Vagrantfile deleted file mode 100644 index bd044c27f..000000000 --- a/website/Vagrantfile +++ /dev/null @@ -1,27 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -$script = <