From 8bfa5019336cf3dd5a20d9eb126274fdbd75286c Mon Sep 17 00:00:00 2001 From: dlorenc Date: Fri, 2 Mar 2018 08:24:04 -0800 Subject: [PATCH] Update docker-machine to fix hyper-v cmdlet collision. --- Godeps/Godeps.json | 128 +++++++++--------- .../docker/machine/drivers/hyperv/hyperv.go | 52 ++++--- .../machine/drivers/hyperv/powershell.go | 2 +- .../drivers/virtualbox/virtualbox_openbsd.go | 17 +++ .../drivers/vmwarefusion/fusion_darwin.go | 40 ++++-- .../docker/machine/libmachine/host/host.go | 9 ++ .../machine/libmachine/provision/debian.go | 6 +- .../libmachine/provision/ubuntu_systemd.go | 6 +- .../libmachine/provision/ubuntu_upstart.go | 6 +- .../machine/libmachine/provision/utils.go | 10 +- .../docker/machine/libmachine/ssh/keys.go | 2 +- .../generated/openapi/zz_generated.openapi.go | 2 +- 12 files changed, 165 insertions(+), 115 deletions(-) create mode 100644 vendor/github.com/docker/machine/drivers/virtualbox/virtualbox_openbsd.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index a32032592c18..1313ddb54683 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1190,163 +1190,163 @@ }, { "ImportPath": "github.com/docker/machine/commands/mcndirs", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/drivers/errdriver", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/drivers/hyperv", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/drivers/none", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/drivers/virtualbox", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/drivers/vmwarefusion", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/auth", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/cert", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/check", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/drivers", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/drivers/plugin", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/drivers/plugin/localbinary", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/drivers/rpc", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/engine", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/host", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/log", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/mcndockerclient", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/mcnerror", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/mcnflag", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/mcnutils", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/persist", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/provision", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/provision/pkgaction", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/provision/serviceaction", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/shell", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/ssh", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/state", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/swarm", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/version", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/libmachine/versioncmp", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/machine/version", - "Comment": "docs-v0.8.2-2016-09-26-292-g49dfaa70", - "Rev": "49dfaa70fdc869c65d9f6c50c355624356ab383b" + "Comment": "docs-v0.8.2-2016-09-26-351-ga950319e", + "Rev": "a950319ea4041615add4a243e684b1baadb6436f" }, { "ImportPath": "github.com/docker/spdystream", diff --git a/vendor/github.com/docker/machine/drivers/hyperv/hyperv.go b/vendor/github.com/docker/machine/drivers/hyperv/hyperv.go index 6a46ab6d4d95..629fbbe7c9bd 100644 --- a/vendor/github.com/docker/machine/drivers/hyperv/hyperv.go +++ b/vendor/github.com/docker/machine/drivers/hyperv/hyperv.go @@ -128,7 +128,7 @@ func (d *Driver) GetURL() (string, error) { } func (d *Driver) GetState() (state.State, error) { - stdout, err := cmdOut("(", "Get-VM", d.MachineName, ").state") + stdout, err := cmdOut("(", "hyper-v\\Get-VM", d.MachineName, ").state") if err != nil { return state.None, fmt.Errorf("Failed to find the VM status") } @@ -205,7 +205,7 @@ func (d *Driver) Create() error { return err } - if err := cmd("New-VM", + if err := cmd("hyper-v\\New-VM", d.MachineName, "-Path", fmt.Sprintf("'%s'", d.ResolveStorePath(".")), "-SwitchName", quote(virtualSwitch), @@ -214,7 +214,7 @@ func (d *Driver) Create() error { } if d.CPU > 1 { - if err := cmd("Set-VMProcessor", + if err := cmd("hyper-v\\Set-VMProcessor", d.MachineName, "-Count", fmt.Sprintf("%d", d.CPU)); err != nil { return err @@ -222,7 +222,7 @@ func (d *Driver) Create() error { } if d.MacAddr != "" { - if err := cmd("Set-VMNetworkAdapter", + if err := cmd("hyper-v\\Set-VMNetworkAdapter", "-VMName", d.MachineName, "-StaticMacAddress", fmt.Sprintf("\"%s\"", d.MacAddr)); err != nil { return err @@ -230,7 +230,7 @@ func (d *Driver) Create() error { } if d.VLanID > 0 { - if err := cmd("Set-VMNetworkAdapterVlan", + if err := cmd("hyper-v\\Set-VMNetworkAdapterVlan", "-VMName", d.MachineName, "-Access", "-VlanId", fmt.Sprintf("%d", d.VLanID)); err != nil { @@ -238,13 +238,13 @@ func (d *Driver) Create() error { } } - if err := cmd("Set-VMDvdDrive", + if err := cmd("hyper-v\\Set-VMDvdDrive", "-VMName", d.MachineName, "-Path", quote(d.ResolveStorePath("boot2docker.iso"))); err != nil { return err } - if err := cmd("Add-VMHardDiskDrive", + if err := cmd("hyper-v\\Add-VMHardDiskDrive", "-VMName", d.MachineName, "-Path", quote(diskImage)); err != nil { return err @@ -255,21 +255,29 @@ func (d *Driver) Create() error { } func (d *Driver) chooseVirtualSwitch() (string, error) { - stdout, err := cmdOut("(Get-VMSwitch).Name") - if err != nil { - return "", err - } + if d.VSwitch == "" { + // Default to the first external switche and in the process avoid DockerNAT + stdout, err := cmdOut("(hyper-v\\Get-VMSwitch -SwitchType External).Name") + if err != nil { + return "", err + } - switches := parseLines(stdout) + switches := parseLines(stdout) - if d.VSwitch == "" { if len(switches) < 1 { - return "", fmt.Errorf("no vswitch found. A valid vswitch must be available for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/") + return "", fmt.Errorf("no External vswitch found. A valid vswitch must be available for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/") } return switches[0], nil } + stdout, err := cmdOut("(hyper-v\\Get-VMSwitch).Name") + if err != nil { + return "", err + } + + switches := parseLines(stdout) + found := false for _, name := range switches { if name == d.VSwitch { @@ -319,7 +327,7 @@ func (d *Driver) waitStopped() error { // Start starts an host func (d *Driver) Start() error { - if err := cmd("Start-VM", d.MachineName); err != nil { + if err := cmd("hyper-v\\Start-VM", d.MachineName); err != nil { return err } @@ -335,7 +343,7 @@ func (d *Driver) Start() error { // Stop stops an host func (d *Driver) Stop() error { - if err := cmd("Stop-VM", d.MachineName); err != nil { + if err := cmd("hyper-v\\Stop-VM", d.MachineName); err != nil { return err } @@ -361,7 +369,7 @@ func (d *Driver) Remove() error { } } - return cmd("Remove-VM", d.MachineName, "-Force") + return cmd("hyper-v\\Remove-VM", d.MachineName, "-Force") } // Restart stops and starts an host @@ -376,7 +384,7 @@ func (d *Driver) Restart() error { // Kill force stops an host func (d *Driver) Kill() error { - if err := cmd("Stop-VM", d.MachineName, "-TurnOff"); err != nil { + if err := cmd("hyper-v\\Stop-VM", d.MachineName, "-TurnOff"); err != nil { return err } @@ -398,7 +406,7 @@ func (d *Driver) GetIP() (string, error) { return "", drivers.ErrHostIsNotRunning } - stdout, err := cmdOut("((", "Get-VM", d.MachineName, ").networkadapters[0]).ipaddresses[0]") + stdout, err := cmdOut("((", "hyper-v\\Get-VM", d.MachineName, ").networkadapters[0]).ipaddresses[0]") if err != nil { return "", err } @@ -432,7 +440,7 @@ func (d *Driver) generateDiskImage() (string, error) { } log.Infof("Creating VHD") - if err := cmd("New-VHD", "-Path", quote(fixed), "-SizeBytes", fixedDiskSize, "-Fixed"); err != nil { + if err := cmd("hyper-v\\New-VHD", "-Path", quote(fixed), "-SizeBytes", fixedDiskSize, "-Fixed"); err != nil { return "", err } @@ -454,12 +462,12 @@ func (d *Driver) generateDiskImage() (string, error) { } file.Close() - if err := cmd("Convert-VHD", "-Path", quote(fixed), "-DestinationPath", quote(diskImage), "-VHDType", "Dynamic", "-DeleteSource"); err != nil { + if err := cmd("hyper-v\\Convert-VHD", "-Path", quote(fixed), "-DestinationPath", quote(diskImage), "-VHDType", "Dynamic", "-DeleteSource"); err != nil { return "", err } if isWindowsAdmin { - if err := cmd("Resize-VHD", "-Path", quote(diskImage), "-SizeBytes", toMb(d.DiskSize)); err != nil { + if err := cmd("hyper-v\\Resize-VHD", "-Path", quote(diskImage), "-SizeBytes", toMb(d.DiskSize)); err != nil { return "", err } } diff --git a/vendor/github.com/docker/machine/drivers/hyperv/powershell.go b/vendor/github.com/docker/machine/drivers/hyperv/powershell.go index 040740bb786d..d34c624965e8 100644 --- a/vendor/github.com/docker/machine/drivers/hyperv/powershell.go +++ b/vendor/github.com/docker/machine/drivers/hyperv/powershell.go @@ -55,7 +55,7 @@ func parseLines(stdout string) []string { } func hypervAvailable() error { - stdout, err := cmdOut("@(Get-Command Get-VM).ModuleName") + stdout, err := cmdOut("@(Get-Command hyper-v\\Get-VM).ModuleName") if err != nil { return err } diff --git a/vendor/github.com/docker/machine/drivers/virtualbox/virtualbox_openbsd.go b/vendor/github.com/docker/machine/drivers/virtualbox/virtualbox_openbsd.go new file mode 100644 index 000000000000..f97a5772012b --- /dev/null +++ b/vendor/github.com/docker/machine/drivers/virtualbox/virtualbox_openbsd.go @@ -0,0 +1,17 @@ +package virtualbox + +func (d *Driver) IsVTXDisabled() bool { + return false +} + +func detectVBoxManageCmd() string { + return detectVBoxManageCmdInPath() +} + +func getShareDriveAndName() (string, string) { + return "hosthome", "/home" +} + +func isHyperVInstalled() bool { + return false +} diff --git a/vendor/github.com/docker/machine/drivers/vmwarefusion/fusion_darwin.go b/vendor/github.com/docker/machine/drivers/vmwarefusion/fusion_darwin.go index d28c8b943056..74a2cc510efc 100644 --- a/vendor/github.com/docker/machine/drivers/vmwarefusion/fusion_darwin.go +++ b/vendor/github.com/docker/machine/drivers/vmwarefusion/fusion_darwin.go @@ -277,7 +277,10 @@ func (d *Driver) Create() error { } log.Infof("Starting %s...", d.MachineName) - vmrun("start", d.vmxPath(), "nogui") + _, _, err = vmrun("start", d.vmxPath(), "nogui") + if err != nil { + return err + } var ip string @@ -354,19 +357,34 @@ func (d *Driver) Create() error { } // Test if /var/lib/boot2docker exists - vmrun("-gu", B2DUser, "-gp", B2DPass, "directoryExistsInGuest", d.vmxPath(), "/var/lib/boot2docker") + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "directoryExistsInGuest", d.vmxPath(), "/var/lib/boot2docker") + if err != nil { + return err + } // Copy SSH keys bundle - vmrun("-gu", B2DUser, "-gp", B2DPass, "CopyFileFromHostToGuest", d.vmxPath(), d.ResolveStorePath("userdata.tar"), "/home/docker/userdata.tar") + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "CopyFileFromHostToGuest", d.vmxPath(), d.ResolveStorePath("userdata.tar"), "/home/docker/userdata.tar") + if err != nil { + return err + } // Expand tar file. - vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", "sudo sh -c \"tar xvf /home/docker/userdata.tar -C /home/docker > /var/log/userdata.log 2>&1 && chown -R docker:staff /home/docker\"") + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", "sudo sh -c \"tar xvf /home/docker/userdata.tar -C /home/docker > /var/log/userdata.log 2>&1 && chown -R docker:staff /home/docker\"") + if err != nil { + return err + } // copy to /var/lib/boot2docker - vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", "sudo /bin/mv /home/docker/userdata.tar /var/lib/boot2docker/userdata.tar") + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", "sudo /bin/mv /home/docker/userdata.tar /var/lib/boot2docker/userdata.tar") + if err != nil { + return err + } // Enable Shared Folders - vmrun("-gu", B2DUser, "-gp", B2DPass, "enableSharedFolders", d.vmxPath()) + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "enableSharedFolders", d.vmxPath()) + if err != nil { + return err + } var shareName, shareDir string // TODO configurable at some point switch runtime.GOOS { @@ -381,9 +399,15 @@ func (d *Driver) Create() error { return err } else if !os.IsNotExist(err) { // add shared folder, create mountpoint and mount it. - vmrun("-gu", B2DUser, "-gp", B2DPass, "addSharedFolder", d.vmxPath(), shareName, shareDir) + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "addSharedFolder", d.vmxPath(), shareName, shareDir) + if err != nil { + return err + } command := "[ ! -d " + shareDir + " ]&& sudo mkdir " + shareDir + "; sudo mount --bind /mnt/hgfs/" + shareDir + " " + shareDir + " || [ -f /usr/local/bin/vmhgfs-fuse ]&& sudo /usr/local/bin/vmhgfs-fuse -o allow_other .host:/" + shareName + " " + shareDir + " || sudo mount -t vmhgfs -o uid=$(id -u),gid=$(id -g) .host:/" + shareName + " " + shareDir - vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", command) + _, _, err = vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", command) + if err != nil { + return err + } } } return nil diff --git a/vendor/github.com/docker/machine/libmachine/host/host.go b/vendor/github.com/docker/machine/libmachine/host/host.go index 1f1e1bbfcb65..d36e187ebabc 100644 --- a/vendor/github.com/docker/machine/libmachine/host/host.go +++ b/vendor/github.com/docker/machine/libmachine/host/host.go @@ -4,6 +4,7 @@ import ( "regexp" "github.com/docker/machine/libmachine/auth" + "github.com/docker/machine/libmachine/cert" "github.com/docker/machine/libmachine/drivers" "github.com/docker/machine/libmachine/engine" "github.com/docker/machine/libmachine/log" @@ -267,6 +268,14 @@ func (h *Host) ConfigureAuth() error { return provisioner.Provision(swarm.Options{}, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions) } +func (h *Host) ConfigureAllAuth() error { + log.Info("Regenerating local certificates") + if err := cert.BootstrapCertificates(h.AuthOptions()); err != nil { + return err + } + return h.ConfigureAuth() +} + func (h *Host) Provision() error { provisioner, err := provision.DetectProvisioner(h.Driver) if err != nil { diff --git a/vendor/github.com/docker/machine/libmachine/provision/debian.go b/vendor/github.com/docker/machine/libmachine/provision/debian.go index c7cd4767e4ba..cd730ed0288b 100644 --- a/vendor/github.com/docker/machine/libmachine/provision/debian.go +++ b/vendor/github.com/docker/machine/libmachine/provision/debian.go @@ -64,11 +64,7 @@ func (provisioner *DebianProvisioner) Package(name string, action pkgaction.Pack log.Debugf("package: action=%s name=%s", action.String(), name) - if _, err := provisioner.SSHCommand(command); err != nil { - return err - } - - return nil + return waitForLock(provisioner, command) } func (provisioner *DebianProvisioner) dockerDaemonResponding() bool { diff --git a/vendor/github.com/docker/machine/libmachine/provision/ubuntu_systemd.go b/vendor/github.com/docker/machine/libmachine/provision/ubuntu_systemd.go index c4ccb8c883bb..e785a1405b4a 100644 --- a/vendor/github.com/docker/machine/libmachine/provision/ubuntu_systemd.go +++ b/vendor/github.com/docker/machine/libmachine/provision/ubuntu_systemd.go @@ -80,11 +80,7 @@ func (provisioner *UbuntuSystemdProvisioner) Package(name string, action pkgacti log.Debugf("package: action=%s name=%s", action.String(), name) - if _, err := provisioner.SSHCommand(command); err != nil { - return err - } - - return nil + return waitForLock(provisioner, command) } func (provisioner *UbuntuSystemdProvisioner) dockerDaemonResponding() bool { diff --git a/vendor/github.com/docker/machine/libmachine/provision/ubuntu_upstart.go b/vendor/github.com/docker/machine/libmachine/provision/ubuntu_upstart.go index 979986ebc2e7..b2028dc4ccd1 100644 --- a/vendor/github.com/docker/machine/libmachine/provision/ubuntu_upstart.go +++ b/vendor/github.com/docker/machine/libmachine/provision/ubuntu_upstart.go @@ -96,11 +96,7 @@ func (provisioner *UbuntuProvisioner) Package(name string, action pkgaction.Pack log.Debugf("package: action=%s name=%s", action.String(), name) - if _, err := provisioner.SSHCommand(command); err != nil { - return err - } - - return nil + return waitForLock(provisioner, command) } func (provisioner *UbuntuProvisioner) dockerDaemonResponding() bool { diff --git a/vendor/github.com/docker/machine/libmachine/provision/utils.go b/vendor/github.com/docker/machine/libmachine/provision/utils.go index fded02113015..e4d8da3d9624 100644 --- a/vendor/github.com/docker/machine/libmachine/provision/utils.go +++ b/vendor/github.com/docker/machine/libmachine/provision/utils.go @@ -296,9 +296,13 @@ func DockerClientVersion(ssh SSHCommander) (string, error) { } func waitForLockAptGetUpdate(ssh SSHCommander) error { + return waitForLock(ssh, "sudo apt-get update") +} + +func waitForLock(ssh SSHCommander, cmd string) error { var sshErr error err := mcnutils.WaitFor(func() bool { - _, sshErr = ssh.SSHCommand("sudo apt-get update") + _, sshErr = ssh.SSHCommand(cmd) if sshErr != nil { if strings.Contains(sshErr.Error(), "Could not get lock") { sshErr = nil @@ -309,10 +313,10 @@ func waitForLockAptGetUpdate(ssh SSHCommander) error { return true }) if sshErr != nil { - return fmt.Errorf("Error running apt-get update: %s", sshErr) + return fmt.Errorf("Error running %q: %s", cmd, sshErr) } if err != nil { - return fmt.Errorf("Failed to obtain apt-get update lock: %s", err) + return fmt.Errorf("Failed to obtain lock: %s", err) } return nil } diff --git a/vendor/github.com/docker/machine/libmachine/ssh/keys.go b/vendor/github.com/docker/machine/libmachine/ssh/keys.go index 24ae20ce045f..4d806419c120 100644 --- a/vendor/github.com/docker/machine/libmachine/ssh/keys.go +++ b/vendor/github.com/docker/machine/libmachine/ssh/keys.go @@ -82,7 +82,7 @@ func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) erro // windows does not support chmod switch runtime.GOOS { - case "darwin", "linux", "freebsd": + case "darwin", "freebsd", "linux", "openbsd": if err := f.Chmod(0600); err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go b/vendor/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go index 386bfb39cf54..f5d42f08c205 100644 --- a/vendor/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go +++ b/vendor/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go @@ -589,7 +589,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "namespaceSelector": { SchemaProps: spec.SchemaProps{ - Description: "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is other cluster scoped resource, it is not subjected to the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + Description: "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), }, },