sonic-screwdriver 2.2.0 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/docs/_includes/footer.html +6 -5
- data/lib/sonic/cli.rb +2 -0
- data/lib/sonic/execute.rb +27 -6
- data/lib/sonic/version.rb +1 -1
- data/sonic.gemspec +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bbef13564fb67b71ae83ef8b80d9c67f3a7898bbdc5dd0215adb5309b478322
|
4
|
+
data.tar.gz: d27e4a05ccadc3bb45987fdfeaac328b6d620cef08fe4b5af89d7def964e9087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb10c05307747cb731e28d9e30b3cbacbc929b8a0f5f4ccdc303c0e2ceb1a6f0e7234f62d7336f0e21e80d197cd843314b41773478c8e9251a67bdbd23e0b1b
|
7
|
+
data.tar.gz: 725ec5a6aaa226b6e70b042db8551665976803ec74a6dfa13d10a114a616a93301d2df8aa5e074ce75c8886300e8539a19d1de864579b1b450c9bb5948af2006
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,21 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely* adheres to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [2.2.5] - 2021-04-24
|
7
|
+
- [#14](https://github.com/boltops-tools/sonic/pull/14) execute --timeout option: executionTimeout
|
8
|
+
|
9
|
+
## [2.2.4] - 2021-04-13
|
10
|
+
- [#13](https://github.com/boltops-tools/sonic/pull/13) execute --comment option
|
11
|
+
|
12
|
+
## [2.2.3] - 2021-04-12
|
13
|
+
- [#12](https://github.com/boltops-tools/sonic/pull/12) fix cli check
|
14
|
+
|
15
|
+
## [2.2.2] - 2021-04-12
|
16
|
+
- [#11](https://github.com/boltops-tools/sonic/pull/11) cli check
|
17
|
+
|
18
|
+
## [2.2.1] - 2021-04-12
|
19
|
+
- [#9](https://github.com/boltops-tools/sonic/pull/9) improve command array handling
|
20
|
+
|
6
21
|
## [2.2.0]
|
7
22
|
- #7 sonic execute command: `--tags` and `--instance-id` options instead of polymorphic list. Breaking behavior.
|
8
23
|
- display output even if tags used
|
data/docs/_includes/footer.html
CHANGED
@@ -6,11 +6,12 @@
|
|
6
6
|
<div class="footer-col col-md-4">
|
7
7
|
<h3>More Tools</h3>
|
8
8
|
<ul class="list-unstyled tools">
|
9
|
-
<li><a href="
|
10
|
-
<li><a href="
|
11
|
-
<li><a href="
|
12
|
-
<li><a href="
|
13
|
-
<li><a href="https://
|
9
|
+
<li><a href="https://terraspace.cloud">Terraspace</a></li>
|
10
|
+
<li><a href="https://kubes.guru">Kubes</a></li>
|
11
|
+
<li><a href="https://rubyonjets.com">Jets</a></li>
|
12
|
+
<li><a href="https://ufoships.com">Ufo</a></li>
|
13
|
+
<li><a href="https://lono.cloud">Lono</a></li>
|
14
|
+
<li><a href="https://jack-eb.com">Jack</a></li>
|
14
15
|
</ul>
|
15
16
|
</div>
|
16
17
|
<div class="footer-col col-md-4">
|
data/lib/sonic/cli.rb
CHANGED
@@ -29,6 +29,8 @@ module Sonic
|
|
29
29
|
# filter - Filter ec2 instances by tag name or instance_ids separated by commas
|
30
30
|
option :instance_ids, desc: %Q|Instance ids to execute command on. Format: --instance-ids "i-111,i-222"|
|
31
31
|
option :tags, desc: %Q|Tags used to determine what instances to execute command on. Format: --tags "Key1=v1,v2;Key2=v3"|
|
32
|
+
option :comment, desc: "comment. defaults to the sonic command used"
|
33
|
+
option :timeout, aliases: %w[t], desc: "timeout in seconds. default to nil which uses AWS-RunShellScript default of 3600"
|
32
34
|
def execute(*command)
|
33
35
|
Execute.new(command, options).execute
|
34
36
|
end
|
data/lib/sonic/execute.rb
CHANGED
@@ -53,18 +53,32 @@ module Sonic
|
|
53
53
|
puts
|
54
54
|
return if @options[:noop]
|
55
55
|
status = wait(command_id)
|
56
|
-
|
56
|
+
display_ssm_output(command_id)
|
57
57
|
display_console_url(command_id)
|
58
58
|
|
59
59
|
if status == "Success"
|
60
60
|
puts "Command successful: #{status}".color(:green)
|
61
|
-
|
61
|
+
exit_status(0)
|
62
62
|
else
|
63
63
|
puts "Command unsuccessful: #{status}".color(:red)
|
64
|
-
|
64
|
+
exit_status(1)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def exit_status(code)
|
69
|
+
exit(code) if cli?
|
70
|
+
|
71
|
+
if code == 0
|
72
|
+
true
|
73
|
+
else
|
74
|
+
raise "Error running command"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def cli?
|
79
|
+
$0.include?('sonic')
|
80
|
+
end
|
81
|
+
|
68
82
|
def wait(command_id)
|
69
83
|
ongoing_states = ["Pending", "InProgress", "Delayed"]
|
70
84
|
|
@@ -183,10 +197,17 @@ module Sonic
|
|
183
197
|
def build_ssm_options
|
184
198
|
criteria = transform_filter_option
|
185
199
|
command = build_command(@command)
|
200
|
+
comment = @options[:comment] || "sonic #{ARGV.join(' ')}"
|
201
|
+
comment = comment[0..99] # comment has a max of 100 chars
|
202
|
+
|
203
|
+
parameters = { "commands" => command }
|
204
|
+
t = @options[:timeout]
|
205
|
+
parameters[:executionTimeout] = [t] if t # weird but executionTimeout expects an Array
|
206
|
+
|
186
207
|
options = criteria.merge(
|
187
208
|
document_name: "AWS-RunShellScript", # default
|
188
|
-
comment:
|
189
|
-
parameters:
|
209
|
+
comment: comment,
|
210
|
+
parameters: parameters,
|
190
211
|
# Default CloudWatchLog settings. Can be overwritten with settings.yml send_command
|
191
212
|
# IMPORTANT: make sure the EC2 instance the command runs on has access to write to CloudWatch Logs.
|
192
213
|
cloud_watch_output_config: {
|
@@ -256,7 +277,7 @@ module Sonic
|
|
256
277
|
# The script is being feed inline so just join the command together into one script.
|
257
278
|
# Still keep in an array form because that's how ssn.send_command works with AWS-RunShellScript
|
258
279
|
# usually reads the command.
|
259
|
-
|
280
|
+
command.is_a?(Array) ? command : [command]
|
260
281
|
end
|
261
282
|
end
|
262
283
|
|
data/lib/sonic/version.rb
CHANGED
data/sonic.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "http://sonic-screwdriver.cloud/"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.files = File.directory?('.git') ? `git ls-files`.split($/) : Dir.glob("**/*")
|
16
16
|
spec.bindir = "exe"
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonic-screwdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -263,7 +263,6 @@ files:
|
|
263
263
|
- CHANGELOG.md
|
264
264
|
- CONTRIBUTING.md
|
265
265
|
- Gemfile
|
266
|
-
- Gemfile.lock
|
267
266
|
- Guardfile
|
268
267
|
- LICENSE.txt
|
269
268
|
- README.md
|
@@ -420,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
420
419
|
- !ruby/object:Gem::Version
|
421
420
|
version: '0'
|
422
421
|
requirements: []
|
423
|
-
rubygems_version: 3.
|
422
|
+
rubygems_version: 3.2.5
|
424
423
|
signing_key:
|
425
424
|
specification_version: 4
|
426
425
|
summary: Multi-functional tool to manage AWS infrastructure
|