sshkit 1.17.0 → 1.18.0

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
  SHA256:
3
- metadata.gz: fc70293f2ae9b1fd7a0adf61cac4ff329fa54e4c7461570eec898560777fc006
4
- data.tar.gz: b707f414b46ca07e1b6b9f0db26f5512d1a1a654922292d959d56f7d2bb9be39
3
+ metadata.gz: bebf3a96075e905b11a3f52b5e75064e49f5d710c375ae2c39c7bbd93b7d76bd
4
+ data.tar.gz: e8d9ab9ec716df400ce730ebc82c74a32c23c83e0edc52b778e74a5cba8055ee
5
5
  SHA512:
6
- metadata.gz: b127c917a1bd92af92ede9cf7710c75c82504159b4432bd0ec483a8cae1aed2dc269c1e58bfd5fd7f2f384f3ed6115db5e9dacbcab7eedf5bae42597afaec585
7
- data.tar.gz: cefe7b628ec52664d2753bc09787ef1aae4cbbea93774afce828397bb18d77afbd78622c3ec84f3d90bf6b609af2b6be56c5bb03e6d35c6f48c9a2e9a3d81a9b
6
+ metadata.gz: e91cf1cbcff6c0dfaef0f2a05a6843f5312f8091b6b55fbc24022cc4e688c29fce690ac09d3b6cb33a9e8c42ba6bcb1441479f5fdf40d111f862ff55bb3b9122
7
+ data.tar.gz: 3e50dc789ef3dff1ecd3041f89c332bc5883157c9ab2f007148e0c025f47f3a2941bab046661f45dcaa5f4880493674d34ff142df660f19a7eaf82b0c9e5da41
@@ -7,6 +7,10 @@ appear at the top.
7
7
 
8
8
  * Your contribution here!
9
9
 
10
+ ## [1.18.0][] (2018-10-21)
11
+
12
+ * [#435](https://github.com/capistrano/sshkit/pull/435): Consistent verbosity configuration #capture and #test methods - [@NikolayRys](https://github.com/NikolayRys)
13
+
10
14
  ## [1.17.0][] (2018-07-07)
11
15
 
12
16
  * [#430](https://github.com/capistrano/sshkit/pull/430): [Feature] Command Argument STDOUT/capistrano.log Hiding - [@NorseGaud](https://github.com/NorseGaud)
@@ -746,7 +750,8 @@ version `0.0.5`.
746
750
 
747
751
  First release.
748
752
 
749
- [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.17.0...HEAD
753
+ [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.18.0...HEAD
754
+ [1.18.0]: https://github.com/capistrano/sshkit/compare/v1.17.0...v1.18.0
750
755
  [1.17.0]: https://github.com/capistrano/sshkit/compare/v1.16.1...v1.17.0
751
756
  [1.16.1]: https://github.com/capistrano/sshkit/compare/v1.16.0...v1.16.1
752
757
  [1.16.0]: https://github.com/capistrano/sshkit/compare/v1.15.1...v1.16.0
data/README.md CHANGED
@@ -445,13 +445,13 @@ SSHKit.config.output = SSHKit::Formatter::SimpleText.new(File.open('log/deploy.l
445
445
 
446
446
  #### Output & Log Redaction
447
447
 
448
- If necessary, redact() can be used on a section of your execute arguments to hide it from both STDOUT and the capistrano.log. It supports the majority of data types.
448
+ If necessary, `redact` can be used on a section of your `execute` arguments to hide it from both STDOUT and the capistrano.log. It supports the majority of data types.
449
449
 
450
450
  ```ruby
451
451
  # Example from capistrano-postgresql gem
452
452
  execute(:psql, fetch(:pg_system_db), '-c', %Q{"CREATE USER \\"#{fetch(:pg_username)}\\" PASSWORD}, redact("'#{fetch(:pg_password)}'"), %Q{;"})
453
453
  ```
454
- Once wrapped, sshkit logging will replace the actual pg_password with a [REDACTED] value:
454
+ Once wrapped, sshkit logging will replace the actual pg_password with a [REDACTED] value. The created database user will have the value from `fetch(:pg_password)`.
455
455
 
456
456
  ```
457
457
  # STDOUT
@@ -467,7 +467,13 @@ DEBUG [529b623c] CREATE ROLE
467
467
 
468
468
  ```
469
469
 
470
- Yet, the created database user will have the value from `fetch(:pg_password)`.
470
+ Certain commands will require that no spaces exist between a string and what you want hidden. Because SSHKIT will include a whitespace between each argument of `execute`, this can be dealt with by wrapping both in redact:
471
+
472
+ ```ruby
473
+ # lib/capistrano/tasks/systemd.rake
474
+ execute :sudo, :echo, redact("CONTENT_WEB_TOOLS_PASS='#{ENV['CONTENT_WEB_TOOLS_PASS']}'"), ">> /etc/systemd/system/#{fetch(:application)}_sidekiq.service.d/EnvironmentFile", '"'
475
+
476
+ ```
471
477
 
472
478
  #### Output Colors
473
479
 
@@ -514,6 +520,8 @@ produces a large amount of noise. They are tagged with a verbosity option on
514
520
  the `Command` instances of `Logger::DEBUG`. The default configuration for
515
521
  output verbosity is available to override with `SSHKit.config.output_verbosity=`,
516
522
  and defaults to `Logger::INFO`.
523
+ Another way to is to provide a hash containing `{verbosity: Logger::INFO}` as
524
+ a last parameter for the method call.
517
525
 
518
526
  At present the `Logger::WARN`, `ERROR` and `FATAL` are not used.
519
527
 
@@ -55,7 +55,7 @@ module SSHKit
55
55
  end
56
56
 
57
57
  def test(*args)
58
- options = args.extract_options!.merge(raise_on_non_zero_exit: false, verbosity: Logger::DEBUG)
58
+ options = { verbosity: Logger::DEBUG, raise_on_non_zero_exit: false }.merge(args.extract_options!)
59
59
  create_command_and_execute(args, options).success?
60
60
  end
61
61
 
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "1.17.0".freeze
2
+ VERSION = "1.18.0".freeze
3
3
  end
@@ -40,7 +40,7 @@ module SSHKit
40
40
  )
41
41
  end
42
42
 
43
- def test_test_method_creates_and_executes_command_with_false_raise_on_non_zero_exit
43
+ def test_test_creates_and_executes_command_with_false_raise_on_non_zero_exit
44
44
  backend = ExampleBackend.new do
45
45
  test '[ -d /some/file ]'
46
46
  end
@@ -51,6 +51,14 @@ module SSHKit
51
51
  assert_equal false, backend.executed_command.options[:raise_on_non_zero_exit], 'raise_on_non_zero_exit option'
52
52
  end
53
53
 
54
+ def test_test_allows_to_override_verbosity
55
+ backend = ExampleBackend.new do
56
+ test 'echo output', {verbosity: Logger::INFO}
57
+ end
58
+ backend.run
59
+ assert_equal(backend.executed_command.options[:verbosity], Logger::INFO)
60
+ end
61
+
54
62
  def test_capture_creates_and_executes_command_and_returns_stripped_output
55
63
  output = nil
56
64
  backend = ExampleBackend.new do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Hambley
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-08 00:00:00.000000000 Z
12
+ date: 2018-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh