Skip to content

Add a puppet_execution_environment hook method#284

Open
ekohl wants to merge 2 commits into
theforeman:masterfrom
ekohl:expand-execution-env
Open

Add a puppet_execution_environment hook method#284
ekohl wants to merge 2 commits into
theforeman:masterfrom
ekohl:expand-execution-env

Conversation

@ekohl

@ekohl ekohl commented Oct 7, 2020

Copy link
Copy Markdown
Member

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.
PuppetConfigurer.new(puppet_conf, settings)
end

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

ekohl commented Oct 7, 2020

Copy link
Copy Markdown
Member Author

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

ehelms commented Jul 23, 2023

Copy link
Copy Markdown
Member

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