search for: setcode

Displaying 20 results from an estimated 50 matches for "setcode".

Did you mean: retcode
2007 Mar 03
0
Facter recipies
...thing to introspect. The following is what I whipped up... please let me know if I''m doing something poorly; I''ve got just past "hello world" level ruby. :) # debian_version.rb require ''facter'' Facter.add("debian_version") do setcode "cat /etc/debian_version" confine ''operatingsystem'', ''Debian'' end Facter.add("debian_nickname") do confine({ ''operatingsystem'' => ''Debian'', }) dv = Fa...
2011 Aug 25
5
custom fact regex problem
...custom fact should contain qa, ie I want to check in the first part(before the first -) of the hostname if there exists a pattern/word qa and if it exists then my custom fact for envt should be qa. My old envt.rb code is: require ''facter'' Facter.add("envt") do setcode do %x{hostname -s|cut -c 1-2}.chomp end end I am not good with regex/ patterns please help me out guys. Thanks -- 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@go...
2007 Apr 26
2
[PATCH] facter: add interfaces, default_gateway facts on Linux
Quick and dirty: --- lib/facter.rb (revision 203) +++ lib/facter.rb (working copy) @@ -989,6 +989,18 @@ %x{/usr/sbin/scutil --get LocalHostName} end end + Facter.add(:interfaces) do + confine :kernel => :linux + setcode do + %x{/sbin/ifconfig -a -s}.split($/)[1..-1].collect {|line| line.split}.collect {|line| line.first} + end + end + Facter.add(:default_gateway) do + confine :kernel => :linux + setcode do + %x{/bin/netstat -rn}.split(...
2012 Mar 16
3
custom fact issue
...it doesn''t return when called directly via facter --puppet noop, but the resulting facts end up in the reports. I''m at wits end with this. Thanks! <snip> utc_hour = Facter::Util::Resolution.exec(%q</bin/date -u +"%H">).chomp Facter.add(:noop) do setcode do environment = Facter.value(:environment) if environment.match("test|dev|qa") result = false else if utc_hour.match("01|02|03|04|05|06|07|08|09|10")...
2009 Apr 26
5
Factor questions
...gt;/dev/null} query.each_pair do |key,v| v.each do |value| output.split("Handle").each do |line| if line =~ /#{key}/ and line =~ /#{value} (\w.*)\n*./ result = $1 Facter.add(value.chomp('':'')) do confine :kernel => :linux setcode do result end end end end end end end Does this code get executed in the kernel is not Linux, or is the fact just not added is the kernel is not linux? Also, should I bundle the facts into one document, say by platform, or should each fact be in its own file? Than...
2012 Feb 03
16
neatest way to determine a major version of centos/linux?
Just started a rollout of centos 6.x across our Puppet deployment (100-odd servers). what fact would people suggest I use to distinguish 5.x from 6.x (quite a lot of subsystems are different between major releases)? lsb* facts don''t seem to be present on centos 6 - is this an EPEL bug, or have they just been removed in Facter? Thanks! -- You received this message because you are
2007 Aug 18
0
Out of memory error while running puppet
...different things depending whether I''m running on a system that has a Xen kernel or not. I added a fact in /var/lib/puppet/facts/ Facter.add("xen_kernel") do server= `uname -r` if !server.index(''xen'').nil? then setcode "yes" else setcode "no" end end You already may see what the problem is # /usr/sbin/puppetd -vt --factsync warning: Individual config files are deprecated; remove /etc/puppet/puppetd.conf and use puppet.conf info: Loading fact...
2012 Jul 17
8
How to override $::operatingsystem fact
...e "Proxmox" as new value in $::operatingsystem. "Proxmox" is based on Debian, so the normal value is currently "Debian". To change that, I just write a custom fact based on the facter fact "operatingsystem" Facter.add(:operatingsystem) do > ... > setcode do > ... > elsif FileTest.exists?("/usr/bin/pveversion") > "Proxmox" This method doesn''t override the original fact. I''ve also tried to set $::operatingsystem = "Proxmox" directly in my node. What''s the best way to d...
2009 Jan 15
8
Pattern matching in case statement
Hi all, I need my servers to decide which network they are in (i.e. dmz), and the only clue is the servers IP-address. I was trying to accomplish it like this, but it doesn''t work: case $ipaddress { "10.1.1.*": { $network = "net1" } "10.2.2.*.*": { $network = "net2" } "10.3.3.*": {
2013 Feb 21
6
Using Facter to find the Java version running on the machine
Hello all, I am currently trying to setup a Custom Fact that will can be used to determine the version of the Java JRE running on a machine, in order to use it in my manifests to ensure the proper JARS are distribured based on environment. I''m trying to use the java -version command and then capture the JRE release (eg "1.6.0_37"). No matter what I have tried, the output
2011 Jan 07
4
facter --puppet does not report "environment"
Is it normal that "facter --puppet" does not show the environment variable? is there a way to have it include it? Thanks a lot, Mohamed. -- 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
2009 Dec 21
5
custom fact and environment variable
...#39;'s setting only works with test''s setting I''ve recently seen that adding custom fact method has changed so I''ve followed the wiki "plugin in module" to create my own fact. I successfully create this fact : # home.rb Facter.add("home") do setcode do ENV[''HOME''] end end And try unsuccessfully this one : # salle.rb Facter.add("salle") do setcode do ENV[''FACTER_test''] end end Puppet refuse to synchronize my own environments variables unless I run the deamon manually : #puppet...
2013 Aug 28
3
passing hiera data to custom fact
...ment The custom facter code is: # master_ip.rb: # require ''facter'' if FileTest.exists?("/usr/bin/dig") cmd = sprintf(''/usr/bin/dig +short HERE_GOES_THE PARAMETRIC_HOSTNAME'') result = `#{cmd}` Facter.add("master_ip") do setcode { result } end end Any Idea on how to refer to a data present in the module like $master_hostname or a hiera hash like $master_info[''hostname''] Thanks -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscr...
2012 Jan 30
2
SLES11: facter without arguments produces Error: uninitialized constant Facter::IPAddress
...--version ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] test:~ # gem --version 1.3.5 test:~ # puppet --version 2.7.9 test:~ # facter --version 1.6.5 test:~ # facter kernel Linux test:~ # facter ipaddress xx.xx.xxx.xxx (ip address is ok) test:~ # facter The interpreter parameter to ''setcode'' is deprecated and will be removed in a future version. Error: uninitialized constant Facter::IPAddress test:~ # -- 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...
2011 Apr 07
12
Mutliple custom facts not showing in facter
...ll with facter --puppet they are not shown, do I need something special to make them work as any other single custom fact? Master is running 2.6.7 This is a custom fact with two facts in it: [modules/foobar/lib/facter/foobar.rb ] require ''facter'' Facter.add("foo") do setcode do %x{/bin/date +%s}.chomp end end Facter.add("bar") do setcode do %x{/bin/date +%s}.chomp end end I used a simple notify in the node like this: notify{ "custom_fact": message => "foo:$foo bar:$bar"} Tested with Puppet Agent 2.6.2 and 2.6.7 Pulling...
2007 May 11
3
Exception handling in custom facts
...e.chomp buildno = $1 if line =~ /^Build:\s+(\d+)/ end bcrelease.close print "#{buildno}\n" rescue print "No file?\n" end Works fine. However, in a custom fact the rescue clause doesn''t quite do it for me: Facter.add("buildno") do setcode do begin buildno = '''' bcrelease = open("/etc/BCrelease") while (line = bcrelease.gets) line = line.chomp buildno = $1 if line =~ /^Build:\s+(\d+)/ end bcrelease.close...
2005 Jul 23
3
[LLVMdev] How to partition registers into different RegisterClass?
...se the instruction cannot contain an immediate value, a constant value may be stored in a constant register, and it's defined _before_ the program starts by API. For example: SetConstantValue( 5, Vector4( 1, 2, 3, 4 ); // C5 = <1,2,3,4> HANDLE handle = LoadCodeFromFile( filename ); SetCode( handle ); // C5 is referenced here Execute(); -- Tzu-Chien Chiu, 3D Graphics Hardware Enginner, <URL:http://www.csie.nctu.edu.tw/~jwchiu>
2007 Jun 08
5
Help needed with a basic recipe
Can anyone point me to a "Writing Puppet recipes for Dummies" doc? I''m trying to do a basic probe using lspci to see if I have a Qlogic HBA installed on the machine, and if so, install the Qlogic scli package. Here''s a shell script of what I''m trying to do: #!/bin/bash vendor=1077 # QLogic model=2422 # 24xx hba /sbin/lspci -n -d $vendor:$model | grep
2010 Jul 19
1
facter fails to recognize OEL/OVS in operatingsystemrelease.rb
...elease.rb.orig 2010-07-19 12:34:26.000000000 -0700 --- /usr/lib/ruby/site_ruby/1.8/facter/operatingsystemrelease.rb 2010-07-19 12:33:25.000000000 -0700 *************** *** 1,5 **** Facter.add(:operatingsystemrelease) do ! confine :operatingsystem => %w{CentOS Fedora oel ovs RedHat} setcode do case Facter.value(:operatingsystem) when "CentOS", "RedHat" --- 1,5 ---- Facter.add(:operatingsystemrelease) do ! confine :operatingsystem => %w{CentOS Fedora oel OEL ovs OVS RedHat} setcode do case Facter.value(:operatingsystem)...
2011 Jun 30
4
using memorysize fact in manifests
Hi, I want some config depending on memorysize. What I tried was if ($memorysize >= 256 * 1024*1024) { ... } But this fails because $memorysize is a string (and contains a "G") and can''t be compared to an int. Are all facts strings? How do I work with numbers? regards, Andreas -- Andreas Kuntzagk SystemAdministrator MDC Berlin / BIMSB Tel.: +49 30 9406 2997 --