Facter - custom fact, returns empty data set when invoked by Puppet agent
- by user3684494
According to this puppet labs article, I can create custom facts from shell scripts.
I have created a bash script that returns a single fact, it is packaged in a modules facts.d directory. The module is included on the target system via an ENC class. When invoked by the puppet agent on the target it returns an empty set, when run by hand on the agent it correctly returns the fact. The script has execute permission on the master, but does not have it on the agent.
I saw a bug report related to permissions and file types, but that was windows and supposed to be fixed in puppet version 3.
What am I doing wrong?
ENC definition:
---
classes:
facttest:
Shell script:
#!/bin/bash
echo "test_fact1=$(hostname)"
Permissions:
master: -rwxr-xr-x 1 root root ... modules/facttest/facts.d/testfact.sh
agent: -rw-r--r-- 1 root root ... /var/lib/puppet/facts.d/testfact.sh
Agent message:
Fact file /var/lib/puppet/facts.d/testfact.sh was parsed but returned an empty data set
Version information:
Puppet master: 3.5.1 (Debian)
Facter master: 2.0.1
Puppet agent: 3.6.1 (OpenSUSE)
Facter agent: 2.0.1