knife-cloud 1.1.0 → 1.2.0.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9bd37b28f654e1519bd6257e85df5b334b3552c
|
4
|
+
data.tar.gz: 50388a4270d158c12fda15ed43e8cd69e832283a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53083a0e00ae32d660d4a3ef22994b0348d54e5439001dcc7004b57bf6388cc6465625cc3d048dac6bd2aba2df2fb5900bc0e3d0232907e4e57e207706107205
|
7
|
+
data.tar.gz: 4b456d12c67e2d7485a2e89ab162ea1e17105c87ca6326ae55499722ab30fa30c98a3f5c385fb0fa39279057cfe883246de257c2aab361ddc70a9ac2c82cb2b2
|
@@ -53,7 +53,7 @@ class Chef
|
|
53
53
|
end
|
54
54
|
false
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
# Derived class can override this to add more functionality.
|
58
58
|
def get_resource_col_val(resource)
|
59
59
|
resource_filtered = false
|
@@ -70,24 +70,29 @@ class Chef
|
|
70
70
|
|
71
71
|
# When @columns_with_info is nil display all
|
72
72
|
def list(resources)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
if(config[:format] == "summary")
|
74
|
+
# display column wise only if @columns_with_info is specified, else as a json for readable display.
|
75
|
+
begin
|
76
|
+
resource_list = @columns_with_info.map { |col_info| ui.color(col_info[:label], :bold) } if @columns_with_info.length > 0
|
77
|
+
resources.sort_by{|x| x.send(@sort_by_field).downcase }.each do |resource|
|
78
|
+
if @columns_with_info.length > 0
|
79
|
+
list = get_resource_col_val(resource)
|
80
|
+
resource_list.concat(list) unless list.nil?
|
81
|
+
else
|
82
|
+
puts resource.to_json
|
83
|
+
puts "\n"
|
84
|
+
end
|
83
85
|
end
|
86
|
+
|
87
|
+
rescue => e
|
88
|
+
ui.fatal("Unknown resource error : #{e.message}")
|
89
|
+
raise e
|
84
90
|
end
|
85
91
|
|
86
|
-
|
87
|
-
|
88
|
-
|
92
|
+
puts ui.list(resource_list, :uneven_columns_across, @columns_with_info.length) if @columns_with_info.length > 0
|
93
|
+
else
|
94
|
+
output(format_for_display(resources))
|
89
95
|
end
|
90
|
-
puts ui.list(resource_list, :uneven_columns_across, @columns_with_info.length) if @columns_with_info.length > 0
|
91
96
|
end
|
92
97
|
|
93
98
|
end # class ResourceListCommand
|
data/lib/knife-cloud/version.rb
CHANGED
@@ -24,7 +24,7 @@ require 'excon/errors'
|
|
24
24
|
|
25
25
|
describe Chef::Knife::Cloud::ResourceListCommand do
|
26
26
|
it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::ResourceListCommand.new
|
27
|
-
|
27
|
+
|
28
28
|
let (:instance) {Chef::Knife::Cloud::ResourceListCommand.new}
|
29
29
|
let (:resources) {[ TestResource.new({:id => "resource-1", :os => "ubuntu"}),
|
30
30
|
TestResource.new({:id => "resource-2", :os => "windows"})]}
|
@@ -44,6 +44,7 @@ describe Chef::Knife::Cloud::ResourceListCommand do
|
|
44
44
|
let(:test_resource) { "test" }
|
45
45
|
before(:each) do
|
46
46
|
expect(instance.ui).to receive(:fatal)
|
47
|
+
instance.config[:format] = "summary"
|
47
48
|
end
|
48
49
|
|
49
50
|
it "handle generic exception" do
|
@@ -63,6 +64,7 @@ describe Chef::Knife::Cloud::ResourceListCommand do
|
|
63
64
|
allow(instance).to receive(:query_resource).and_return(resources)
|
64
65
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
65
66
|
allow(instance).to receive(:puts)
|
67
|
+
instance.config[:format] = "summary"
|
66
68
|
end
|
67
69
|
|
68
70
|
it "lists resources in json format when columns_with_info parameter is empty" do
|
@@ -88,6 +90,7 @@ describe Chef::Knife::Cloud::ResourceListCommand do
|
|
88
90
|
allow(@derived_instance).to receive(:query_resource).and_return(resources)
|
89
91
|
allow(@derived_instance).to receive(:puts)
|
90
92
|
allow(@derived_instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
93
|
+
@derived_instance.config[:format] = "summary"
|
91
94
|
end
|
92
95
|
|
93
96
|
it "lists all resources" do
|
@@ -125,6 +128,7 @@ describe Chef::Knife::Cloud::ResourceListCommand do
|
|
125
128
|
allow(@derived_instance).to receive(:query_resource).and_return(resources)
|
126
129
|
allow(@derived_instance).to receive(:puts)
|
127
130
|
allow(@derived_instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
131
|
+
@derived_instance.config[:format] = "summary"
|
128
132
|
end
|
129
133
|
|
130
134
|
it "lists formatted list of resources" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.rc.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaustubh Deorukhkar
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: knife-windows
|
@@ -214,9 +214,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
216
|
requirements:
|
217
|
-
- - "
|
217
|
+
- - ">"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version:
|
219
|
+
version: 1.3.1
|
220
220
|
requirements: []
|
221
221
|
rubyforge_project:
|
222
222
|
rubygems_version: 2.2.2
|