knife-ec2find 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76df5f5cf876bfe9e34d7960d98ed72e21e2adf6
4
- data.tar.gz: 64f79d1789c07af5a11f89b86106549e06b29a1b
3
+ metadata.gz: ea6c501997dc6d0b18e202a8ff2adeb0b84ed48f
4
+ data.tar.gz: 364a19e9a2b58c9a6b1ebf6a6560af267424f191
5
5
  SHA512:
6
- metadata.gz: 80d8921c07a1f57acffd2f8e04465fbd0e1f6c50c866e981e96622ad5c310148b069c611442f16c2f3bee3d2a9c531571c1b5e9ebdb6815654e3db8dc88808b5
7
- data.tar.gz: 0f7f6e4934009d23da73ba26fb7b91a4c8475d0f5d88bd9fe10d04c86bcf4f32dc861f5253ff8bf5cf1803add5d1e29da0da92cae795ca9fb8d643811efd6ca6
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#{resource.send(attribute)}"
60
+ puts "#{attribute}\t#{values}"
31
61
  else
32
- puts "#{resource.send(attribute)}"
62
+ puts "#{values}"
33
63
  end
34
64
  end
35
65
  rescue Exception => e
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module EC2Find
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
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.2
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-09 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk