stem 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/stem/image.rb +8 -3
  2. data/lib/stem/util.rb +2 -2
  3. metadata +7 -7
@@ -34,14 +34,19 @@ module Stem
34
34
  def tagged tags
35
35
  return if tags.empty?
36
36
  opts = tags_to_filter(tags).merge("Owner" => "self")
37
- swirl.call("DescribeImages", opts)['imagesSet'].map {|image| image['imageId'] }
37
+ res = swirl.call("DescribeImages", opts)['imagesSet']
38
+ res ? res.map {|image| image['imageId'] } : []
38
39
  end
39
40
 
40
41
  def describe_tagged tags
41
42
  opts = tags_to_filter(tags).merge("Owner" => "self")
42
43
  images = swirl.call("DescribeImages", opts)["imagesSet"]
43
- images.each {|image| image["tags"] = tagset_to_hash(image["tagSet"]) }
44
- images
44
+ if images
45
+ images.each {|image| image["tags"] = tagset_to_hash(image["tagSet"]) }
46
+ images
47
+ else
48
+ []
49
+ end
45
50
  end
46
51
 
47
52
  def describe image
@@ -5,10 +5,10 @@ module Stem
5
5
  end
6
6
 
7
7
  def tagset_to_hash(tagset)
8
- if tagset["item"].is_a?(Hash)
8
+ if tagset.is_a?(Hash)
9
9
  {tagset["item"]["key"] => tagset["item"]["value"]}
10
10
  else
11
- tagset["item"].inject({}) do |h,item|
11
+ tagset.inject({}) do |h,item|
12
12
  k, v = item["key"], item["value"]
13
13
  h[k] = v
14
14
  h
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter van Hardenberg
@@ -28,12 +28,12 @@ dependencies:
28
28
  requirements:
29
29
  - - "="
30
30
  - !ruby/object:Gem::Version
31
- hash: 11
31
+ hash: 13
32
32
  segments:
33
33
  - 1
34
- - 6
35
- - 2
36
- version: 1.6.2
34
+ - 7
35
+ - 3
36
+ version: 1.7.3
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
39
  description: minimalist EC2 instance management