On Oct 27, 2011, at 3:57 PM, Jason Guiditta <jguiditt(a)redhat.com> wrote:
On 27/10/11 13:27 -0400, Chris Alfonso wrote:
> The current implementation will push each target image to the same provider
> using the same provider account.
> ---
I just tried to apply this patch, and it doesn't apply on master, can
you rebase/resend?
-j
would you mind applying the patch I sent early this morning and apply this patch
on top of that. That way you you can ack and give me feedback. If not I can branch and
rebase.
> lib/aeolus_cli/command/build_command.rb | 29 +++++++++++++++++++++++++++++
> man/aeolus-image-build.1 | 15 ++++++++++++++-
> spec/command/build_command_spec.rb | 21 +++++++++++++++++++++
> 3 files changed, 64 insertions(+), 1 deletions(-)
>
> diff --git a/lib/aeolus_cli/command/build_command.rb
b/lib/aeolus_cli/command/build_command.rb
> index 6847542..caf32e4 100644
> --- a/lib/aeolus_cli/command/build_command.rb
> +++ b/lib/aeolus_cli/command/build_command.rb
> @@ -35,10 +35,27 @@ module Aeolus
>
> image = Aeolus::CLI::Image.new({:targets => @options[:target] *
",", :tdl => template})
> image.save!
> + puts "Image Build:"
> puts "Image: " + image.id
> puts "Build: " + image.build.id
> Array(image.build.target_images.target_image).each do |target_image|
> puts "Target Image: " + target_image.id.to_s + "\t :Status
" + target_image.status
> + if push?
> + pi = Aeolus::CLI::ProviderImage.new({:provider_name =>
@options[:provider].to_s,
> + :provider_account =>
@options[:account],
> + :image_id => image.id,
> + :build_id => image.build.id,
> + :target_image_id =>
target_image.id.to_s})
> +
> + pi.save!
> + puts ""
> + puts "Image Push:"
> + puts "Image: " + pi.image_id
> + puts "Build: " + pi.build_id
> + puts "Target Image: " + pi.target_image_id
> + puts "Provider Image: " + pi.id
> + puts "Status: " + pi.status
> + end
> end
> quit(0)
> end
> @@ -71,6 +88,18 @@ module Aeolus
> end
> true
> end
> +
> + def push?
> + push = false
> + if !(@options[:provider].nil? && @options[:account].nil?)
> + if @options[:provider].empty? || @options[:account].empty?
> + puts "This combination of parameters is not currently
supported"
> + quit(1)
> + end
> + push = true
> + end
> + push
> + end
> end
> end
> end
> diff --git a/man/aeolus-image-build.1 b/man/aeolus-image-build.1
> index 9a381ee..6253d16 100644
> --- a/man/aeolus-image-build.1
> +++ b/man/aeolus-image-build.1
> @@ -2,7 +2,7 @@
> .SH NAME
> aeolus-image build \- command for building aeolus images
> .SH SYNOPSIS
> -.B aeolus-image build [\-h|--help] [\-u|--username] [\-w|--password] [\-I|--image
[image-id]] [\-e|--template [path-to-template]] [\-t|--targets [targets]] [\-d|--daemon]
> +.B aeolus-image build [\-h|--help] [\-u|--username] [\-w|--password] [\-I|--image
[image-id]] [\-e|--template [path-to-template]] [\-t|--targets [targets]] [\-p|--provider
[provider] [\a-|--account]] [\-d|--daemon]
> .SH DESCRIPTION
> aeolus-image build command allows users to build new images based on a given TDL
template file for a set of specified targets such e.g. EC2, RHEVM etc... See list man
list target-images for information on how to list the completed builds.
> .SH OPTIONS
> @@ -19,6 +19,12 @@ Provide a list of targets for the build
> \-e, --template
> Provide path to a TDL template file for building against
> .TP
> +\-p, --provider
> +Name of the cloud provider
> +.TP
> +\-a, --account
> +Name of the provider account
> +.TP
> \-d, --daemon
> Run as a background process
> .TP
> @@ -31,6 +37,13 @@ Build a new image for ec2 based on the specified template TDL file
template.tdl
> \--targets ec2
> \--template ./template.tdl
> .TP
> +Build a new image for ec2 based on the specificed template TDL file template.tdl and
then push it to ec2-us-east-1
> +.B aeolus-image build
> +\--targets ec2
> +\--template ./template.tdl
> +\--provider ec2-us-east-1
> +\--account ec2_account_name
> +.TP
> Martyn Taylor (mtaylor(a)redhat.com), Jason Guiditta (jguiditta(a)redhat.com)
> .SH SEE ALSO
> aeolus-image-list(1), aeolus-image-push(1), aeolus-image-import(1)
> diff --git a/spec/command/build_command_spec.rb b/spec/command/build_command_spec.rb
> index 0ab2fbd..5fa4e01 100644
> --- a/spec/command/build_command_spec.rb
> +++ b/spec/command/build_command_spec.rb
> @@ -63,6 +63,27 @@ module Aeolus
> end
> end
>
> + describe "#push?" do
> + it "should push the image if a provider and provider account are
provided" do
> + @options[:provider] = ''
> + @options[:account] = ''
> + b = BuildCommand.new(@options, @output)
> + begin
> + b.push?
> + rescue SystemExit => e
> + e.status.should == 1
> + end
> + $stdout.string.should include("This combination of parameters is not
currently supported")
> + end
> +
> + it "should not push the image if a provider and provider account are
not provided" do
> + @options = Hash.new
> + b = BuildCommand.new(@options, @output)
> + push = b.push?
> + push.should == false
> + end
> + end
> +
> describe "#combo_implemented?" do
> it "should give useful feedback if no template or target is
specified" do
> @options[:template] = ''
> --
> 1.7.6.4
>
> _______________________________________________
> aeolus-devel mailing list
> aeolus-devel(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/aeolus-devel