runbook 0.16.1 → 1.0.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: 327e40dc7d06ef4ea604565750b4a6bd8aa7950453911d1d5331bb12f2dee453
4
- data.tar.gz: ccd9929823ffbee857e883baaafc8aed5f1a95dd074b327dd2156fc669bd4aac
3
+ metadata.gz: 1c6c617aa11aeff1ab914c2f6d4d7b4db2cc5f46e6c70acc67a97eda7ba5b3a6
4
+ data.tar.gz: 3d68b0e53afbddc94ac0fa7c56eab9a8ac78ad104830c551f79c477314a81c4f
5
5
  SHA512:
6
- metadata.gz: bce6f3b3bac537977fa9b94281bc3112d129259ae9b6caae1fe2b2eacb7653a192ab25e38aa0bf6b13cc8b3803d26c92d8cf620ba87376f91e5e3da75bb4e9a0
7
- data.tar.gz: dfd5d2f7119852045414ab57b1ec16b64154e4b6dcca84526ed832dccfd10171df37ec433e41d47a0dd2af6884415ee2ce2c18fb141564ea7ddae93ee392e351
6
+ metadata.gz: cd186e2e3d0bde065b1ed0cccecce8c5943ec6ca626dac0cfa38725f4dd4050f5208df8343e770c602f2ec6cf7b38be9b01fee69ac0f304a16a14fe6c610378a
7
+ data.tar.gz: 4ce8c856c8cbd26cbffdfc1f7c2fe1b1fad5f6d5cdfc511d3be731d8db43db5ddeff1abf1d1ab2738374ac5eac27dbe33151e99f97abd604f3ddebb10394bf8c
@@ -4,6 +4,25 @@ This log maintains a list of all substantive changes to Runbook. The log include
4
4
 
5
5
  ## master
6
6
 
7
+ ## `v1.0.0` (2020-07-24)
8
+
9
+ ### Breaking Changes:
10
+
11
+ * Commands and tmux commands that previously escaped single quotes will now require un-escaped single quotes
12
+
13
+ ### Features:
14
+
15
+ * Add Node#parent_entity to find the containinng entity for a node
16
+
17
+ ### Fixes:
18
+
19
+ * Fix bugs requiring escaping single quotes in commands and tmux_commands (BACKWARDS INCOMPATIBLE CHANGE)
20
+ * Fix `File.exists?` deprecation warning (Thanks onk!)
21
+
22
+ ### Documentation:
23
+
24
+ * Add suppress_capture_output.rb runbook example
25
+
7
26
  ## `v0.16.1` (2019-11-25)
8
27
 
9
28
  ### Fixes:
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/runbook.svg)](https://badge.fury.io/rb/runbook)
4
4
  [![Build Status](https://travis-ci.org/braintree/runbook.svg?branch=master)](https://travis-ci.org/braintree/runbook)
5
+ [![Gitter](https://badges.gitter.im/braintree/runbook.svg)](https://gitter.im/braintree/runbook?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5
6
 
6
7
  _See our [blog post](https://medium.com/braintree-product-technology/https-medium-com-braintree-product-technology-runbook-be6f072cfc0d) for the philosophy behind Runbook and an overview of its features._
7
8
 
@@ -1141,7 +1142,7 @@ Additionally, runbooks should contain their own assertions, sanity checks, monit
1141
1142
 
1142
1143
  ## Known Issues
1143
1144
 
1144
- ### Command Quoting
1145
+ ### Command Quoting (Prior to v1.0)
1145
1146
 
1146
1147
  Because ssh_config declarations such as `user`, `group`, `path`, `env`, and `umask` are implemented as wrappers around your provided commands, you must be aware that issues can arise if your commands contain characters such as single quotes that are not properly escaped.
1147
1148
 
@@ -0,0 +1,4 @@
1
+ FROM panubo/sshd:1.0.3
2
+
3
+ RUN apk update && \
4
+ apk add sudo
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ require "runbook"
3
+
4
+ class QuietToolbox < Runbook::Toolbox
5
+ def output(msg); end
6
+ def warn(msg); end
7
+ def error(msg); end
8
+ end
9
+
10
+ Runbook::Runs::SSHKit.register_hook(
11
+ :set_suppress_statement_output_hook,
12
+ :around,
13
+ Runbook::Statement
14
+ ) do |object, metadata, block|
15
+ parent_entity = object.parent_entity
16
+ toolbox = metadata[:toolbox]
17
+ formatter = Runbook.config.ssh_kit.output
18
+ if parent_entity.tags.include?(:suppress_statement_output) || parent_entity.labels[:suppress_statement_output]
19
+ Runbook.config.ssh_kit.output = Runbook.config.ssh_kit.use_format(:blackhole)
20
+ metadata[:toolbox] = QuietToolbox.new
21
+ end
22
+ block.call(object, metadata)
23
+ Runbook.config.ssh_kit.output = formatter
24
+ metadata[:toolbox] = toolbox
25
+ end
26
+
27
+ runbook = Runbook.book "Capture Output Suppression" do
28
+ description <<-DESC
29
+ This is a runbook that suppresses capture output
30
+ DESC
31
+
32
+ section "Demo Output Capture" do
33
+ step "Capturing output", :suppress_statement_output do
34
+ capture "echo hi", into: :echo_output
35
+ end
36
+
37
+ step "Printing output" do
38
+ ruby_command { notice echo_output }
39
+ end
40
+ end
41
+ end
42
+
43
+ if __FILE__ == $0
44
+ Runbook::Runner.new(runbook).run
45
+ else
46
+ runbook
47
+ end
@@ -7,7 +7,6 @@ module Runbook
7
7
  child_class.const_set(:DSL, Runbook::DSL.class)
8
8
  end
9
9
 
10
- attr_accessor :parent
11
10
  attr_reader :title, :tags, :labels, :dsl
12
11
 
13
12
  def initialize(title, tags: [], labels: {}, parent: nil)
@@ -5,7 +5,7 @@ module Runbook::Helpers
5
5
  def setup_layout(structure, runbook_title:)
6
6
  _remove_stale_layouts
7
7
  layout_file = _layout_file(_slug(runbook_title))
8
- if File.exists?(layout_file)
8
+ if File.exist?(layout_file)
9
9
  stored_layout = ::YAML::load_file(layout_file)
10
10
  if _all_panes_exist?(stored_layout)
11
11
  return stored_layout
@@ -20,7 +20,7 @@ module Runbook::Helpers
20
20
  end
21
21
 
22
22
  def send_keys(command, target)
23
- `tmux send-keys -t #{target} #{_pager_escape_sequence} '#{command}' C-m`
23
+ `tmux send-keys -t #{target} #{_pager_escape_sequence} #{Shellwords.escape(command)} C-m`
24
24
  end
25
25
 
26
26
  def kill_all_panes(layout_panes)
@@ -1,5 +1,7 @@
1
1
  module Runbook
2
2
  class Node
3
+ attr_accessor :parent
4
+
3
5
  def initialize
4
6
  raise "Should not be initialized"
5
7
  end
@@ -19,5 +21,13 @@ module Runbook
19
21
  def visited?
20
22
  @visited
21
23
  end
24
+
25
+ def parent_entity
26
+ node = self
27
+ while(node && !node.is_a?(Runbook::Entity))
28
+ node = node.parent
29
+ end
30
+ node
31
+ end
22
32
  end
23
33
  end
@@ -2,8 +2,6 @@ module Runbook
2
2
  class Statement < Node
3
3
  include Runbook::Hooks::Invoker
4
4
 
5
- attr_accessor :parent
6
-
7
5
  def render(view, output, metadata)
8
6
  invoke_with_hooks(view, self, output, metadata) do
9
7
  view.render(self, output, metadata)
@@ -15,13 +15,7 @@ module Runbook
15
15
  end
16
16
 
17
17
  def yes?(msg)
18
- begin
19
- prompt.yes?(msg)
20
- rescue TTY::Prompt::ConversionError
21
- err_msg = "Unknown input: Please type 'y' or 'n'."
22
- warn(err_msg)
23
- retry
24
- end
18
+ prompt.yes?(msg)
25
19
  end
26
20
 
27
21
  def output(msg)
@@ -6,7 +6,7 @@ module Runbook::Util
6
6
  def self.load(metadata)
7
7
  title = metadata[:book_title]
8
8
  file = _file(title)
9
- if File.exists?(file)
9
+ if File.exist?(file)
10
10
  msg = "Repo file #{file} detected. Loading previous state..."
11
11
  metadata[:toolbox].output(msg)
12
12
  metadata[:repo] = ::YAML::load_file(file)
@@ -6,7 +6,7 @@ module Runbook::Util
6
6
  def self.load(metadata)
7
7
  title = metadata[:book_title]
8
8
  file = _file(title)
9
- if File.exists?(file)
9
+ if File.exist?(file)
10
10
  ::YAML::load_file(file)
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Runbook
2
- VERSION = "0.16.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -33,18 +33,20 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_runtime_dependency "activesupport", ">= 5.0.1.x", "< 7.0"
35
35
  spec.add_runtime_dependency "method_source", "~> 0.9"
36
- spec.add_runtime_dependency "sshkit", "1.16"
36
+ spec.add_runtime_dependency "sshkit", "1.21.0"
37
37
  spec.add_runtime_dependency "sshkit-sudo", "~> 0.1"
38
38
  spec.add_runtime_dependency "airbrussh", "~> 1.4"
39
39
  spec.add_runtime_dependency "thor", "~> 0.20"
40
40
  spec.add_runtime_dependency "tty-progressbar", "~> 0.14"
41
- spec.add_runtime_dependency "tty-prompt", "~> 0.16"
41
+ spec.add_runtime_dependency "tty-prompt", "~> 0.20"
42
42
 
43
43
  spec.add_development_dependency "appraisal", "~> 2.2"
44
44
  spec.add_development_dependency "aruba", "~> 0.14"
45
45
  spec.add_development_dependency "bundler", "~> 1.15"
46
+ spec.add_development_dependency "bcrypt_pbkdf", ">= 1.0", "< 2.0"
47
+ spec.add_development_dependency "ed25519", ">= 1.2", "< 2.0"
46
48
  spec.add_development_dependency "pry", "~> 0.11"
47
49
  spec.add_development_dependency "pry-byebug", "~> 3.6"
48
- spec.add_development_dependency "rake", "~> 10.0"
50
+ spec.add_development_dependency "rake", "~> 12.3"
49
51
  spec.add_development_dependency "rspec", "~> 3.0"
50
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pblesi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-25 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: '1.16'
53
+ version: 1.21.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: '1.16'
60
+ version: 1.21.0
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sshkit-sudo
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.16'
123
+ version: '0.20'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.16'
130
+ version: '0.20'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: appraisal
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +170,46 @@ dependencies:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
172
  version: '1.15'
173
+ - !ruby/object:Gem::Dependency
174
+ name: bcrypt_pbkdf
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '1.0'
180
+ - - "<"
181
+ - !ruby/object:Gem::Version
182
+ version: '2.0'
183
+ type: :development
184
+ prerelease: false
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '1.0'
190
+ - - "<"
191
+ - !ruby/object:Gem::Version
192
+ version: '2.0'
193
+ - !ruby/object:Gem::Dependency
194
+ name: ed25519
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '1.2'
200
+ - - "<"
201
+ - !ruby/object:Gem::Version
202
+ version: '2.0'
203
+ type: :development
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '1.2'
210
+ - - "<"
211
+ - !ruby/object:Gem::Version
212
+ version: '2.0'
173
213
  - !ruby/object:Gem::Dependency
174
214
  name: pry
175
215
  requirement: !ruby/object:Gem::Requirement
@@ -204,14 +244,14 @@ dependencies:
204
244
  requirements:
205
245
  - - "~>"
206
246
  - !ruby/object:Gem::Version
207
- version: '10.0'
247
+ version: '12.3'
208
248
  type: :development
209
249
  prerelease: false
210
250
  version_requirements: !ruby/object:Gem::Requirement
211
251
  requirements:
212
252
  - - "~>"
213
253
  - !ruby/object:Gem::Version
214
- version: '10.0'
254
+ version: '12.3'
215
255
  - !ruby/object:Gem::Dependency
216
256
  name: rspec
217
257
  requirement: !ruby/object:Gem::Requirement
@@ -253,10 +293,12 @@ files:
253
293
  - bin/console
254
294
  - bin/setup
255
295
  - dockerfiles/Dockerfile-runbook
296
+ - dockerfiles/Dockerfile-sshd
256
297
  - examples/hooks_runbook.rb
257
298
  - examples/layout_runbook.rb
258
299
  - examples/restart_nginx.rb
259
300
  - examples/simple_runbook.rb
301
+ - examples/suppress_capture_output.rb
260
302
  - exe/runbook
261
303
  - gemfiles/.bundle/config
262
304
  - gemfiles/activesupport_5.gemfile