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

Add a puppet_execution_environment hook method #284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Oct 7, 2020

This makes it easy to run Puppet code in hooks. To achieve this, ExecutionEnvironment also gains build_command. Existing code is refactored to make use of this.

ekohl added 2 commits October 7, 2020 21:25
This makes running a command in an execution environment easier.
This makes it easy to run Puppet code in hooks.
@@ -42,6 +42,13 @@ def configure_puppet(settings = {})
PuppetConfigurer.new(puppet_conf, settings)
end

def build_command(code, options: [], settings: {}, use_answers: false)
Copy link
Member

Choose a reason for hiding this comment

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

I think I might like build_puppet_command to make it clearer to understand what sort of command is being built up. This method signature has the side affect of being able to be read as "build command" a noun rather than build as a verb.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alternative: would command make sense? You would get execution_env.command(code).

Copy link
Member

Choose a reason for hiding this comment

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

Can the command be anything I want? or is it specific to Puppet?

@ekohl
Copy link
Member Author

ekohl commented Oct 7, 2020

Additional context: I had this in my mind when I wrote ExecutionEnvironment but couldn't find the right API so I left it out. I am thinking about dropping PuppetCommand.

For example, append on it is no longer used. If you drop the suffix, it essentially becomes a single method in the public interface.

@ehelms
Copy link
Member

ehelms commented Jul 23, 2023

This would be another good one to get in.

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