lib/bolt_ext/server.rb in bolt-1.0.0 vs lib/bolt_ext/server.rb in bolt-1.1.0

- old
+ new

@@ -1,9 +1,10 @@ # frozen_string_literal: true require 'sinatra' require 'bolt' +require 'bolt/target' require 'bolt/task' require 'json' require 'json-schema' class TransportAPI < Sinatra::Base @@ -48,11 +49,13 @@ body = JSON.parse(request.body.read) schema_error = JSON::Validator.fully_validate(@schemas["ssh-run_task"], body) return [400, schema_error.join] if schema_error.any? - keys = %w[user password port ssh-key-content connect-timeout run-as-command run-as - tmpdir host-key-check known-hosts-content private-key-content sudo-password] + # CODEREVIEW: the schema is additionalProperties false do we need this? + keys = %w[user password port connect-timeout run-as-command run-as + tmpdir host-key-check known-hosts-content private-key-content sudo-password + tty] opts = body['target'].select { |k, _| keys.include? k } if opts['private-key-content'] opts['private-key'] = { 'key-data' => opts['private-key-content'] } opts.delete('private-key-content')