awful 0.0.79 → 0.0.80

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: 0160d9a38b5cf708b56495419ba171274f98712c
4
- data.tar.gz: 3c19711d7ff3bd05145713b9e889c91c35cc46dc
3
+ metadata.gz: 43078b98ef014badfaafc6f3131158790368fc19
4
+ data.tar.gz: 46d94310f776c245ad74bc39fa9aa3a9faec1ed5
5
5
  SHA512:
6
- metadata.gz: fc2831aae001b046a7f9e69eec664c52f14ac8eb98ca8a05048433083d39b6a7b81bb4b294e281b041626b6440b95592aab2ae74dd95ebf9bcbaab530eecb032
7
- data.tar.gz: ca6e6f2a54d33c2305349e4d5770943cf6f85345b788b1053b36dcdde349c124d6ff0e65211a9301ffc9e2c018e25709254e3a62355b30f4857b2d624a30644a
6
+ metadata.gz: 319f74dee650f5cd086870258777d54d54d189fd0a4780e9eb8408c8ed4e8c8e496b37f69d8884fb704d689d2900a135144a66b7c95697f7aced2993060b2814
7
+ data.tar.gz: 82ce207b60082aabc1a3acae11548d4248cd8cd4f33d1d6802cf671dc3a538451ff74d7e66ced5fb2b9e02da1825f3ced3568db546f0cc197ed498ec18c4299c
data/lib/awful/ami.rb CHANGED
@@ -54,16 +54,29 @@ module Awful
54
54
  end
55
55
  end
56
56
 
57
- desc 'tags ID [KEY=VALUE]', 'tag an image, or print tags'
58
- def tags(id, tag = nil)
59
- ami = images(options).find do |image|
60
- image.image_id.match(id)
57
+ desc 'dump IDS', 'describe images'
58
+ def dump(*ids)
59
+ ec2.describe_images(image_ids: ids).images.tap do |images|
60
+ images.each do |image|
61
+ puts YAML.dump(stringify_keys(image.to_hash))
62
+ end
61
63
  end
62
- if tag
63
- key, value = tag.split('=')
64
- ec2.create_tags(resources: [ami.image_id], tags: [{key: key, value: value}])
64
+ end
65
+
66
+ desc 'tags ID [TAGS]', 'get tags for AMI, or set multiple tags as key:value'
67
+ def tags(id, *tags)
68
+ if tags.empty?
69
+ ec2.describe_images(image_ids: [id]).images.first.tags.tap do |list|
70
+ print_table list.map { |t| [t.key, t.value] }
71
+ end
65
72
  else
66
- puts ami.tags.map { |t| "#{t[:key]}=#{t[:value]}" }
73
+ ec2.create_tags(
74
+ resources: [id],
75
+ tags: tags.map do |t|
76
+ key, value = t.split(/[:=]/)
77
+ {key: key, value: value}
78
+ end
79
+ )
67
80
  end
68
81
  end
69
82
 
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.79'
2
+ VERSION = '0.0.80'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.79
4
+ version: 0.0.80
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-08 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler