diff --git a/lib/bolt/inventory/target.rb b/lib/bolt/inventory/target.rb index abec9ce4a..0496c37b3 100644 --- a/lib/bolt/inventory/target.rb +++ b/lib/bolt/inventory/target.rb @@ -34,7 +34,7 @@ def initialize(target_data, inventory) @name = @uri @safe_name = @uri_obj.omit(:password).to_str.sub(%r{^//}, '') end - + # handle special localhost target if @name == 'localhost' default = { 'config' => { 'transport' => 'local' } } target_data = Bolt::Util.deep_merge(default, target_data) @@ -53,6 +53,8 @@ def initialize(target_data, inventory) @inventory = inventory validate + # after setting config, apply local defaults when using bundled ruby + set_local_defaults if transport_config['bundled-ruby'] end def set_local_defaults diff --git a/lib/bolt/target.rb b/lib/bolt/target.rb index 1b445eebe..9a84d83f0 100644 --- a/lib/bolt/target.rb +++ b/lib/bolt/target.rb @@ -80,10 +80,6 @@ def resources inventory_target.resources end - def set_local_defaults - inventory_target.set_local_defaults - end - # rubocop:disable Naming/AccessorMethodName def set_resource(resource) inventory_target.set_resource(resource) diff --git a/lib/bolt/transport/local.rb b/lib/bolt/transport/local.rb index b574d9c63..390554d0a 100644 --- a/lib/bolt/transport/local.rb +++ b/lib/bolt/transport/local.rb @@ -11,10 +11,6 @@ def connected?(_target) end def with_connection(target) - if target.transport_config['bundled-ruby'] - target.set_local_defaults - end - yield Connection.new(target) end end