api_{username,password} belong in the roles
[p5sagit/Oyster.git] / lib / Oyster / Provision.pm
index 36cd7cc..e498a22 100644 (file)
@@ -2,21 +2,22 @@ package Oyster::Provision;
 
 use Moose;
 
-has 'name'    => ( is => 'ro', isa => 'Str', required => 1 );
-has 'size'    => ( is => 'ro', isa => 'Str', required => 1 );
-has 'image'   => ( is => 'ro', isa => 'Str', required => 1 );
-has 'pub_ssh' => ( is => 'ro', isa => 'Str', required => 1 );
+has 'name'    => ( is => 'ro', isa => 'Str');
+has 'size'    => ( is => 'ro', isa => 'Str');
+has 'image'   => ( is => 'ro', isa => 'Str');
+has 'pub_ssh' => ( is => 'ro', isa => 'Str');
+has 'config'  => ( is => 'rw', isa => 'HashRef', required => 1 );
+has 'provision_backend'  => (is => 'rw', isa => 'Str', required => 1, default => 'Oyster::Provision::Rackspace' );
 
-
-sub config {
-    return {provision_backend => 'Oyster::Provision::Rackspace'};
-}
+# TODO after provision, add the server's name with "oyster-" prefixed to the
+# user's ~/.ssh/ssh_config file so any part of Oyster can ssh there
+# passwordlessly for deploying or whatnot
 
 sub BUILD {
 
     my $self = shift;
 
-    my $role = $self->config()->{provision_backend};
+    my $role = $self->provision_backend;
 
     eval "use $role";
     "$role"->meta->apply($self);