X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FOyster%2FProvision.pm;h=e498a2265de57cba34f08a69789dc931799a32d0;hb=57d9920132a9ccf15b734cd7b47052df70606f49;hp=0c1aaa6f8101642b9c656880c5399b0b4c6218fe;hpb=8a0402ec798af800cd25fe0d26fd1e5ef1d0fef0;p=p5sagit%2FOyster.git diff --git a/lib/Oyster/Provision.pm b/lib/Oyster/Provision.pm index 0c1aaa6..e498a22 100644 --- a/lib/Oyster/Provision.pm +++ b/lib/Oyster/Provision.pm @@ -2,22 +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' ); -has 'config' => (is => 'rw', isa => 'HashRef', required => 1 ); +# 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; - if(!exists($self->config()->{provision_backend})) { - $self->config()->{provision_backend} = 'Oyster::Provision::Rackspace'; - } - - my $role = $self->config()->{provision_backend}; + my $role = $self->provision_backend; eval "use $role"; "$role"->meta->apply($self);