Initial cut at a Rackspace driver.
* Wrap openstack.Client in an interface. * Alternate openstack Driver creation method. * Register the Rackspace driver in commands.go. Signed-off-by: Ash Wilson <ash.wilson@rackspace.com>
This commit is contained in:
committed by
Guillaume Giamarchi
parent
0f02ebe6f2
commit
c12d3f8ecd
@@ -38,7 +38,7 @@ type Driver struct {
|
||||
SSHUser string
|
||||
SSHPort int
|
||||
storePath string
|
||||
client *Client
|
||||
client Client
|
||||
}
|
||||
|
||||
type CreateFlags struct {
|
||||
@@ -159,12 +159,16 @@ func RegisterCreateFlags(cmd *flag.FlagSet) interface{} {
|
||||
}
|
||||
|
||||
func NewDriver(storePath string) (drivers.Driver, error) {
|
||||
return NewDerivedDriver(storePath, &GenericClient{})
|
||||
}
|
||||
|
||||
func NewDerivedDriver(storePath string, client Client) (*Driver, error) {
|
||||
log.WithFields(log.Fields{
|
||||
"storePath": storePath,
|
||||
}).Debug("Instanciate OpenStack driver...")
|
||||
}).Debug("Instantiating OpenStack driver...")
|
||||
return &Driver{
|
||||
storePath: storePath,
|
||||
client: &Client{},
|
||||
client: client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user