mirror of https://github.com/docker/docs.git
Rackspace driver enhancements & fixes
* checkConfig is no longer a thing. * Change the default Rackspace image to Ubuntu 14.04. * Remove an unnecessary Network service. * Show a nicer error when the Region is omitted. Signed-off-by: Ash Wilson <ash.wilson@rackspace.com>
This commit is contained in:
parent
2332bcc9d8
commit
5636679367
|
|
@ -272,9 +272,6 @@ func (d *Driver) GetState() (state.State, error) {
|
||||||
if err := d.initCompute(); err != nil {
|
if err := d.initCompute(); err != nil {
|
||||||
return state.None, err
|
return state.None, err
|
||||||
}
|
}
|
||||||
if err := d.initNetwork(); err != nil {
|
|
||||||
return state.None, err
|
|
||||||
}
|
|
||||||
|
|
||||||
s, err := d.client.GetInstanceState(d)
|
s, err := d.client.GetInstanceState(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ func GetCreateFlags() []cli.Flag {
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "rackspace-image-id",
|
Name: "rackspace-image-id",
|
||||||
Usage: "Rackspace image ID. Default: Ubuntu 14.10 (Utopic Unicorn) (PVHVM)",
|
Usage: "Rackspace image ID. Default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)",
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
|
|
@ -109,6 +109,15 @@ func (d *Driver) DriverName() string {
|
||||||
return "rackspace"
|
return "rackspace"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func missingEnvOrOption(setting, envVar, opt string) error {
|
||||||
|
return fmt.Errorf(
|
||||||
|
"%s must be specified either using the environment variable %s or the CLI option %s",
|
||||||
|
setting,
|
||||||
|
envVar,
|
||||||
|
opt,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// SetConfigFromFlags assigns and verifies the command-line arguments presented to the driver.
|
// SetConfigFromFlags assigns and verifies the command-line arguments presented to the driver.
|
||||||
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
d.Username = flags.String("rackspace-username")
|
d.Username = flags.String("rackspace-username")
|
||||||
|
|
@ -119,19 +128,10 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
d.FlavorId = flags.String("rackspace-flavor-id")
|
d.FlavorId = flags.String("rackspace-flavor-id")
|
||||||
d.SSHUser = flags.String("rackspace-ssh-user")
|
d.SSHUser = flags.String("rackspace-ssh-user")
|
||||||
d.SSHPort = flags.Int("rackspace-ssh-port")
|
d.SSHPort = flags.Int("rackspace-ssh-port")
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func missingEnvOrOption(setting, envVar, opt string) error {
|
if d.Region == "" {
|
||||||
return fmt.Errorf(
|
return missingEnvOrOption("Region", "OS_REGION_NAME", "--rackspace-region")
|
||||||
"%s must be specified either using the environment variable %s or the CLI option %s",
|
}
|
||||||
setting,
|
|
||||||
envVar,
|
|
||||||
opt,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Driver) checkConfig() error {
|
|
||||||
if d.Username == "" {
|
if d.Username == "" {
|
||||||
return missingEnvOrOption("Username", "OS_USERNAME", "--rackspace-username")
|
return missingEnvOrOption("Username", "OS_USERNAME", "--rackspace-username")
|
||||||
}
|
}
|
||||||
|
|
@ -140,10 +140,10 @@ func (d *Driver) checkConfig() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.ImageId == "" {
|
if d.ImageId == "" {
|
||||||
// Default to the Ubuntu 14.10 image.
|
// Default to the Ubuntu 14.04 image.
|
||||||
// This is done here, rather than in the option registration, to keep the default value
|
// This is done here, rather than in the option registration, to keep the default value
|
||||||
// from making "machine create --help" ugly.
|
// from making "machine create --help" ugly.
|
||||||
d.ImageId = "0766e5df-d60a-4100-ae8c-07f27ec0148f"
|
d.ImageId = "598a4282-f14b-4e50-af4c-b3e52749d9f9"
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
|
if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue