Matthew Nicholson
2011-Aug-26 14:12 UTC
[Puppet Users] issues with a custom fact, runs fine manually, not via the puppet service...
I think i''m missing something small...
So, I''ve got a couple custom facts, this is the one I''m
dealing with now:
if Facter.value("compute_node") == "true"
Facter.add("lsf_queues") do
setcode do
hostname = Facter.value("hostname")
queues
Facter::Util::Resolution.exec(''/lsf/7.0/linux2.6-glibc2.3-x86_64/bin/bqueues
-m '' + hostname + '' -w | grep -v QUEUE | grep -v \^priority |
cut -d " " -f
1'')
lsf_queues=Array.new
queues.each do |line|
lsf_queues.push(line)
end
lsf_queues=lsf_queues.join(",")
lsf_queues
end
end
end
Basically, checked another custom fact to see if we''re working on a
compute
node (true/false), and if so, tried to findout what queues target this node.
I can run puppet agent -t , and see it load the fact, run it, and it
returns a good value and everything to out foreman instance. All is happy.
But, once i made this live, everything that has got it has failed to send a
report, BUT, if i logon a node and run puppet, all is well. So there is some
difference between me running puppet as root with this fact in place, and it
running out of the service. Now, I ''d normally su/sudo -u to the puppet
user, but its not a shell user, so I can''t execute this as the puppet
user...
Any ideas on why this isn''t working and/or how to run this in the same
way
the service runs to I can see whats going wrong when invoked that way?
--
Matthew Nicholson
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Matthew Nicholson
2011-Aug-26 19:15 UTC
[Puppet Users] Re: issues with a custom fact, runs fine manually, not via the puppet service...
Following up on my own question, I''m closer but not there: The fact no longer breaks a puppet run. On a node, facter -p shows my fact. It is not, however, in the report sent to my master, nor in the yaml file for the host. However, if i run puppet manually (puppet agent -t), once it finishes, it is ONLY then in the report/yaml. Why would this happen? Matt On Fri, Aug 26, 2011 at 10:12 AM, Matthew Nicholson < matthew.a.nicholson@gmail.com> wrote:> > I think i''m missing something small... > > So, I''ve got a couple custom facts, this is the one I''m dealing with now: > > if Facter.value("compute_node") == "true" > Facter.add("lsf_queues") do > setcode do > hostname = Facter.value("hostname") > queues > Facter::Util::Resolution.exec(''/lsf/7.0/linux2.6-glibc2.3-x86_64/bin/bqueues > -m '' + hostname + '' -w | grep -v QUEUE | grep -v \^priority | cut -d " " -f > 1'') > lsf_queues=Array.new > queues.each do |line| > lsf_queues.push(line) > end > lsf_queues=lsf_queues.join(",") > lsf_queues > end > end > end > > Basically, checked another custom fact to see if we''re working on a compute > node (true/false), and if so, tried to findout what queues target this node. > I can run puppet agent -t , and see it load the fact, run it, and it > returns a good value and everything to out foreman instance. All is happy. > > But, once i made this live, everything that has got it has failed to send a > report, BUT, if i logon a node and run puppet, all is well. So there is some > difference between me running puppet as root with this fact in place, and it > running out of the service. Now, I ''d normally su/sudo -u to the puppet > user, but its not a shell user, so I can''t execute this as the puppet > user... > > Any ideas on why this isn''t working and/or how to run this in the same way > the service runs to I can see whats going wrong when invoked that way? > > > -- > Matthew Nicholson >-- Matthew Nicholson -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.