X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDist%2FZilla%2FApp%2FCommand%2Fprovision.pm;h=f7a42b1d893866c1e9b6fdf8a25ced56881f45f6;hb=5aee843576f9893e240c0180bf8bbb56212b8216;hp=001edad4e0252816861f0816fe8355dbac94825e;hpb=45bec3869f4bbacc7d522b8a683bbd52d837ff3d;p=p5sagit%2FOyster.git diff --git a/lib/Dist/Zilla/App/Command/provision.pm b/lib/Dist/Zilla/App/Command/provision.pm index 001edad..f7a42b1 100644 --- a/lib/Dist/Zilla/App/Command/provision.pm +++ b/lib/Dist/Zilla/App/Command/provision.pm @@ -9,6 +9,8 @@ use Dist::Zilla::App -command; use Moose; use Config::Any; use Hash::Merge 'merge'; +Hash::Merge::set_behavior( 'RIGHT_PRECEDENT' ); +use Oyster::Provision; sub abstract { 'provision a new Oyster VM' } @@ -32,17 +34,22 @@ sub execute { my @hashes = grep $_, $Provision->{Default}, $Provision->{$name} or die "No section for <$name>, and no "; - - my %hash = @hashes > 1 ? %{ merge( @hashes ) } : $hashes[0]; - $hash{provision_backend} = delete $hash{type} || 'Rackspace'; + warn Dumper(\@hashes); + + my %hash = @hashes > 1 ? %{ merge( @hashes ) } : %{ $hashes[0] }; + + my $type = delete $hash{type} || 'Oyster::Provision::Rackspace'; + $hash{provision_backend} = $type =~/^Oyster::Provision::/ ? $type : "Oyster::Provision::$type"; $hash{pub_ssh} ||= "$ENV{HOME}/.ssh/id_rsa.pub"; - $hash{size} ||= 128; - $hash{image} ||= 'meerkat'; # TODO, should this be determined on backend? + $hash{size} ||= 1; # id 1 - ram 256 MiB - disk 10 GiB + $hash{image} ||= 69; # id 69 - Ubuntu 10.10 (meerkat) + + use Data::Dumper; warn "Config hash: ", Dumper(\%hash); - use Oyster::Provision; my $server = Oyster::Provision->new( name => $name, + config => \%hash, %hash, ); $server->create;