Nack,
Maros, this seems to work to an extent when I manually test it. The
headers are incorrect though, you have entered the account information
under a header named "Provider Name" this needs to be changed to
"Account"
You should probably list the Provider, Provider Type and Account next to
each other in the list so its easier to read.
Also I am getting one failing test, see below.
Can you fix these and resend
Thanks
Martyn
Failures:
1) Aeolus::CLI::ListCommand should list all provider images for a
particular target image
Failure/Error: lc.providerimages
WebMock::NetConnectNotAllowedError:
Real HTTP connections are disabled. Unregistered request: GET
https://admin:password@localhost/conductor/api/provider_accounts.xml
with headers {'Accept'=>'application/xml',
'Accept-Language'=>'en'}.
You can use VCR to automatically record this request and replay it
later. For more details, visit the VCR documentation at:
http://relishapp.com/myronmarston/vcr/v/1-10-0
# ./lib/aeolus_cli/command/list_command.rb:77:in `providerimages'
# ./spec/command/list_command_spec.rb:120
# ./spec/command/list_command_spec.rb:117
Finished in 1.05 seconds
57 examples, 1 failure
Failed examples:
rspec ./spec/command/list_command_spec.rb:116 # Aeolus::CLI::ListCommand
should list all provider images for a particular target image
rake aborted!
On 12/02/2011 01:59 PM, mzatko(a)redhat.com wrote:
From: Maros Zatko<mzatko(a)redhat.com>
---
lib/aeolus_cli/command/list_command.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/aeolus_cli/command/list_command.rb
b/lib/aeolus_cli/command/list_command.rb
index fbc4ee4..b8b4c5f 100644
--- a/lib/aeolus_cli/command/list_command.rb
+++ b/lib/aeolus_cli/command/list_command.rb
@@ -70,7 +70,19 @@ module Aeolus
headers[:provider] = "Provider"
headers[:status] = "Status"
headers[:target_image] = "Target Image"
+ headers[:account_name] = "Provider Name"
+ headers[:account_type] = "Provider Type"
collection = @options[:id].nil? ? Aeolus::CLI::ProviderImage.all :
Aeolus::CLI::ProviderImage.find(:all, :from => Aeolus::CLI::Base.site.path +
"/target_images/" + @options[:id] + "/provider_images.xml")
+
+ paccs = Aeolus::CLI::ProviderAccount.all.group_by(&:provider)
+
+ collection.map do |item|
+ prov = item.attributes[:provider]
+ item.attributes[:account_name] = paccs[prov].first.name
+ item.attributes[:account_type] = paccs[prov].first.provider_type
+ item
+ end
+
print_collection(collection, headers)
quit(0)
rescue => e