mirror of
https://github.com/docker/docs.git
synced 2026-04-12 14:25:46 +07:00
Init methods are no-ops when already initialized.
Signed-off-by: Ash Wilson <ash.wilson@rackspace.com>
This commit is contained in:
committed by
Guillaume Giamarchi
parent
8466d95fa0
commit
7c839273c1
@@ -294,12 +294,10 @@ func (c *GenericClient) getPorts(d *Driver) ([]string, error) {
|
||||
}
|
||||
|
||||
func (c *GenericClient) InitComputeClient(d *Driver) error {
|
||||
if c.Provider == nil {
|
||||
err := c.Authenticate(d)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if c.Compute != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
compute, err := openstack.NewComputeV2(c.Provider, gophercloud.EndpointOpts{
|
||||
Region: d.Region,
|
||||
Availability: c.getEndpointType(d),
|
||||
@@ -312,6 +310,10 @@ func (c *GenericClient) InitComputeClient(d *Driver) error {
|
||||
}
|
||||
|
||||
func (c *GenericClient) InitNetworkClient(d *Driver) error {
|
||||
if c.Network != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
network, err := openstack.NewNetworkV2(c.Provider, gophercloud.EndpointOpts{
|
||||
Region: d.Region,
|
||||
Availability: c.getEndpointType(d),
|
||||
|
||||
@@ -22,9 +22,13 @@ type Client struct {
|
||||
|
||||
// Authenticate creates a Rackspace-specific Gophercloud client.
|
||||
func (c *Client) Authenticate(d *openstack.Driver) error {
|
||||
if c.Provider != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"Username": d.Username,
|
||||
}).Info("Authenticating...")
|
||||
}).Info("Authenticating to Rackspace.")
|
||||
|
||||
apiKey := c.driver.APIKey
|
||||
opts := gophercloud.AuthOptions{
|
||||
|
||||
Reference in New Issue
Block a user