Ask Your Question
0

External fact written in bash failing on Windows

asked 2015-11-20 06:59:18 -0500

mark gravatar image

Hi,

In order to extend the facts from facter, I included an external fact written in bash. As I named the file 'ldap.sh', it provides the data perfectly on Linux agents. Unfortunately it is also executed on our Windows agents, showing the following error message :

Fact file C:/ProgramData/PuppetLabs/puppet/var/facts.d/ldap.sh was parsed but returned an empty data set

Environment is running PE 3.8.1.

Questions :

  • Is there any way to restrict this external fact to only execute on Linux based agents, without converting it to a custom fact written in Ruby?
  • Does this mean PE would also try to run a powershell script on Linux?

Thank you in advance.

Kind regards, Mark

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-20 17:45:15 -0500

Iristyle gravatar image

Mark -

Facter returns a misleading message under these circumstances thanks to the code at https://github.com/puppetlabs/facter/...

Fortunately, you can safely ignore it, as Facter isn't actually trying to execute the files (though it may seem that way). For some more detail on this issue affecting Facter 2.x, please have a look at https://tickets.puppetlabs.com/browse...

Note that in the rewritten native version of Facter (Facter 3.x), which is shipped with PE 2015.2.0 and above (the next major version beyond PE 3.8.x series), this is no longer a problem.

Thanks!

edit flag offensive delete link more

Comments

Hi Iristyle, Thanks you for the answer and insight. In the link you provided I read about a workaround for Powerhell scripts on Linux (makes sense to use #!/bin/false as interpreter, as Powershell will see # as comment). Do you by any chance know of a workaround for so bash scripts aren't executed

mark gravatar imagemark ( 2015-11-21 06:14:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-20 06:59:18 -0500

Seen: 104 times

Last updated: Nov 20 '15