lib/bolt/executor.rb in bolt-1.32.0 vs lib/bolt/executor.rb in bolt-1.33.0
- old
+ new
@@ -216,46 +216,46 @@
rescue StandardError => e
@logger.debug { "Failed to submit analytics event: #{e.message}" }
end
def with_node_logging(description, batch)
- @logger.info("#{description} on #{batch.map(&:uri)}")
+ @logger.info("#{description} on #{batch.map(&:safe_name)}")
result = yield
@logger.info(result.to_json)
result
end
def run_command(targets, command, options = {})
- description = options.fetch('_description', "command '#{command}'")
+ description = options.fetch(:description, "command '#{command}'")
log_action(description, targets) do
- options = { '_run_as' => run_as }.merge(options) if run_as
+ options[:run_as] = run_as if run_as && !options.key?(:run_as)
batch_execute(targets) do |transport, batch|
with_node_logging("Running command '#{command}'", batch) do
transport.batch_command(batch, command, options, &method(:publish_event))
end
end
end
end
def run_script(targets, script, arguments, options = {})
- description = options.fetch('_description', "script #{script}")
+ description = options.fetch(:description, "script #{script}")
log_action(description, targets) do
- options = { '_run_as' => run_as }.merge(options) if run_as
+ options[:run_as] = run_as if run_as && !options.key?(:run_as)
batch_execute(targets) do |transport, batch|
with_node_logging("Running script #{script} with '#{arguments.to_json}'", batch) do
transport.batch_script(batch, script, arguments, options, &method(:publish_event))
end
end
end
end
def run_task(targets, task, arguments, options = {})
- description = options.fetch('_description', "task #{task.name}")
+ description = options.fetch(:description, "task #{task.name}")
log_action(description, targets) do
- options = { '_run_as' => run_as }.merge(options) if run_as
+ options[:run_as] = run_as if run_as && !options.key?(:run_as)
arguments['_task'] = task.name
batch_execute(targets) do |transport, batch|
with_node_logging("Running task #{task.name} with '#{arguments.to_json}'", batch) do
transport.batch_task(batch, task, arguments, options, &method(:publish_event))
@@ -263,12 +263,12 @@
end
end
end
def upload_file(targets, source, destination, options = {})
- description = options.fetch('_description', "file upload from #{source} to #{destination}")
+ description = options.fetch(:description, "file upload from #{source} to #{destination}")
log_action(description, targets) do
- options = { '_run_as' => run_as }.merge(options) if run_as
+ options[:run_as] = run_as if run_as && !options.key?(:run_as)
batch_execute(targets) do |transport, batch|
with_node_logging("Uploading file #{source} to #{destination}", batch) do
transport.batch_upload(batch, source, destination, options, &method(:publish_event))
end