Skip to content

Commit 8080be7

Browse files
committed
(GH-3236) Only set ruby env vars on local transport when they exist
Previously we would attempt to use any prior environment variables captured when bolt was invoked by simply looking for those existing. This works when those exist but in the case they did not exist the environment variables were set to empty strings. This makes it impossible to load ruby code (for example to do an apply on local transport). This commit updates the local transport to only set those environment variables if they are explicitly set to something other than an empty string. !bug * **Only set ruby env vars for local transport when non empty strings** ([#3236](#3236)) Previously when using bundled-ruby=false for the local transport and not expliclty setting ruby environment variables internal apply tasks did not work due to ruby code not being able to be loaded. Now the local transport only preserves ruby environment variables when they are set to something other than an empty string.
1 parent ff895e2 commit 8080be7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/bolt/transport/local/connection.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def execute(command)
7373
# Only do this if bundled-ruby is set to false, not nil
7474
ruby_env_vars = if target.transport_config['bundled-ruby'] == false
7575
RUBY_ENV_VARS.each_with_object({}) do |e, acc|
76-
acc[e] = ENV["BOLT_ORIG_#{e}"] if ENV["BOLT_ORIG_#{e}"]
76+
if ENV["BOLT_ORIG_#{e}"] && !ENV["BOLT_ORIG_#{e}"].empty?
77+
acc[e] = ENV["BOLT_ORIG_#{e}"]
78+
end
7779
end
7880
end
7981

0 commit comments

Comments
 (0)