bolt 1.13.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66234162abaa83dd3dd590b21dd87a54d10c3da44f0d50ccd8e28d82ddf76178
4
- data.tar.gz: b056cb53e8fda46db48b7a7a1b63f8441f80342e11e5c0a7c50d1813cf852bbc
3
+ metadata.gz: bfc3f29c5078b142ebcebf3b104d0b8c1deb2357c319f1de58c270062c7db68c
4
+ data.tar.gz: '083d0c5d89a44757eb875c92d88e4378ea1922921aad4a225f8dda2b3e1cb0d5'
5
5
  SHA512:
6
- metadata.gz: '079515ce4801e6913e2b75d276289985cf9eda0d9b60c10021a5b435c77ce69d0cc07d5a1708a4f7c43db4947fef918f5d14b8ccac8fdf6a55b5ccf5fce6cf62'
7
- data.tar.gz: 94eba8ff4a83d463f4b5516eb69cd83d31b1fdc6c3673a0b0beda9ac5dc08becd9eb2d75953932c57345ab8099900884174df329d04f43637802df73a538a365
6
+ metadata.gz: f380074432d77f88c782dd725bc6f835c707de52266fb1c030a0b7490fd06af98b984d6f42bd1a02fde367d573ebf25a7fb1dfe6c5c643f613b8336444fb3f8e
7
+ data.tar.gz: 70b9128e64a00ee9efab71ad69937b61fcd5ed54c6ee787054942e3b3fd16060e7dd34c23ab10e50b0c02969cc7b8a47f2fc0c25a65a0911144887baf4456fc3
@@ -95,15 +95,6 @@ module Bolt
95
95
  interpreters[Pathname(executable).extname] if interpreters
96
96
  end
97
97
 
98
- def reject_transport_options(target, options)
99
- if target.options['run-as']
100
- options.reject { |k, _v| k == '_run_as' }
101
- else
102
- options
103
- end
104
- end
105
- private :reject_transport_options
106
-
107
98
  # Transform a parameter map to an environment variable map, with parameter names prefixed
108
99
  # with 'PT_' and values transformed to JSON unless they're strings.
109
100
  def envify_params(params)
@@ -135,7 +126,7 @@ module Bolt
135
126
  target = targets.first
136
127
  with_events(target, callback) do
137
128
  @logger.debug { "Running task run '#{task}' on #{target.uri}" }
138
- run_task(target, task, arguments, reject_transport_options(target, options))
129
+ run_task(target, task, arguments, options)
139
130
  end
140
131
  end
141
132
 
@@ -149,7 +140,7 @@ module Bolt
149
140
  target = targets.first
150
141
  with_events(target, callback) do
151
142
  @logger.debug("Running command '#{command}' on #{target.uri}")
152
- run_command(target, command, reject_transport_options(target, options))
143
+ run_command(target, command, options)
153
144
  end
154
145
  end
155
146
 
@@ -163,7 +154,7 @@ module Bolt
163
154
  target = targets.first
164
155
  with_events(target, callback) do
165
156
  @logger.debug { "Running script '#{script}' on #{target.uri}" }
166
- run_script(target, script, arguments, reject_transport_options(target, options))
157
+ run_script(target, script, arguments, options)
167
158
  end
168
159
  end
169
160
 
@@ -177,7 +168,7 @@ module Bolt
177
168
  target = targets.first
178
169
  with_events(target, callback) do
179
170
  @logger.debug { "Uploading: '#{source}' to #{destination} on #{target.uri}" }
180
- upload(target, source, destination, reject_transport_options(target, options))
171
+ upload(target, source, destination, options)
181
172
  end
182
173
  end
183
174
 
@@ -142,6 +142,7 @@ module Bolt
142
142
  stdin, output = nil
143
143
  command = []
144
144
  execute_options = {}
145
+ execute_options[:interpreter] = select_interpreter(executable, target.options['interpreters'])
145
146
 
146
147
  conn.with_remote_tempdir do |dir|
147
148
  if extra_files.empty?
@@ -167,7 +168,9 @@ module Bolt
167
168
  end
168
169
 
169
170
  if conn.run_as && stdin
170
- wrapper = make_wrapper_stringio(remote_task_path, stdin)
171
+ # Inject interpreter in to wrapper script and remove from execute options
172
+ wrapper = make_wrapper_stringio(remote_task_path, stdin, execute_options[:interpreter])
173
+ execute_options.delete(:interpreter)
171
174
  remote_wrapper_path = conn.write_remote_executable(dir, wrapper, 'wrapper.sh')
172
175
  command << remote_wrapper_path
173
176
  else
@@ -177,7 +180,6 @@ module Bolt
177
180
  dir.chown(conn.run_as)
178
181
 
179
182
  execute_options[:sudoable] = true if conn.run_as
180
- execute_options[:interpreter] = select_interpreter(executable, target.options['interpreters'])
181
183
  output = conn.execute(command, execute_options)
182
184
  end
183
185
  Bolt::Result.for_task(target, output.stdout.string,
@@ -187,13 +189,22 @@ module Bolt
187
189
  end
188
190
  end
189
191
 
190
- def make_wrapper_stringio(task_path, stdin)
191
- StringIO.new(<<-SCRIPT)
192
+ def make_wrapper_stringio(task_path, stdin, interpreter = nil)
193
+ if interpreter
194
+ StringIO.new(<<-SCRIPT)
195
+ #!/bin/sh
196
+ '#{interpreter}' '#{task_path}' <<'EOF'
197
+ #{stdin}
198
+ EOF
199
+ SCRIPT
200
+ else
201
+ StringIO.new(<<-SCRIPT)
192
202
  #!/bin/sh
193
203
  '#{task_path}' <<'EOF'
194
204
  #{stdin}
195
205
  EOF
196
206
  SCRIPT
207
+ end
197
208
  end
198
209
 
199
210
  def connected?(target)
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '1.13.0'
4
+ VERSION = '1.13.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '2.6'
179
+ version: '3.1'
180
180
  type: :runtime
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '2.6'
186
+ version: '3.1'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: ruby_smb
189
189
  requirement: !ruby/object:Gem::Requirement