Puppet/Facter Question: How to determine if you are running puppet in chroot environment

  |   Source

Update: solved


Solution:

Thanks to Daniel Pittman from Puppetlabs, the solution is really easy.

export FACTER_chroot=whatever
chroot puppetd -vdt --waitforcert 60 -l /var/log/puppetrun.log

Eh voila, facter gives you the $chroot facter lib, and you can use it in your manifests.

Thanks again, Daniel, you made a happy puppet user even more happier :)



Dear Lazyweb,

Think about running puppet in chroot environment.

Your repices were written to trigger some resource deployment when a service resource (using sysV, upstart, systemd) says "Yes, I'm running".

But normally starting a service inside a chroot via upstart should fail, therefor your dependency won't be triggered.

Now, we have facter, and facter is a nice tool to actually determine if you are deploying on a real hardware, or a virtual machine (like on ESX or other solutions).

But, honestly, I didn't find any facter variable which tells me: "Yes, this is a chroot".

And right now, it's already late, I don't find a good solution how to determine, that I'm doing some work inside a chroot and not on the live system.

Dear Lazyweb, if you know a good solution (facter plugin, whatever) please leave a comment.

Thank you in advance.