Issue #8402 has been updated by Jeff McCune. Status changed from Accepted to In Topic Branch Pending Merge
# Needs review # Mailed puppet-dev group for review <pre> >From 2e86a95330531e98750266db0e995eb663e49932 Mon Sep 17 00:00:00 2001 From: Jeff McCune <[email protected]> Date: Thu, 14 Jul 2011 17:16:36 -0700 Subject: [PATCH/Module/cloudpack 1/1] (#8402) list action should display status This change updates the list action to output more than a simple list of DNS names. This wasn't ideal for terminated instances because they no longer have DNS names associated with them. The output now has the following information in a Hash of Hashes data structure: id: { id, dns_name, created_at, state } The spec tests have been updated to reflect this change in data structure from an array to a hash of hashes. Signed-off-by: Jeff McCune <[email protected]> --- lib/puppet/cloudpack.rb | 13 +++++++++++-- spec/unit/puppet/cloudpack_spec.rb | 12 +++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/puppet/cloudpack.rb b/lib/puppet/cloudpack.rb index c3ee1b7..f0ca10c 100644 --- a/lib/puppet/cloudpack.rb +++ b/lib/puppet/cloudpack.rb @@ -407,9 +407,18 @@ module Puppet::CloudPack options = merge_default_options(options) connection = create_connection(options) servers = connection.servers - # Convert the Fog object into a simple array. + # Convert the Fog object into a simple hash. # And return the array to the Faces API for rendering - servers.collect { |i| i.dns_name } + hsh = {} + servers.each do |s| + hsh[s.id] = { + "id" => s.id, + "state" => s.state, + "dns_name" => s.dns_name, + "created_at" => s.created_at, + } + end + hsh end def fingerprint(server, options) diff --git a/spec/unit/puppet/cloudpack_spec.rb b/spec/unit/puppet/cloudpack_spec.rb index 27aa94d..073c302 100644 --- a/spec/unit/puppet/cloudpack_spec.rb +++ b/spec/unit/puppet/cloudpack_spec.rb @@ -108,17 +108,15 @@ describe Puppet::CloudPack do @result = subject.list(:platform => 'AWS') end it 'should not be empty' do - # We actually get back something like this from Fog: - # ["ec2-368-5-559-12.compute-1.amazonaws.com", "ec2-14-92-246-64.compute-1.amazonaws.com"] @result.should_not be_empty end - it "should look like a list of DNS names" do - @result.each do |hostname| - hostname.should match(/^([a-zA-Z0-9-]+)$|^([a-zA-Z0-9-]+\.)+[a-zA-Z0-9-]+$/) + it "should look like a hash of identifiers" do + @result.each do |k,v| + k.should match(/^i-\w+/i) end end - it "should be a kind of Array" do - @result.should be_a_kind_of(Array) + it "should be a kind of Hash" do + @result.should be_a_kind_of(Hash) end end end -- 1.7.5.4 </pre> ---------------------------------------- Bug #8402: List action should display status https://projects.puppetlabs.com/issues/8402 Author: Jeff McCune Status: In Topic Branch Pending Merge Priority: Normal Assignee: Jeff McCune Category: cloudpack Target version: 0.6.0 Keywords: list action status Branch: ticket/master/8402_list_should_display_status Based on the feedback from the demo, the list action for cloudnode should display the instance status. For example, the following output is "bad" because it displays null values for terminated instances: <pre> ➜ cloudpack git:(ticket/master/bigmerge_improve_actions_for_end_user) puppet cloudnode list --render-as yaml --- - - </pre> I think at a minimum we should display the instance ID, public dns name if available, and status of the instance. e.g. "terminated" "running" "shutting down" etc... -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
