lib/bolt/config.rb in bolt-1.12.0 vs lib/bolt/config.rb in bolt-1.13.0
- old
+ new
@@ -34,34 +34,12 @@
:transport, :transports, :inventoryfile, :compile_concurrency
attr_writer :modulepath
TRANSPORT_OPTIONS = %i[password run-as sudo-password extensions
private-key tty tmpdir user connect-timeout
- cacert token-file service-url].freeze
+ cacert token-file service-url interpreters file-protocol smb-port].freeze
- # TODO: move these to the transport themselves
- TRANSPORT_SPECIFIC_DEFAULTS = {
- ssh: {
- 'connect-timeout' => 10,
- 'host-key-check' => true,
- 'tty' => false
- },
- winrm: {
- 'connect-timeout' => 10,
- 'ssl' => true,
- 'ssl-verify' => true
- },
- pcp: {
- 'task-environment' => 'production'
- },
- local: {},
- docker: {},
- remote: {
- 'run-on' => 'localhost'
- }
- }.freeze
-
def self.default
new(Bolt::Boltdir.new('.'), {})
end
def self.from_boltdir(boltdir, overrides = {})
@@ -89,12 +67,13 @@
# add an entry for the default console logger
@log = { 'console' => {} }
@transports = {}
- TRANSPORTS.each_key do |transport|
- @transports[transport] = TRANSPORT_SPECIFIC_DEFAULTS[transport].dup
+
+ TRANSPORTS.each do |key, transport|
+ @transports[key] = transport.default_options
end
update_from_file(config_data)
apply_overrides(overrides)
@@ -112,10 +91,16 @@
def deep_clone
Bolt::Util.deep_clone(self)
end
+ def normalize_interpreters(interpreters)
+ Bolt::Util.walk_keys(interpreters) do |key|
+ key.chars[0] == '.' ? key : '.' + key
+ end
+ end
+
def normalize_log(target)
return target if target == 'console'
target = target[5..-1] if target.start_with?('file:')
'file:' + File.expand_path(target)
end
@@ -166,10 +151,13 @@
end
TRANSPORTS.each do |key, impl|
if data[key.to_s]
selected = impl.filter_options(data[key.to_s])
- @transports[key].merge!(selected)
+ @transports[key] = Bolt::Util.deep_merge(@transports[key], selected)
+ end
+ if @transports[key]['interpreters']
+ @transports[key]['interpreters'] = normalize_interpreters(@transports[key]['interpreters'])
end
end
end
private :update_from_file