This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
Generic driver for provisioning CentOS machine does not work: "operation not supported by device" #1731
Open
Description
openedon Aug 19, 2015
I am trying to call docker-machine through os/exec and found that docker-machine is using -t option for external client and OutputWithPty for NativeClient. Both require a pty to be present (as I understand) and os/exec doesn't come with a pty. See the test program and output below. I also tried using github.com/kr/pty and assign a tty, but couldn't get it work. Any comments are welcome.
package main
import (
"os/exec"
"fmt"
)
func RunCmd(cmd string, args []string) (string, error) {
var (
cmdOut []byte
err error
)
fmt.Println(cmd, args)
if cmdOut, err = exec.Command(cmd, args...).CombinedOutput(); err != nil {
return string(cmdOut), err
}
output := string(cmdOut)
fmt.Print(output)
return output, nil
}
func main() {
cmdOut, err := RunCmd("docker-machine",
[]string{"-D", "create", "-d", "generic", "--generic-ip-address", "10.1.10.12", "bot1"})
fmt.Println(cmdOut)
fmt.Println(err)
}
Pradeeps-MacBook-Air:test ppadala$ ./test
docker-machine [-D create -d generic --generic-ip-address 10.1.10.12 bot1]
Error creating machine: Machine bot1 already exists
You will want to check the provider to make sure the machine and associated resources were properly removed.
exit status 1
Pradeeps-MacBook-Air:test ppadala$ docker-machine rm bot1
Successfully removed bot1
Pradeeps-MacBook-Air:test ppadala$ ./test
docker-machine [-D create -d generic --generic-ip-address 10.1.10.12 bot1]
^CPradeeps-MacBook-Air:test ppadala$ docker-machine rm bot1
Successfully removed bot1
Pradeeps-MacBook-Air:test ppadala$ ./test
docker-machine [-D create -d generic --generic-ip-address 10.1.10.12 bot1]
Importing SSH key...
IP: 10.1.10.12
Getting to WaitForSSH function...
Testing TCP connection to: 10.1.10.12:22
Using SSH client type: external
About to run SSH command:
exit 0
&{/usr/bin/ssh [/usr/bin/ssh -o PasswordAuthentication=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -i /Users/ppadala/.docker/machine/machines/bot1/id_rsa -p 22 root@10.1.10.12 exit 0] [] <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> false [] [] [] [] <nil>}
SSH cmd err, output: <nil>:
Using SSH client type: external
About to run SSH command:
cat /etc/os-release
&{/usr/bin/ssh [/usr/bin/ssh -o PasswordAuthentication=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -i /Users/ppadala/.docker/machine/machines/bot1/id_rsa -p 22 root@10.1.10.12 cat /etc/os-release] [] <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> false [] [] [] [] <nil>}
SSH cmd err, output: <nil>: NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
Couldn't set key CPE_NAME, no corresponding struct field found
Couldn't set key , no corresponding struct field found
Couldn't set key CENTOS_MANTISBT_PROJECT, no corresponding struct field found
Couldn't set key CENTOS_MANTISBT_PROJECT_VERSION, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key , no corresponding struct field found
found compatible host: centos
Using SSH client type: external
&{/usr/bin/ssh [/usr/bin/ssh -o PasswordAuthentication=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -i /Users/ppadala/.docker/machine/machines/bot1/id_rsa -p 22 root@10.1.10.12 -t sudo hostname bot1 && echo "bot1" | sudo tee /etc/hostname] [] <nil> <nil> <nil> [] <nil> <nil> <nil> <nil> false [] [] [] [] <nil>}
Error creating machine: exit status 1
You will want to check the provider to make sure the machine and associated resources were properly removed.
exit status 1
Pradeeps-MacBook-Air:test ppadala$ export MACHINE_NATIVE_SSH=1
Pradeeps-MacBook-Air:test ppadala$ ./test
docker-machine [-D create -d generic --generic-ip-address 10.1.10.12 bot1]
Importing SSH key...
IP: 10.1.10.12
Getting to WaitForSSH function...
Testing TCP connection to: 10.1.10.12:22
Using SSH client type: native
About to run SSH command:
exit 0
SSH cmd err, output: <nil>:
Using SSH client type: native
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
Couldn't set key CPE_NAME, no corresponding struct field found
Couldn't set key , no corresponding struct field found
Couldn't set key CENTOS_MANTISBT_PROJECT, no corresponding struct field found
Couldn't set key CENTOS_MANTISBT_PROJECT_VERSION, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key , no corresponding struct field found
found compatible host: centos
Using SSH client type: native
Error creating machine: operation not supported by device
You will want to check the provider to make sure the machine and associated resources were properly removed.
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment