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

Usage of puppet in custom alertmanager fact breaks if puppet not in $PATH (e.g. systemd service) #130

Closed
achermes opened this issue Dec 15, 2017 · 1 comment

Comments

@achermes
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.8
  • Ruby:2.0.0p648 (2015-12-16) [x86_64-linux] (that's the system ruby)
  • Distribution: CentOS Linux release 7.4.1708 (Core)
  • Module version: 3.1.0

How to reproduce (e.g Puppet code you use)

Using a puppet master/agent architecture

  • Install the puppet/prometheus module on the master
  • Run puppet agent on an agent node as part of a service, e.g. systemd service

As soon as he prometheus module is installed in an environment he custom fact will be collected on master and agents, triggering the bug.

What are you seeing

When attempting to collect the custom prometheus_alert_manager_running fact an error occurs:

(Facter) error while resolving custom fact "prometheus_alert_manager_running": execution of command "puppet resource service alert_manager 2>&1" failed: command not found.

What behaviour did you expect instead

No error - fact collected as normal.

Output log

see above

Any additional information you'd like to impart

I think this error is down to the fact that puppet is not in the PATH when puppet runs as part of the service. The default systemd service file that comes with the puppetlabs collections does not insert /opt/puppetlabs/bin into the PATH of the service file.
In contrast, the same collection does add a drop-in at /etc/profile.d/ to ensure login-shells do have puppet in the path (so running the command from the fact from a login shell works fine).

I would suggest the fix is to put in the full path of the puppet binary into the fact - ideally there's some way of fetching that inside Facter.

@roidelapluie
Copy link
Member

closed by #131

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants