Skip to content

Commit

Permalink
Merge pull request #107 from opscode/sid-fix-fog-deprecation-warn
Browse files Browse the repository at this point in the history
[knife-cloud] KNIFE-474 knife openstack group list throws a fog deprecation warning
  • Loading branch information
kaustubh-d committed May 29, 2014
2 parents 8aaa622 + 20d3cc5 commit 701fe77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/chef/knife/openstack_group_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def list(security_groups)
ui.color('Description', :bold),
]
security_groups.sort_by(&:name).each do |group|
group.rules.each do |rule|
unless rule['ip_protocol'].nil?
group.security_group_rules.each do |rule|
unless rule.ip_protocol.nil?
group_list << group.name
group_list << rule['ip_protocol']
group_list << rule['from_port'].to_s
group_list << rule['to_port'].to_s
group_list << rule['ip_range']['cidr']
group_list << rule.ip_protocol
group_list << rule.from_port.to_s
group_list << rule.to_port.to_s
group_list << rule.ip_range['cidr']
group_list << group.description
end
end
Expand Down
9 changes: 9 additions & 0 deletions spec/unit/openstack_group_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,14 @@
end
end

context "#list" do
before(:each) do
@security_groups = [TestResource.new({ "name" => "Unrestricted","description" => "testdescription", "security_group_rules" => [TestResource.new({"from_port"=>636, "group"=>{}, "ip_protocol"=>"tcp", "to_port"=>636, "parent_group_id"=>14, "ip_range"=>{"cidr"=>"0.0.0.0/0"}, "id"=>183})]})]
end

it "returns group list" do
instance.ui.should_receive(:list).with(["Name", "Protocol", "From", "To", "CIDR", "Description", "Unrestricted", "tcp", "636", "636", "0.0.0.0/0", "testdescription"],:uneven_columns_across, 6)
instance.list(@security_groups)
end
end
end

0 comments on commit 701fe77

Please sign in to comment.