This message was deleted.
# puppet-enterprise
s
This message was deleted.
b
Can you share the fact?
a common issue is that some environment variables are missing when stuff is executed via cron
i
This was working until last couple of days and nothing has been changed.
Here is the fact. On the server, it’s being displayed. However, on the UI, it doesn’t exists @bastelfreak
b
can you share the actual code?
otherwise I cannot debug it 🙂
does that only happen on linux or also windows?
i
Only on Linux. Recently, we promoted the powerbroker module where it says if pbversion is older then upgrade it.
Here is the fact code: Facter.add(“pbversion”) do confine :kernel => :linux setcode do if File.exist? ‘/etc/pb.cfg’ Facter:Util:Resolution.exec(‘pbrun -v 2>&1 | grep -o \’Version [0-9.-]*\’ | awk \’{print $2}\’’) else %x{echo absent}.chomp end end end
b
do you have multiple environments? is it possible that the node run in a different environmnent where the fact was missing?
i
The node is pointing to the right environment.
b
I'm not sure what the fact returns when
Facter::Util::Resolution.exec
doesn't return anything
maybe
pbrun
returns something odd and then the fact isn't present
i
The fact is returning the right value on the server. However, on the UI console, the fact is missing until we run puppet manually again
b
yes
maybe
pbrun
depends on some environment variables or needs a login shell
i
One thing we changed in the fact code is the way we’re getting the version. Previously, we were using the below instead of Facter::Util. %x{grep inst_manifest_version /etc/pb.cfg | awk -F ‘=‘ ‘{print $2}’ | tr -d “‘“}.chomp
@bastelfreak
b
again my question stands, does
pbrun
require a login shell or environment variables
and why did you change it?
i
pbrun doesn’t require any login shell. The reason we changed is that old logic wasn’t working for the newer version.
b
then it probably requires environment variables
i
Once we run puppet manually, everything is BAU.
Also, when I run puppet facts upload —onetime it’s uploading facts and I can see the pbversion fact on the UI.
As you said, I’m suspecting issue with the pbrun. I just test the pbrun command through cron and it’s not showing me anything but when I run the same command manually, it’s showing me the version
Found the issue, I have to give the full path for the pbrun
b
told you, environment variables
the PATH is different in your cron environment
i
I see the path exists in the environment variable $PATH
Got it. The cron path variable works differently compare to the USER path variable. 🙂