mirror of https://github.com/docker/docs.git
Merge pull request #440 from ehazlett/fix-azure-dns
use hostname for azure instead of generating
This commit is contained in:
commit
74852ae963
|
@ -90,6 +90,8 @@ Options:
|
|||
- `--azure-subscription-id`: Your Azure subscription ID.
|
||||
- `--azure-subscription-cert`: Your Azure subscription cert.
|
||||
|
||||
Note: the machine name will be used as DNS name for the Cloud Service (e.g. machinename.cloudapp.net)
|
||||
|
||||
### Amazon EC2
|
||||
|
||||
Create machines on [Amazon Web Services](http://aws.amazon.com). You will need an Access Key ID, Secret Access Key and a VPC ID. To find the VPC ID, login to the AWS console and go to Services -> VPC -> Your VPCs. Select the one where you would like to launch the instance.
|
||||
|
|
|
@ -108,16 +108,7 @@ func GetCreateFlags() []cli.Flag {
|
|||
}
|
||||
|
||||
func NewDriver(machineName string, storePath string, caCert string, privateKey string) (drivers.Driver, error) {
|
||||
t := time.Now().Format("20060102150405")
|
||||
name := fmt.Sprintf("%s-%s", machineName, t)
|
||||
|
||||
// trim name to 24 chars due to the azure dns name limit
|
||||
if len(name) > 24 {
|
||||
name = name[0:24]
|
||||
|
||||
}
|
||||
|
||||
driver := &Driver{MachineName: name, storePath: storePath, CaCertPath: caCert, PrivateKeyPath: privateKey}
|
||||
driver := &Driver{MachineName: machineName, storePath: storePath, CaCertPath: caCert, PrivateKeyPath: privateKey}
|
||||
return driver, nil
|
||||
}
|
||||
|
||||
|
@ -173,6 +164,20 @@ func (driver *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
|||
}
|
||||
|
||||
func (driver *Driver) PreCreateCheck() error {
|
||||
if err := driver.setUserSubscription(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// check azure DNS to make sure name is available
|
||||
available, response, err := vmClient.CheckHostedServiceNameAvailability(driver.MachineName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !available {
|
||||
return fmt.Errorf(response)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue