puppetlabs / puppet-specifications

Specification of the Puppet Language, Catalog, Extension points
Other
99 stars 66 forks source link

clarify PATH expectations tasks should have #114

Open ripienaar opened 6 years ago

ripienaar commented 6 years ago

At present there is no mention of what should and should not be in the PATH for tasks to rely on, the Apache task has this:

https://github.com/puppetlabs/puppetlabs-apache/blob/e587f2af793111adab04bb776808f99a09ca092b/tasks/init.rb#L8

Here it relies on facter being in the path which only works in PE because apparently PE links facter to /usr/local/bin - something puppet-agent does not do.

It probably works under ssh bolt because that reads the profile files that may or may not exist on the node

It all kind of seems to work by accident rather than clear specification.

A quick chat on Slack about this suggested that probably tasks should not expect PATH to have anything and should use full paths for most things like here:

https://github.com/puppetlabs/puppetlabs-facter_task/blob/32658a05a6080c35505267184b9a14a1ef6d8768/tasks/init.rb#L21

adreyer commented 6 years ago

This is already vaguely covered in:

The operating environment the task is executed in (such as environment variables set and user privilege) is also controlled by the task runner. Task authors should document any requirements they have.
ripienaar commented 6 years ago

Not sure how that guidance would have avoided this issue