diff --git a/README.md b/README.md index bf9fe4f9e1..db1669027e 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,8 @@ Options: there is no IP address already allocated a new IP will be allocated and assigned to the machine. - `--openstack-ssh-user`: The username to use for SSH into the machine. If not provided `root` will be used. - `--openstack-ssh-port`: Customize the SSH port if the SSH server on the machine does not listen on the default port. + - `--openstack-docker-install`: Boolean flag to indicate if docker have to be installed on the machine. Useful when + docker is already installed and configured in the OpenStack image. Default set to `true` Environment variables: diff --git a/drivers/openstack/openstack.go b/drivers/openstack/openstack.go index 797a6a854e..af01d298a8 100644 --- a/drivers/openstack/openstack.go +++ b/drivers/openstack/openstack.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os/exec" "path" + "strconv" "strings" "time" @@ -40,6 +41,7 @@ type Driver struct { SSHPort int Ip string storePath string + installDocher bool client Client } @@ -164,6 +166,13 @@ func GetCreateFlags() []cli.Flag { Usage: "OpenStack SSH port", Value: 22, }, + // Using a StringFlag rather than a BoolFlag because + // the BoolFlag default value is always false + cli.StringFlag{ + Name: "openstack-docker-install", + Usage: "Set if docker have to be installed on the machine", + Value: "true", + }, } } @@ -206,6 +215,12 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.FloatingIpPool = flags.String("openstack-floatingip-pool") d.SSHUser = flags.String("openstack-ssh-user") d.SSHPort = flags.Int("openstack-ssh-port") + + installDocker, err := strconv.ParseBool(flags.String("openstack-docker-install")) + if err != nil { + return err + } + d.installDocher = installDocker return d.checkConfig() } @@ -315,8 +330,10 @@ func (d *Driver) Create() error { if err := d.waitForSSHServer(); err != nil { return err } - if err := d.installDocker(); err != nil { - return err + if d.installDocher { + if err := d.installDocker(); err != nil { + return err + } } return nil }