bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Local transport defaults are not applied when using apply_prep

Open donoghuc opened this issue 1 year ago • 0 comments

Describe the Bug

When using the local transport for a target the default behavior is described as using the ruby env shipped with bolt and the puppet-agent feature is set. This only happend on with_connection. When the first action a plan does on a target is apply_prep the targets who need puppet_agents is decided before any actions are run on that target https://github.com/puppetlabs/bolt/blob/f52313e4522be19dbe1662a0c926595c4f43fed5/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb#L98

Therefore these two plans have different results on the local transport:

plan foo(TargetSpec $targets){
  run_command(whoami, $targets)
  apply_prep($targets)
}
plan foo(TargetSpec $targets){
  apply_prep($targets)
}

The first plan correctly assigns the puppet-agent feature to the resolved$targets, then apply prep does not attempt to install an agent. The second plan attempts to install an agent on the target.

Expected Behavior

Defaults should be assigned when targets are resolved so that the expected state is available whenever the target is referenced.

donoghuc avatar May 08 '24 23:05 donoghuc