Issue #6635 has been updated by Ben Hughes.
Wonderful, thanks for those.
Having a "/proc/vz/" but no "/proc/vz/version" is how facter desides you're
rocking the openvzve.
Right, after some wrangling I have a working centos 5.5 openvzve system:
<pre>
[root@centosvz ~]# rpm -aq | grep facter
facter-1.5.8-1.el5
[root@centosvz ~]# puppet apply --verbose --noop manifest.pp
notice: Scope(Class[main]): we have virtual as we're openvzve
info: Applying configuration version '1299726302'
notice: Finished catalog run in 0.01 seconds
[root@centosvz ~]# cat manifest.pp
if ( $virtual == "openvzve" ) {
# do something
notice( "we have virtual as we're ${virtual}" )
}
###########################################################
# else is either a real HW, a virtuozzo HW node or VMwar #
###########################################################
else {
notice( "We're install NTP here" )
}
</pre>
And with the RPM for facter you linked to
<pre>
[root@centosvz ~]# facter --version
1.5.8
[root@centosvz ~]# rpm -aq | grep facter
facter-1.5.8-1.el5.rf
[root@centosvz ~]# facter -p virtual
openvzve
[root@centosvz ~]# puppet apply --verbose --noop manifest.pp
notice: Scope(Class[main]): we have virtual as we're openvzve
info: Applying configuration version '1299726361'
notice: Finished catalog run in 0.02 seconds
</pre>
So that's working. So I made a basic manifest, which should hopefully trigger
it too:
<pre>
node 'centosvz.home.gateway' {
if ( $virtual == "openvzve" ) {
notice( "Well, virtual works too" )
file{ "/tmp/ifstatementworks":
content => "$fqdn",
}
}
else {
notice( "this clearly doesn't work...." )
}
file{ "/tmp/virt":
content => "$virtual\n",
ensure => present,
}
}
</pre>
on my 2.6.2 puppetmaster.
<pre>
[root@centosvz ~]# rpm -qa | grep -E "puppet|facter"
puppet-2.6.6-0.1.rc1.el5
facter-1.5.8-1.el5.rf
[root@centosvz ~]# ls /tmp/
[root@centosvz ~]# service puppet start
Starting puppet: [ OK ]
[root@centosvz ~]# ls /tmp/
ifstatementworks virt
[root@centosvz ~]# cat /tmp/virt
openvzve
</pre>
If I restart the vz container, with puppet set to run at startup I still get
the following:
<pre>
[root@centosvz ~]# uptime
14:22:28 up 0 min, 1 user, load average: 0.15, 0.03, 0.01
[root@centosvz ~]# ps axuww | grep puppet
root 9711 9.0 9.6 39652 25400 ? Ssl 14:22 0:00 /usr/bin/ruby
/usr/sbin/puppetd
root 9791 0.0 0.2 3088 712 pts/0 S+ 14:22 0:00 grep puppet
[root@centosvz ~]# ls -la /tmp
total 20
drwxrwxrwt 3 root root 4096 Mar 10 14:22 .
drwxr-xr-x 20 root root 4096 Mar 10 14:22 ..
drwxrwxrwt 2 root root 4096 Mar 10 14:22 .ICE-unix
-rw-r--r-- 1 root root 21 Mar 10 14:22 ifstatementworks
-rw-r--r-- 1 root root 9 Mar 10 14:22 virt
[root@centosvz ~]# cat /tmp/virt
openvzve
</pre>
And trying it with TMZ's RPMs. I get:
<pre>
[root@centosvz ~]# ls -l /tmp/
total 8
-rw-r--r-- 1 root root 21 Mar 10 14:26 ifstatementworks
-rw-r--r-- 1 root root 9 Mar 10 14:26 virt
[root@centosvz ~]# cat /tmp/virt
openvzve
[root@centosvz ~]# rpm -qa | grep -E "puppet|facter"
facter-1.5.8-1.el5
puppet-2.6.6-0.1.rc1.el5
[root@centosvz ~]# uptime
14:26:55 up 0 min, 1 user, load average: 0.14, 0.04, 0.01
</pre>
So I'm afraid I'm not able at all to reproduce this. Could it be being blocked
by something else in either your /etc/puppet/puppet.conf or other manifests
possible?
----------------------------------------
Bug #6635: Facter 1.5.8 seems to not work properly when triggered by the puppet
daemon but works fine when used with puppetd -t
https://projects.puppetlabs.com/issues/6635
Author: Thomas Guthmann
Status: Investigating
Priority: Normal
Assignee:
Category:
Target version:
Keywords: facter virtual set daemon
Branch:
Hi,
Since we upgraded to facter 1.5.8 we had a weird behaviour with puppet. It
seems that in our case $virtual is not set properly (due to environment
variables not set ?). For instance the following logic works fine if we execute
puppetd -t from a shell on a 'openvzve' node however in the background we can
see in the logs of this node that puppet is trying to install ntp and ipmi but
it should not. So it seems that $virtual is not set because it does not enter
any of the other $virtual conditions.
Notes:
- Facter 1.5.7 works fine and does not have this issue. We rollback to this
version to have the correct behaviour again. (homebrew RPM)
- Facter 1.5.8 was a RPM from RPMFORGE
(http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/facter-1.5.8-1.el5.rf.noarch.rpm)
- Puppet 2.6.2 (homebrew RPM)
- Centos 5.5 i386
Code:
###################
# If it is a VE #
###################
if ( $virtual == "openvzve" ) {
# do something
}
###########################################################
# else is either a real HW, a virtuozzo HW node or VMwar #
###########################################################
else {
# All real hardware/Virtuozzo HW node/VMware
include ntp
###################
# if it is VMware #
###################
if ( $virtual == "vmware" ) {
include vmware
}
############################
# else it is real hardware #
############################
else {
# physical only aka real HW or Virtuozzo HW node
include ipmi
# If the hardware is DELL install openmange
if ( $manufacturer == "Dell Inc." ) {
include openmanage
}
# If this is a VZ hardware node
if ( $virtual == "openvzhn" ) {
include virtuozzo
}
}
}
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.