[PATCH aeolus-cli] Bug 796781: Handle environment param in cli call for import
Scott Seago
sseago at redhat.com
Fri Feb 24 15:18:47 UTC 2012
https://bugzilla.redhat.com/show_bug.cgi?id=796781
---
lib/aeolus_cli/command/config_parser.rb | 11 +++++++----
lib/aeolus_cli/command/import_command.rb | 5 +++--
man/aeolus-image-import.1 | 8 +++++++-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/lib/aeolus_cli/command/config_parser.rb b/lib/aeolus_cli/command/config_parser.rb
index 1401870..de9689a 100644
--- a/lib/aeolus_cli/command/config_parser.rb
+++ b/lib/aeolus_cli/command/config_parser.rb
@@ -151,7 +151,7 @@ module Aeolus
opts.on('-T', '--target TARGET1,TARGET2', Array, 'provider type (ec2, rackspace, rhevm, etc)') do |name|
@options[:target] = name
end
- opts.on('-E', '--environment ENVIRONMENT', 'Limit image list to environment') do |environment|
+ opts.on('-E', '--environment ENVIRONMENT', 'environment to build for') do |environment|
@options[:environment] = environment
end
opts.on( '-h', '--help', 'Get usage information for this command')
@@ -233,13 +233,16 @@ module Aeolus
opts.on('-A', '--account NAME,NAME', Array, 'name of specific account to import to') do |name|
@options[:provider_account] = name
end
+ opts.on('-E', '--environment ENVIRONMENT', 'environment to import into') do |environment|
+ @options[:environment] = environment
+ end
opts.on( '-h', '--help', 'Get usage information for this command')
opts.separator ""
opts.separator "Examples:"
- opts.separator "aeolus-image import --account my-ec2 --id $ami_id # import an AMI from the specified provider"
- opts.separator "aeolus-image import --account my-ec2 --id $ami_id --description '<image><name>My Image</name></image>' # import an AMI from the specified provider"
- opts.separator "aeolus-image import --account my-ec2 --id $ami_id --description <path_to_xml_file> # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --account my-ec2 --id $ami_id --environment default # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --account my-ec2 --id $ami_id --environment default --description '<image><name>My Image</name></image>' # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --account my-ec2 --id $ami_id --environment default --description <path_to_xml_file> # import an AMI from the specified provider"
opts.separator ""
opts.separator "RHEV:"
opts.separator "Enter the template id for the provider image id. The template id can be found through the RHEV REST API."
diff --git a/lib/aeolus_cli/command/import_command.rb b/lib/aeolus_cli/command/import_command.rb
index c53d749..63ee873 100644
--- a/lib/aeolus_cli/command/import_command.rb
+++ b/lib/aeolus_cli/command/import_command.rb
@@ -34,7 +34,8 @@ module Aeolus
image = Aeolus::CLI::Image.new({:target_identifier => @options[:id],
:image_descriptor => @options[:description],
- :provider_account_name => @options[:provider_account].first})
+ :provider_account_name => @options[:provider_account].first,
+ :environment => @options[:environment]})
image.save!
headers = ActiveSupport::OrderedHash.new
@@ -68,7 +69,7 @@ module Aeolus
raise ArgumentError, "params should not contain nil"
end
- required_keys = [:id, :provider_account]
+ required_keys = [:id, :provider_account, :environment]
optional_keys = [:description]
isect = params.keys & required_keys
diff --git a/man/aeolus-image-import.1 b/man/aeolus-image-import.1
index 33a7653..8772798 100644
--- a/man/aeolus-image-import.1
+++ b/man/aeolus-image-import.1
@@ -2,7 +2,7 @@
.SH NAME
aeolus-image import \- command for importing existing provider images into aeolus
.SH SYNOPSIS
-.B aeolus-image import [\-h|--help] [\-u|--username] [\-w|--password] [\-A|--account [account-name]] [\--id [provider-image-id]] [--description [path-to-file|xml string]] [\-d|--daemon]
+.B aeolus-image import [\-h|--help] [\-u|--username] [\-w|--password] [\-A|--account [account-name]] [\--id [provider-image-id]] [\-E|--environment] [--description [path-to-file|xml string]] [\-d|--daemon]
.SH DESCRIPTION
aeolus-image import allows users to import pre-existing images that exist in cloud provders for example AMI from EC2, into aeolus.
.SH OPTIONS
@@ -19,6 +19,9 @@ The provider account name as it exists in Conductor from where the importing ima
\--id <provider-image-id>
The providers ID given to the importing image
.TP
+\-E, --environment
+Limit image list to environment
+.TP
\--description <path-to-xml-description|xml string>
A user defined description to associate with the importing image
.TP
@@ -33,17 +36,20 @@ Import the AMI ami-1234567 from the provider account my-ec2 into aeolus
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
.TP
Import the AMI ami-1234567 from the provider account my-ec2 into aeolus with a given xml description
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
\--description '<image><name>myAMI</name></image>'
.TP
Import the AMI ami-1234567 from the provider account my-ec2 into aeolus providing a path to the description XML file
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
\--description /foo/bar/description.xml
.SH RHEV
.TP
--
1.7.6.4
More information about the aeolus-devel
mailing list