my %hash = @hashes > 1 ? %{ merge( @hashes ) } : $hashes[0];
- $hash{provision_backend} = delete $hash{type} || 'Rackspace';
+ $hash{provision_backend} = delete $hash{type} || 'Oyster::Provision::Rackspace';
$hash{pub_ssh} ||= "$ENV{HOME}/.ssh/id_rsa.pub";
$hash{size} ||= 1; # id 1 - ram 256 MiB - disk 10 GiB
$hash{image} ||= 69; # id 69 - Ubuntu 10.10 (meerkat)
use Oyster::Provision;
my $server = Oyster::Provision->new(
name => $name,
+ config => \%hash,
%hash,
);
$server->create;
sub _build_api_username {
return $ENV{CLOUDSERVERS_USER} if exists $ENV{CLOUDSERVERS_USER};
confess "Need api_username or CLOUDSERVERS_USER in environment";
-});
+}
has 'api_password' => ( is => 'ro', isa => 'Str', required => 1, lazy_build => 1);
sub _build_api_password {
$rs;
});
-after BUILD => sub {
- my $self = shift;
- # get api username and key from config?
- my $config = $self->config;
-
-
-
- # ...
-};
-
sub create {
my $self = shift;
# Build the server
my $server = Net::RackSpace::CloudServers::Server->new(
- cloudservers => $self->_cs,
- name => $self->name,
- flavor => $self->size,
- image => $self->image,
- personality => [
+ cloudservers => $self->_rs,
+ name => $self->name,
+ flavorid => $self->size,
+ imageid => $self->image,
+ personality => [
{
path => $self->pub_ssh,
contents => encode_base64($pub_ssh),
},
- ],
+ ],
);
$server->create_server;