Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(hack) Unset GEM_PATH and GEM_HOME when running local tasks
In PE we use the Ruby interpreter shipped with the Puppet Agent to run the ace server. The ace server is responsible for executing remote tasks. Remote tasks will often use the puppet library, and run in ACE using the local transport. Now that puppet has moved to using require_relative there is a bug whereby a new combination of code is loaded between the Puppet gem and the Puppet code shipped with the agent (because we set GEM_HOME and GEM_PATH when we start the service). As a workaround, this commit uses the `BOLT_ORIG` environment variable mechanism in Bolt to configure the Ruby environment that the task itself will run in (and not the ruby code that's *running* the task). ACE can unset the GEM_PATH and GEM_HOME environment variable so that `Gem.specifications` in the Puppet autoloader is empty, and loads from the `$LOAD_PATH` first (which can be added to using the `RUBYLIB` environment variable). Then, ACE uses `BOLT_ORIG_RUBYLIB` to append the Gem load paths to the LOAD_PATH so that the dependencies are still available. This is *very* much a hack, but this problem is also somewhat limited in scope.
- Loading branch information