Backend expects a config hashref
[p5sagit/Oyster.git] / lib / Dist / Zilla / App / Command / provision.pm
index 9ba0bc2..f7a42b1 100644 (file)
@@ -9,6 +9,7 @@ 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' }
@@ -33,8 +34,10 @@ sub execute {
 
   my @hashes = grep $_, $Provision->{Default}, $Provision->{$name}
       or die "No section for <Provision> <$name>, and no <default>";
-    
-  my %hash = @hashes > 1 ? %{ merge( @hashes ) } : $hashes[0];
+
+  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";
@@ -42,6 +45,8 @@ sub execute {
   $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);
+
   my $server = Oyster::Provision->new(
         name => $name,
         config => \%hash,