| 1 | package CloudDeploy::CommandLine::Deploy { | ||
| 2 | use MooseX::App; | ||
| 3 | use CloudDeploy::Utils; | ||
| 4 | use Moose::Util::TypeConstraints qw/enum/; | ||
| 5 | |||
| 6 | parameter deploy_class => (is => 'ro', isa => 'Str', required => 1); | ||
| 7 | option comments => (is => 'ro', isa => 'Str|Undef', documentation => "Comments to include with deployment"); | ||
| 8 | |||
| 9 | sub run { | ||
| 10 | my ($self) = @_; | ||
| 11 | |||
| 12 | my $module = load_class($self->deploy_class); | ||
| 13 | my $obj = $module->{class}->new(params => $module->{params_class}->new_with_options(argv => $self->extra_argv)); | ||
| 14 | |||
| 15 | if ($obj->isa('CCfnX::MakeAMIBase')){ | ||
| 16 | die "Please make AMIs with imager"; | ||
| 17 | } | ||
| 18 | |||
| 19 | # New deployment engine vs cfn deployer | ||
| 20 | my $deployer; | ||
| 21 | $deployer = $obj->get_deployer({ | ||
| 22 | access_key => $ENV{AWS_ACCESS_KEY_ID}, | ||
| 23 | secret_key => $ENV{AWS_SECRET_ACCESS_KEY}, | ||
| 24 | account => $ENV{CPSD_AWS_ACCOUNT}, | ||
| 25 | comments => $self->comments, | ||
| 26 | },'CCfnX::CloudFormationDeployer', 'CCfnX::PersistentDeployment'); | ||
| 27 | |||
| 28 | $deployer->deploy; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; | ||
| 33 |