Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PE-31696) Prefer builtin lib code over external gems when autoloading #8685

Closed
wants to merge 1 commit into from

Conversation

donoghuc
Copy link
Member

@donoghuc donoghuc commented Jul 8, 2021

In PE we use the ruby interpreter shipped with puppet agent to run the ace server. The ace server is responsible for executing remote tasks. Remote tasks will often use the puppet library. Remote ruby tasks run in ace over the local transport (and thus bolt) execute code with the same environment variables as the ruby process running the task runner uses. In the case of ace, we ship a puppet gem in addition to many of the other gems bolt depends on. 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). This commit updates the autoloader to prefer loading code from the $LOAD_PATH. This helps solve the problem of loading code from both places in ace-server for remote tasks. The only consequence it may have would be if users somehow relied on shadowing shipped puppet code with external gems, though it is hard to imagine how they would manage to reliably configure this.

In PE we use the ruby interpreter shipped with puppet agent to run the ace server. The ace server is responsible for executing remote tasks. Remote tasks will often use the `puppet` library. Remote ruby tasks run in ace over the local transport (and thus bolt) execute code with the same environment variables as the ruby process running the task runner uses. In the case of ace, we ship a puppet gem in addition to many of the other gems bolt depends on. 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). This commit updates the autoloader to prefer loading code from the $LOAD_PATH. This helps solve the problem of loading code from both places in ace-server for remote tasks. The only consequence it may have would be if users somehow relied on shadowing shipped puppet code with external gems, though it is hard to imagine how they would manage to reliably configure this.
@joshcooper
Copy link
Contributor

joshcooper commented Jul 16, 2021

Changing the order makes my nervous given all the different ways code can be loaded in puppet agent, server, bolt, ...

Prior to relative requires, which version of puppet was ace server using (the one from puppet-agent or the gem version it depended on)? It might be good to sync up on this one, as I'm not sure I followed all of the ace logic.

@CLAassistant
Copy link

CLAassistant commented Sep 1, 2021

CLA assistant check
All committers have signed the CLA.

@lucywyman
Copy link
Contributor

Is this still an issue now that https://github.com/puppetlabs/bolt-vanagon/pull/170/files is merged?

@donoghuc
Copy link
Member Author

donoghuc commented Oct 6, 2021

Yeah, I was never able to get it to work with that change 😢

@lucywyman
Copy link
Contributor

Closing this in favor of puppetlabs/ace#99

@lucywyman lucywyman closed this Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants