awful 0.0.160 → 0.0.161

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: 976c227fd5ff38b9c243fcfbe722ec57a36b84c6
4
- data.tar.gz: 7e7b4e7eb9a2cd6dd7d02e2223ff3840427b1765
3
+ metadata.gz: 468c76dd67311ec96f097e6d05ecf53287800b64
4
+ data.tar.gz: f3a59e49c7c61e4d05941b18368a09292450f7a3
5
5
  SHA512:
6
- metadata.gz: 45f8096b48a63ae34a4d3197e1f0aad8af7ebeb4700887e8dd9620603a807b654cf97f7c6f836a1c44c13994615c212a3f3902bcd2ce0e6d983a98962ff74d69
7
- data.tar.gz: 11b18f323231122a01687bee01d38efe5a001a5944fc6c087e2eecd74d34bfdbe38b8c11f280bb90a8f78daeb7c3cab58a65cad0ebcc830648a6e9eb016132d8
6
+ metadata.gz: 06d367fe21ee33f8c58ea6308e4160caa937209f8f8238afffbbb8b40b0033a2be48df59bc1e3182284fcde9f88891b804ebce43ebd26c13fc5ca0829688c12f
7
+ data.tar.gz: 5dfa3f87196eff10c0df6565561b9694d73ecec663e8fd264041bcbb15933cb32376cc2ff7cb5a02d8c7acdb705a2bf0e7b084f2f307c6cce49a0f750cfa0fcc
@@ -4,16 +4,22 @@ module Awful
4
4
 
5
5
  class LaunchConfig < Cli
6
6
 
7
- desc 'ls [PATTERN]', 'list launch configs with name matching PATTERN'
8
- method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
9
- def ls(name = /./)
10
- fields = options[:long] ? %i[launch_configuration_name image_id instance_type created_time] : %i[launch_configuration_name]
11
- autoscaling.describe_launch_configurations.map(&:launch_configurations).flatten.select do |lc|
12
- lc.launch_configuration_name.match(name)
13
- end.map do |lc|
14
- fields.map { |field| lc.send(field) }
15
- end.tap do |list|
16
- print_table list
7
+ desc 'ls [NAMES]', 'list launch configurations'
8
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
9
+ method_option :match, aliases: '-m', type: :string, default: nil, desc: 'filter by matching name'
10
+ def ls(*names)
11
+ paginate(:launch_configurations) do |token|
12
+ autoscaling.describe_launch_configurations(launch_configuration_names: names, next_token: token)
13
+ end.tap do |lcs|
14
+ lcs.select! { |lc| lc.launch_configuration_name.match(options[:match]) } if options[:match]
15
+ end.output do |lcs|
16
+ if options[:long]
17
+ print_table lcs.map { |lc|
18
+ [lc.launch_configuration_name, lc.image_id, lc.instance_type, lc.created_time]
19
+ }
20
+ else
21
+ puts lcs.map(&:launch_configuration_name)
22
+ end
17
23
  end
18
24
  end
19
25
 
@@ -37,10 +43,18 @@ module Awful
37
43
  end
38
44
 
39
45
  desc 'dump NAME', 'dump existing launch_configuration as yaml'
40
- def dump(name)
41
- lc = autoscaling.describe_launch_configurations(launch_configuration_names: Array(name)).map(&:launch_configurations).flatten.first.to_hash
42
- lc[:user_data] = Base64.decode64(lc[:user_data])
43
- puts YAML.dump(stringify_keys(lc))
46
+ method_option :match, aliases: '-m', type: :string, default: nil, desc: 'filter by matching name'
47
+ def dump(*names)
48
+ paginate(:launch_configurations) do |token|
49
+ autoscaling.describe_launch_configurations(launch_configuration_names: names, next_token: token)
50
+ end.tap do |lcs|
51
+ lcs.select! { |lc| lc.launch_configuration_name.match(options[:match]) } if options[:match]
52
+ end.output do |lcs|
53
+ lcs.each do |lc|
54
+ lc[:user_data] = Base64.decode64(lc[:user_data])
55
+ puts YAML.dump(stringify_keys(lc.to_hash))
56
+ end
57
+ end
44
58
  end
45
59
 
46
60
  desc 'latest', 'latest'
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.160'
2
+ VERSION = '0.0.161'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.160
4
+ version: 0.0.161
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister