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:
Ash Wilson
2014-12-11 10:14:49 -05:00
committed by Guillaume Giamarchi
parent 0f02ebe6f2
commit c12d3f8ecd
5 changed files with 196 additions and 24 deletions

View File

@@ -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
}