Skip to content

Fixes #31022 - Use an isolated Puppet environment#585

Open
ekohl wants to merge 1 commit intotheforeman:developfrom
ekohl:31022-isolated-puppet-env-hooks
Open

Fixes #31022 - Use an isolated Puppet environment#585
ekohl wants to merge 1 commit intotheforeman:developfrom
ekohl:31022-isolated-puppet-env-hooks

Conversation

@ekohl
Copy link
Member

@ekohl ekohl commented Oct 7, 2020

When there's splay=true in /etc/puppetlabs/puppet/puppet.conf, puppet apply waits a random period (up to 30 minutes). Kafo deals with this by using --config=/tmp/.../puppet.conf which is generated in the ExecutionEnvironment. The boot hook apply_puppet_code does not use this which causes the host's puppet.conf to take effect. This can lead to much longer installer times where it just sleeps.

This patch uses the new puppet_execution_environment hook method to get a clean enviroment. It also respects noop from the app_value which it previously didn't.

Alternative to #584 but requires theforeman/kafo#284.

When there's splay=true in /etc/puppetlabs/puppet/puppet.conf, puppet
apply waits a random period (up to 30 minutes). Kafo deals with this by
using --config=/tmp/.../puppet.conf which is generated in the
ExecutionEnvironment. The boot hook apply_puppet_code does not use this
which causes the host's puppet.conf to take effect. This can lead to
much longer installer times where it just sleeps.

This patch uses the new puppet_execution_environment hook method to get
a clean enviroment. It also respects noop from the app_value which it
previously didn't.
def apply_puppet_code(code)
bin_path = Kafo::PuppetCommand.search_puppet_path('puppet')
Open3.capture3(*Kafo::PuppetCommand.format_command("echo \"#{code}\" | #{bin_path} apply --detailed-exitcodes"))
def apply_puppet_code(code, use_noop=true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this whole thing would live in Kafo to be honest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of, but I wasn't sure how things would behave if you have multiple definitions of that. I'd still be open to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants