awful 0.0.68 → 0.0.69

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: 806fec97b5fd5d94c3054e05dfd79bb16e7db4a1
4
- data.tar.gz: 47a150687554af433f94f94b400676a082c41777
3
+ metadata.gz: 1594283e90bf8e9ac7db11428c92db3e50c6ca7a
4
+ data.tar.gz: 18cfd76917e6886a2296b0b47375d2109cef86e0
5
5
  SHA512:
6
- metadata.gz: 9505b1e92b936872a0e7eab63c5a22e2ccbb2e9a5202ab824f2ac45b54c226b03067e498e73a2376f115a7cc3f50918931b502e388e6eadd6a6c67e0cbd87fd6
7
- data.tar.gz: 19bbe64490df435acbfcc8577da080d9114afa1ff5e0d6d187f99ee3b83caddcb3f55daf18c493fb30f4ec472fff84a91d18f3120eb2dd0bcd82611f9c41da8e
6
+ metadata.gz: d1b546aa9d187a0c1a70f15e61f85d9842934e28ba2b6bf660060f1c12900c67627e1fc941e0ee1ef59385d5b3a1ccdee411dc1569eb68738b7f5104dd208ef4
7
+ data.tar.gz: d4671f9a5430f062d034cfd2190064801465265d2fd3e7bec714372483b2217ff1f29815133bb2a0939d2467a00e94295cdfc8063759774ff2b8a080aab0085e
data/bin/ssm ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/ssm'
6
+
7
+ Awful::Ssm.start(ARGV)
data/lib/awful/ami.rb CHANGED
@@ -79,7 +79,7 @@ module Awful
79
79
  # end
80
80
  # end
81
81
 
82
- desc 'last NAME', 'get id of last (by creation date) AMI [matching NAME]'
82
+ desc 'last NAME', 'get ids of last (by creation date) AMIs [matching NAME]'
83
83
  method_option :count, aliases: '-n', type: :numeric, default: 1, desc: 'Return N results'
84
84
  def last(name = /./)
85
85
  images(options).select do |image|
data/lib/awful/ssm.rb ADDED
@@ -0,0 +1,86 @@
1
+ module Awful
2
+
3
+ class Ssm < Cli
4
+
5
+ COLORS = {
6
+ Success: :green,
7
+ TimedOut: :red,
8
+ Cancelled: :red,
9
+ Failed: :red
10
+ }
11
+
12
+ no_commands do
13
+ def ssm
14
+ @ssm ||= Aws::SSM::Client.new
15
+ end
16
+
17
+ def color(string)
18
+ set_color(string, COLORS.fetch(string.to_sym, :yellow))
19
+ end
20
+ end
21
+
22
+ desc 'ls', 'list commands'
23
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
24
+ def ls
25
+ ssm.list_commands.commands.tap do |cmds|
26
+ if options[:long]
27
+ print_table cmds.map { |c|
28
+ [
29
+ c.command_id,
30
+ c.instance_ids.join(','),
31
+ c.document_name,
32
+ color(c.status),
33
+ c.requested_date_time,
34
+ c.comment
35
+ ]
36
+ }
37
+ else
38
+ puts cmds.map(&:command_id)
39
+ end
40
+ end
41
+ end
42
+
43
+ desc 'dump ID', 'get details of command invocation for command ID'
44
+ def dump(id)
45
+ ssm.list_command_invocations(command_id: id, details: true).command_invocations.tap do |cmds|
46
+ cmds.each do |cmd|
47
+ puts YAML.dump(stringify_keys(cmd.to_hash))
48
+ end
49
+ end
50
+ end
51
+
52
+ desc 'documents NAME', 'list documents matching NAME'
53
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
54
+ method_option :platform_types, aliases: '-p', type: :string, default: 'Linux', desc: 'Platform type to show'
55
+ def documents(name = '.')
56
+ filter = [{key: 'PlatformTypes', value: options[:platform_types].capitalize}]
57
+ ssm.list_documents(document_filter_list: filter).document_identifiers.select do |doc|
58
+ doc.name.match(/#{name}/i)
59
+ end.tap do |docs|
60
+ if options[:long]
61
+ print_table docs.map { |d| [d.name, d.platform_types.join(',')] }
62
+ else
63
+ puts docs.map(&:name)
64
+ end
65
+ end
66
+ end
67
+
68
+ desc 'shell_script INSTANCE_IDS', 'run shell script on instances'
69
+ method_option :commands, aliases: '-c', type: :array, default: [], desc: 'Commands to run'
70
+ method_option :comment, type: :string, default: nil, desc: 'Brief command description'
71
+ def shell_script(*instance_ids)
72
+ ssm.send_command(
73
+ instance_ids: instance_ids,
74
+ comment: options[:comment],
75
+ document_name: 'AWS-RunShellScript',
76
+ parameters: {
77
+ commands: options[:commands]
78
+ }
79
+ ).tap do |response|
80
+ puts response.command.command_id
81
+ end
82
+ end
83
+
84
+ end
85
+
86
+ end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.68"
2
+ VERSION = '0.0.69'
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.68
4
+ version: 0.0.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-05 00:00:00.000000000 Z
11
+ date: 2015-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,6 +102,7 @@ executables:
102
102
  - route
103
103
  - s3
104
104
  - sg
105
+ - ssm
105
106
  - subnet
106
107
  - ta
107
108
  - vpc
@@ -132,6 +133,7 @@ files:
132
133
  - bin/route
133
134
  - bin/s3
134
135
  - bin/sg
136
+ - bin/ssm
135
137
  - bin/subnet
136
138
  - bin/ta
137
139
  - bin/vpc
@@ -154,6 +156,7 @@ files:
154
156
  - lib/awful/route_table.rb
155
157
  - lib/awful/s3.rb
156
158
  - lib/awful/security_group.rb
159
+ - lib/awful/ssm.rb
157
160
  - lib/awful/subnet.rb
158
161
  - lib/awful/trusted_advisor.rb
159
162
  - lib/awful/version.rb