knife-ec2find 0.0.2 → 0.0.3
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 +4 -4
- data/lib/chef/knife/ec2_find_base.rb +32 -2
- data/lib/knife-ec2find/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea6c501997dc6d0b18e202a8ff2adeb0b84ed48f
|
4
|
+
data.tar.gz: 364a19e9a2b58c9a6b1ebf6a6560af267424f191
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea1889f3d0501ed703bd6d49f2e3f7074fb4640fa7d4071e25fd0624f4a0126f2f3b3e2836195c46ab28c0e3441f44ac4541696db3de43428b26a109dbbfa81c
|
7
|
+
data.tar.gz: 25875ea868c98d1df812334c687370c0d5be5f290ca75fefb1d287e0a1452c7cf84c27f37b763a3c05c415b25196eeebd1c51d532da5350036ef31b50164aa4b
|
@@ -23,13 +23,43 @@ module EC2Find
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
+
def attribute_values resource, attribute
|
27
|
+
attribute_hierarchy_sequence = attribute.split(".")
|
28
|
+
container_values = resource.send(attribute_hierarchy_sequence[0])
|
29
|
+
container_values = [container_values] unless container_values.class.eql?(Array)
|
30
|
+
values = []
|
31
|
+
container_values.each do |container_value|
|
32
|
+
if attribute_hierarchy_sequence.length == 1
|
33
|
+
values << container_value
|
34
|
+
else
|
35
|
+
values << attribute_values(container_value, attribute_hierarchy_sequence[1..(attribute_hierarchy_sequence.length - 1)].join("."))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
values
|
39
|
+
end
|
40
|
+
|
41
|
+
def format_values values
|
42
|
+
if values[0].class.eql?(Array)
|
43
|
+
formatted_values = values.join(",")
|
44
|
+
return formatted_values
|
45
|
+
else
|
46
|
+
formatted_values = []
|
47
|
+
values.each do |struct_value|
|
48
|
+
struct_value.to_hash.each do |k, v|
|
49
|
+
formatted_values << "#{k}=\"#{v}\""
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return formatted_values.join(",")
|
53
|
+
end
|
54
|
+
end
|
26
55
|
def print_description resource, attributes=default_attributes
|
27
56
|
begin
|
28
57
|
attributes.each do |attribute|
|
58
|
+
values = format_values(attribute_values(resource, attribute))
|
29
59
|
unless config[:suppress_attribute_names]
|
30
|
-
puts "#{attribute}\t#{
|
60
|
+
puts "#{attribute}\t#{values}"
|
31
61
|
else
|
32
|
-
puts "#{
|
62
|
+
puts "#{values}"
|
33
63
|
end
|
34
64
|
end
|
35
65
|
rescue Exception => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ec2find
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Advani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|