mirror of https://github.com/docker/docs.git
Set machine hostname
Signed-off-by: Guillaume Giamarchi <guillaume.giamarchi@gmail.com>
This commit is contained in:
parent
e44b840e3a
commit
9d91f458f5
|
@ -176,18 +176,20 @@ func GetCreateFlags() []cli.Flag {
|
|||
}
|
||||
}
|
||||
|
||||
func NewDriver(storePath string) (drivers.Driver, error) {
|
||||
func NewDriver(machineName string, storePath string) (drivers.Driver, error) {
|
||||
log.WithFields(log.Fields{
|
||||
"storePath": storePath,
|
||||
"machineName": machineName,
|
||||
"storePath": storePath,
|
||||
}).Debug("Instantiating OpenStack driver...")
|
||||
|
||||
return NewDerivedDriver(storePath, &GenericClient{})
|
||||
return NewDerivedDriver(machineName, storePath, &GenericClient{})
|
||||
}
|
||||
|
||||
func NewDerivedDriver(storePath string, client Client) (*Driver, error) {
|
||||
func NewDerivedDriver(machineName string, storePath string, client Client) (*Driver, error) {
|
||||
return &Driver{
|
||||
storePath: storePath,
|
||||
client: client,
|
||||
MachineName: machineName,
|
||||
storePath: storePath,
|
||||
client: client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -301,8 +303,7 @@ func (d *Driver) GetState() (state.State, error) {
|
|||
}
|
||||
|
||||
func (d *Driver) Create() error {
|
||||
d.setMachineNameIfNotSet()
|
||||
d.KeyPairName = d.MachineName
|
||||
d.KeyPairName = fmt.Sprintf("%s-%s", d.MachineName, utils.GenerateRandomID())
|
||||
|
||||
if err := d.resolveIds(); err != nil {
|
||||
return err
|
||||
|
@ -745,9 +746,3 @@ func (d *Driver) sshKeyPath() string {
|
|||
func (d *Driver) publicSSHKeyPath() string {
|
||||
return d.sshKeyPath() + ".pub"
|
||||
}
|
||||
|
||||
func (d *Driver) setMachineNameIfNotSet() {
|
||||
if d.MachineName == "" {
|
||||
d.MachineName = fmt.Sprintf("docker-host-%s", utils.GenerateRandomID())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,13 +93,14 @@ func GetCreateFlags() []cli.Flag {
|
|||
}
|
||||
|
||||
// NewDriver instantiates a Rackspace driver.
|
||||
func NewDriver(storePath string) (drivers.Driver, error) {
|
||||
func NewDriver(machineName string, storePath string) (drivers.Driver, error) {
|
||||
log.WithFields(log.Fields{
|
||||
"storePath": storePath,
|
||||
"machineName": machineName,
|
||||
"storePath": storePath,
|
||||
}).Debug("Instantiating Rackspace driver.")
|
||||
|
||||
client := &Client{}
|
||||
inner, err := openstack.NewDerivedDriver(storePath, client)
|
||||
inner, err := openstack.NewDerivedDriver(machineName, storePath, client)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue