sonic-screwdriver 2.2.2 → 2.2.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58baac92cd0720ee6f66d62b668d53eaf77a9b0bb184241dbbb69bdb2b7b120b
4
- data.tar.gz: 593b326eee1fffa6da70b87f133a4cc1a61ae41b465962b5fa9077f1998c4dc5
3
+ metadata.gz: 2090155cf49be41cd1fb602d13b4f569fb251d9a69be4459fb2e101b19bc1229
4
+ data.tar.gz: 4d59f16423169fe0866c67645644a6e7a6362edb2c8375137376653eb743f3b7
5
5
  SHA512:
6
- metadata.gz: 01b85739677b31d02caeb2c34a585fc2f711972ff086574b138f68b38ba156e9325dd0f8ba6fb76bd698f5b7bf422b4a1a11336f27b4695d2f2de153688dcc3b
7
- data.tar.gz: d42107ab7218aab71cf6b500dc377e34a587b27155e696f729633a870b2788ab0807fc16c680c49083c99597ab466631b5e8f92b7d343a388379f5e2ce918c3c
6
+ metadata.gz: 8b3ad10084e43b02d44a4ef98e9f2b33966fa78f61a1baf82374890dfe4246ac32d2baf2ee20e6ad4ecfb672a7dfaa9bcc6aac68d98a59d2ec5b4f1b1aa6dad0
7
+ data.tar.gz: 357b1c2b01c2848980fd5307a00fdda27fffe56762b455e5a071067ebcedfccf233562cd098794e8b8fc17484bf47acb6902e7402117cf425923d8dbc7c4f7b5
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.7] - 2021-04-30
7
+ - aws ssm send_command sdk requires string for timeout values
8
+
9
+ ## [2.2.6] - 2021-04-30
10
+ - [#15](https://github.com/boltops-tools/sonic/pull/15) execution-timeout and delivery-timeout options and timeout sets both …
11
+
12
+ ## [2.2.5] - 2021-04-24
13
+ - [#14](https://github.com/boltops-tools/sonic/pull/14) execute --timeout option: executionTimeout
14
+
15
+ ## [2.2.4] - 2021-04-13
16
+ - [#13](https://github.com/boltops-tools/sonic/pull/13) execute --comment option
17
+
18
+ ## [2.2.3] - 2021-04-12
19
+ - [#12](https://github.com/boltops-tools/sonic/pull/12) fix cli check
20
+
6
21
  ## [2.2.2] - 2021-04-12
7
22
  - [#11](https://github.com/boltops-tools/sonic/pull/11) cli check
8
23
 
data/lib/sonic/cli.rb CHANGED
@@ -29,6 +29,10 @@ 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. defaults to nil which uses AWS-RunShellScript default of 3600"
34
+ option :execution_timeout, desc: "execution timeout in seconds. defaults to general timeout option"
35
+ option :delivery_timeout, desc: "delivery timeout in seconds. defaults to general timeout option"
32
36
  def execute(*command)
33
37
  Execute.new(command, options).execute
34
38
  end
data/lib/sonic/execute.rb CHANGED
@@ -53,7 +53,7 @@ module Sonic
53
53
  puts
54
54
  return if @options[:noop]
55
55
  status = wait(command_id)
56
- instances_found = display_ssm_output(command_id)
56
+ display_ssm_output(command_id)
57
57
  display_console_url(command_id)
58
58
 
59
59
  if status == "Success"
@@ -66,7 +66,7 @@ module Sonic
66
66
  end
67
67
 
68
68
  def exit_status(code)
69
- exit(code) unless cli?
69
+ exit(code) if cli?
70
70
 
71
71
  if code == 0
72
72
  true
@@ -197,10 +197,17 @@ module Sonic
197
197
  def build_ssm_options
198
198
  criteria = transform_filter_option
199
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[:execution_timeout] || @options[:timeout]
205
+ parameters[:executionTimeout] = [t.to_s] if t # weird but executionTimeout expects an Array with String element
206
+
200
207
  options = criteria.merge(
201
208
  document_name: "AWS-RunShellScript", # default
202
- comment: "sonic #{ARGV.join(' ')}"[0..99], # comment has a max of 100 chars
203
- parameters: { "commands" => command },
209
+ comment: comment,
210
+ parameters: parameters,
204
211
  # Default CloudWatchLog settings. Can be overwritten with settings.yml send_command
205
212
  # IMPORTANT: make sure the EC2 instance the command runs on has access to write to CloudWatch Logs.
206
213
  cloud_watch_output_config: {
@@ -208,6 +215,10 @@ module Sonic
208
215
  cloud_watch_output_enabled: true,
209
216
  },
210
217
  )
218
+
219
+ t = @options[:execution_timeout] || @options[:timeout]
220
+ options[:timeout_seconds] = t.to_s if t
221
+
211
222
  settings_options = settings["send_command"] || {}
212
223
  options.merge(settings_options.deep_symbolize_keys)
213
224
  end
data/lib/sonic/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sonic
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.7"
3
3
  end
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.2
4
+ version: 2.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2021-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport