Re: [Puppet Users] Creating user with random password (only once)
Hey, There is also this: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/random_password.rb KW On Tuesday, October 30, 2012 1:39:35 PM UTC, Ygor wrote: The package expect contains a script/binary called mkpasswd that I find very appropriate for making passwords. Here's its man-page: http://linux.die.net/man/1/mkpasswd -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/rL3ZUwnQpYUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: is_virtual selector
Hi, No idea, to be honest. Works for me in 2.7 family without problems. The code I gave you was originally yours, I just added call to the function :) KW On Saturday, October 6, 2012 2:42:25 AM UTC+1, Matt wrote: Thanks Krzysztof. It successfully runs now, but output is misleading on subsequent runs: build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349482471' /Stage[main]/Baseline-testing::Ntpd/Package[ntp]/ensure: ensure changed '4.2.4p8-2.el6' to 'purged' Finished catalog run in 6.10 seconds build ~]# build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349482471' /Stage[main]/Baseline-testing::Ntpd/Package[ntp]/ensure: created Finished catalog run in 1.10 seconds build ~]# build ~]# rpm -q ntp package ntp is not installed The only class being called for the 'build' node is 'baseline-testing::ntpd', which only ensures that the NTP package is removed (the 8 lines of code you recommended). It does remove the package, but I don't know why it mentions creating it upon the second run, even though it does not actually get re-installed. Maybe traditional 'if' statements are advised. ~Matt On Friday, October 5, 2012 11:09:03 AM UTC-4, Krzysztof Wilczynski wrote: Hey, This selector expects to get a true boolean value e.g. true / false (TrueClass / FalseClass in Ruby) and that is why it is failing, since you are passing a string true from the fact (and all values coming from Facter are strings, even numeric values). Grab this: https://raw.github.com/kwilczynski/puppet-functions/master/lib/puppet/parser/functions/str2bool.rb And then try: class baseline-testing::ntpd { package { ntp: ensure = str2bool($is_virtual) ? { false = present, true = purged } } } Hope that helps :) KW On Wednesday, October 3, 2012 2:43:01 AM UTC+1, Matt wrote: I too have been pushed into Puppet 3.0. Clients and PuppetMaster are now at 3.0.0. Not sure if this is a version change or syntax error that I am experiencing. We'll use 'ntp' as the example and the build host is a VM. The old way: class baseline::ntpd { package { ntp: ensure = $virtual ? { physical = present, vmware = purged, default = present } } On the client, it always says that it is created, even though it's not present: [root@build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349227476' /Stage[main]/Baseline::Ntpd/Package[ntp]/ensure: created Finished catalog run in 1.46 seconds [root@build ~]# [root@build ~]# rpm -q ntp package ntp is not installed [root@build ~]# When trying the $is_virtual facter.. class baseline-testing::ntpd { package { ntp: ensure = $is_virtual ? { false = present, true = purged } } } On client: [root@build ~]# puppet agent -tv Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: No matching value for selector param 'true' at /etc/puppet/manifests/classes/baseline_linux-testing.pp:35 on node build [root@build ~]# [root@build ~]# facter | grep virtual is_virtual = true virtual = vmware -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uXJCmQELCTwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Concatanating result of custom function to a string
Hey, I think, you might be over-thinking this a little :) KW On Saturday, October 6, 2012 11:41:09 AM UTC+1, Amos Shapira wrote: Hello, I'm working on execution of puppet's puppet cert generate ...--dns_alt_names=name1,name2,name2 using Puppet 2.7.19 and didn't find a way to figure out the following: I'd prefer to keep the list of dns_alt_names in a puppet array and join() them when I build the command string. E.g. $dns_alt_names = [ 'name1', 'name2', ...] $command = puppet cert generate ... --dns_alt_names= what goes here? join($dns_alt_names, ','). But I didn't find a way to concatenate the output of the join() call to the string before it. A couple of ways I though that might allow this are: 1. Set a temporary variable with the output of join() and interpolate it into the command with ...${temp_var} 2. Use inline_template() Are these the only viable ways to achieve that? For now I keep the names in a single string, but I think this is less maintainable than using an array. Thanks, --Amos -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/BQk8gDzRKmMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: is_virtual selector
Hey, This selector expects to get a true boolean value e.g. true / false (TrueClass / FalseClass in Ruby) and that is why it is failing, since you are passing a string true from the fact (and all values coming from Facter are strings, even numeric values). Grab this: https://raw.github.com/kwilczynski/puppet-functions/master/lib/puppet/parser/functions/str2bool.rb And then try: class baseline-testing::ntpd { package { ntp: ensure = str2bool($is_virtual) ? { false = present, true = purged } } } Hope that helps :) KW On Wednesday, October 3, 2012 2:43:01 AM UTC+1, Matt wrote: I too have been pushed into Puppet 3.0. Clients and PuppetMaster are now at 3.0.0. Not sure if this is a version change or syntax error that I am experiencing. We'll use 'ntp' as the example and the build host is a VM. The old way: class baseline::ntpd { package { ntp: ensure = $virtual ? { physical = present, vmware = purged, default = present } } On the client, it always says that it is created, even though it's not present: [root@build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349227476' /Stage[main]/Baseline::Ntpd/Package[ntp]/ensure: created Finished catalog run in 1.46 seconds [root@build ~]# [root@build ~]# rpm -q ntp package ntp is not installed [root@build ~]# When trying the $is_virtual facter.. class baseline-testing::ntpd { package { ntp: ensure = $is_virtual ? { false = present, true = purged } } } On client: [root@build ~]# puppet agent -tv Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: No matching value for selector param 'true' at /etc/puppet/manifests/classes/baseline_linux-testing.pp:35 on node build [root@build ~]# [root@build ~]# facter | grep virtual is_virtual = true virtual = vmware -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/GUQ5PMTcO9wJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Making a result of custom function available to multiple classes
Hi, Since functions run on the Puppet Master side, the simplest solution is to cache the value if its freshness is not mandatory i.e. does not change, lets say every 5 minutes? Or, even it will be fine every 24 hours, etc ... Consider this snippet: https://gist.github.com/3680388 Let me know if you have troubles adapting this for your function, I am always keen to help :) KW On Saturday, September 8, 2012 4:59:31 PM UTC+1, JeremyCampbell wrote: Hey, I'm using Puppet 2.7.19 with hiera 0.3.0. I have an Openvpn module which has a custom function that queries a mysql db and returns a hash. I also need the hash values in other modules e.g. firewall module. Since the custom function is in the openvpn/lib/puppet/parser/functions folder I believe it is autoloaded and is available from other modules. However, I don't want to have to call the custom function multiple times as it's an expensive mysql query. What would be the best way to call the custom function once and make the returned hash available to other modules? Thanks for your time! Cheers, J. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/BCancuZNchMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppet hangs
Hi, Not sure why your Puppet run never terminates, and looking at lsof output it looks fairly normal. Said that, can you include strace output for such misbehaving process? Thanks! KW On Sunday, September 9, 2012 1:30:01 AM UTC+1, Balasubramaniam Natarajan wrote: On Sun, Sep 9, 2012 at 5:46 AM, Balasubramaniam Natarajan bala1...@gmail.com javascript: wrote: This has occurred once again, When I tried to # puppet apply break_ssh.pp the puppet terminal just hangs and it does not complete the job please at least point me where I have to start looking for answers. root@nscbose:/home/bala/puppet# cat 10.ssh_break.pp file{'/etc/ssh/sshd_config': ensure=present, mode=600, source='/etc/puppet/files/sshd_config', } service{'sshd': ensure=running, enable=true, subscribe=File['/etc/ssh/sshd_config'], } root@nscbose:/home/bala/puppet# puppet apply 10.ssh_break.pp After this command puppet terminal just hangs, from an another terminal I am able to confirm that puppet apply is indeed running. Nothing on the log files either :-( root@nscbose:/home/bala/puppet# ps aux | grep -i puppet puppet 766 2.3 5.1 38504 25960 ?Ssl 00:47 7:02 /usr/bin/ruby1.8 /usr/bin/puppet master --masterport=8140 root 7962 9.3 3.8 31484 19580 pts/2Sl+ 05:39 0:29 /usr/bin/ruby1.8 /usr/bin/puppet apply 10.ssh_break.pp root 8170 0.0 0.1 4364 848 pts/0S+ 05:44 0:00 grep --color=auto -i puppet http://www.etutorshop.com/moodle/ I tried looking at what are the files which puppet is currently using with lsof the same is give here. http://pastebin.com/Nvn39aBq -- Regards, Balasubramaniam Natarajan www.etutorshop.com/moodle/ -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OVIXlyEij7QJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Facter does not deliver ip addresses
Hi, How does your ifconfig -a output looks like? Suspects: https://github.com/puppetlabs/facter/blob/master/lib/facter/interfaces.rb https://github.com/puppetlabs/facter/blob/master/lib/facter/util/ip.rb KW On Wednesday, 5 September 2012 09:52:03 UTC+1, Axel Bock wrote: Hello, @Joseph: not yet. @Eric: sure :) . SLES 11 SP2, and the output is here: http://pastebin.com/jqgNmewk But I have an idea. I have another host where it still works. The host it stopped working on has two IP addresses configured on one (!) network device. so an ip a gives me: [...] 2: eth0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:50:56:99:05:02 brd ff:ff:ff:ff:ff:ff *inet 130.250.8.15/24 *brd 130.250.8.255 scope global eth0 *inet 130.250.8.20/24 *brd 130.250.8.255 scope global secondary eth0 [...] Maybe this is not actually covered by the detection algorithm of facter? :) Anyway, thanks for your help! Axel. Am Dienstag, 4. September 2012 23:57:08 UTC+2 schrieb Eric Sorenson: Hi Axel - what OS? What version of Facter? What does the output of your 'ifconfig -a' (or local equivalent) look like? Could you please run 'facter --debug' and pastebin the output somewhere? On Monday, August 20, 2012 1:19:39 AM UTC-7, Axel Bock wrote: Hi readers, another problem of mine. A host which worked just fine on friday is now not able to find out its own IP address. The reason is pretty simple as far as I have figured out: Facter. Facter returns the network interfaces just fine: interfaces=eth0,eth1, but then the ipaddress_ETHx entries are completely missing. Any idea what could be the cause of this? Thanks in advance greetings, Axel. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/fR9hLVhv3bsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Literal @ character in erb template
Hi, I am not sure how your template looks like, or how do you render it, but try to avoid putting anything with @ into a %= % block. It should just work: matti@acrux ~ $ irb require 'erb' = true host = 'localhost' = localhost p ERB.new('*.notice;news.none;cron.none @%= host %:514').result(binding) *.notice;news.none;cron.none @localhost:514 = nil @host = host.clone = localhost p ERB.new('*.notice;news.none;cron.none @%= @host %:514').result(binding) *.notice;news.none;cron.none @localhost:514 = nil matti@acrux ~ $ cat | puppet apply --noop notice inline_template('*.notice;news.none;cron.none @%= @hostname %:514') notice: Scope(Class[main]): *.notice;news.none;cron.none @acrux:514 notice: Finished catalog run in 0.03 seconds matti@acrux ~ $ KW On Friday, 31 August 2012 15:09:17 UTC+1, banjer wrote: Hi, I have a template named rsyslog.conf.erb, and the puppet agents seem to be choking on this: **.notice;news.none;cron.none @loghost:514* The agents report an error of : bad URI(is not URI?): followed by a bunch of jargon. I'm pretty sure its the literal '@' symbol that its trying to evaluate as erb code. How can I escape this @ symbol so its a literal? Thanks. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/wjllu71o0ZMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Literal @ character in erb template
Hi, Works fine for me: matti@acrux ~ $ cat test.erb *.notice;news.none;cron.none @loghost:514 % if @hostname == foo % # Provides UDP syslog reception $ModLoad imudp.so $UDPServerRun 514 % end % matti@acrux ~ $ sed -i 's/foo/acrux/' test.erb matti@acrux ~ $ cat | puppet apply file { '/tmp/test.txt': content = template('/tmp/test.erb') } notice: /Stage[main]//File[/tmp/test.txt]/ensure: defined content as '{md5}c3230100f527db4f0fe50e200ed99fe9' notice: Finished catalog run in 0.06 seconds matti@acrux ~ $ cat /tmp/test.txt *.notice;news.none;cron.none @loghost:514 # Provides UDP syslog reception $ModLoad imudp.so $UDPServerRun 514 matti@acrux ~ $ KW On Friday, August 31, 2012 6:40:26 PM UTC+1, banjer wrote: Thanks for the reply KW, but thats not quite what I was asking. Heres the relevant section of the template: *.notice;news.none;cron.none @loghost:514 % if @hostname == foo % # Provides UDP syslog reception $ModLoad imudp.so $UDPServerRun 514 % end % So you can see it lives outside of a % % block. This part: *.notice;news.none;cron.none @loghost:514* *should be a literal string. Its a standard rsyslog configuration. Loghost is the actual hostname of a host in our network that we send all of our servers' syslogs to. In other words, I don't want it to be evaluated as ERB code. So how can I have puppet/the template engine ignore the '@' symbol and treat it as a literal string? On Friday, August 31, 2012 11:21:08 AM UTC-4, Krzysztof Wilczynski wrote: Hi, I am not sure how your template looks like, or how do you render it, but try to avoid putting anything with @ into a %= % block. It should just work: matti@acrux ~ $ irb require 'erb' = true host = 'localhost' = localhost p ERB.new('*.notice;news.none;cron.none @%= host %:514').result(binding) *.notice;news.none;cron.none @localhost:514 = nil @host = host.clone = localhost p ERB.new('*.notice;news.none;cron.none @%= @host %:514').result(binding) *.notice;news.none;cron.none @localhost:514 = nil matti@acrux ~ $ cat | puppet apply --noop notice inline_template('*.notice;news.none;cron.none @%= @hostname %:514') notice: Scope(Class[main]): *.notice;news.none;cron.none @acrux:514 notice: Finished catalog run in 0.03 seconds matti@acrux ~ $ KW On Friday, 31 August 2012 15:09:17 UTC+1, banjer wrote: Hi, I have a template named rsyslog.conf.erb, and the puppet agents seem to be choking on this: **.notice;news.none;cron.none @loghost:514* The agents report an error of : bad URI(is not URI?): followed by a bunch of jargon. I'm pretty sure its the literal '@' symbol that its trying to evaluate as erb code. How can I escape this @ symbol so its a literal? Thanks. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/U6pC8D80PeQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppet installation on windows7
Hi, I suggest you share the error, so we can actually suggest a suggestion. Good luck with Puppet on Windows 7 :) KW On Thursday, 30 August 2012 11:31:59 UTC+1, valar mathi wrote: when puppet installed in windows7 and when the run puppet agent is clicked im getting certificate retrieval error.plz suggest me a solution.thanks. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/iDfLqUC2DZ8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: How to purge network-manager (requires reboot) ?
Hi Sandra, [...] but the problem is, that I suppose a reboot is required for the NIC's no longer to be manged by network-manager? I am not sure why would it require a restart, hm... I am used to making sure that the service is stopped, packaged purged and then you only need to make sure that static IP configuration is in place. Sometimes you need to get rid of the udev rules file, but not often. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Vr_-k9qbXUEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Managing plugins
Hi, [...] I'd get rid of wget altogether, then make nice packages for each plugin using https://github.com/jordansissel/fpm and then just use Puppet's package to install relevant ones. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ZB8kcy1Xcu4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppetlabs-stdlib
Hi, For some reason these are in README.markdown, perhaps a copy-paste mistake. Look inside the directory :) KW On Wednesday, August 29, 2012 5:58:13 PM UTC+1, Douglas wrote: I'm confused about this... https://github.com/puppetlabs/puppetlabs-stdlib/ I see a lot of functions there that are the same as the ones that come standard with puppet. If I create a module and dump this stuff in there, what happens to the existing stuff? How does puppet know which one to use? Doug -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/WQXlCyrEMoQJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Append string to list items.
Hi, You could try this: matti@acrux ~ $ cat | puppet apply --noop notice bracket_expansion('gfs[01-10]:/var/bricks') notice: Scope(Class[main]): gfs01:/var/bricks gfs02:/var/bricks gfs03:/var/bricks gfs04:/var/bricks gfs05:/var/bricks gfs06:/var/bricks gfs07:/var/bricks gfs08:/var/bricks gfs09:/var/bricks gfs10:/var/bricks notice: Finished catalog run in 0.11 seconds Not quite a loop, but will do the trick (and handles zero-padding). https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/bracket_expansion.rb I will look into adding array-walking mode to join, prefix and join_with_prefix. KW On Monday, 27 August 2012 20:03:57 UTC+1, Douglas wrote: I have an array: $nodes = ['gfs01' ,'gfs02', 'gfs03', 'gfs04] and a string variable: $brick_store = /var/bricks How can I append /var/bricks to each item in the array? Lack of a looping construct makes this challenging in puppet. Such that: brick_array = ['gfs01:/var/bricks', 'gfs02:/var/bricks', ... ] I also need to come up with a way to append a further sequence of incrementing brick numbers to the items as well. Doug -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/yNayGxbkAjgJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Why this Could not evaluate error?
Hi, Thanks for the hugs :) There seem to be a problem with underlying provider / binaries on which said provider relies. Nothing wrong with your content, as far as I can tell from the little snippet provided. KW On Tuesday, August 28, 2012 4:37:51 PM UTC+1, Sandra Schlichting wrote: Please replace testip with mttj-linuxterm1-puppet =) -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/LHGLNHML-pAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Accessing a fileserver file from a custom function
Hi James, [...] How could I acheive this please? I'd rather not hard-code the full path as this would be brittle - how can I resolve the puppet:/// url to the actual file location please? Using puppet:/// and file:/// in a way similar to what the File type offers from within a custom function is actually not that straight-forward, sadly. There is a lot of code which deals with resolving these URLs that deals with SSL certificates (since you can request an artifact from different Puppet Master), etc. I found it not that easy to work with outside of the File type, but perhaps somebody was more successful than I was (?) :-) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Tm0AmXpDhm8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: How to index into array from a function
Hi, I believe that Puppet's DSL parser has no concept of such implemented at this point in time. Your expectations are probably set upon looking how this can be done in Ruby, whereas Puppet DSL is not a proper (a full-blown, so to speak) programming language in the sense of what Ruby is, for instance, and its parser etc is limited. I am sorry to hear that you are disappointed, but it is as it is for the time being :) KW On Thursday, 2 August 2012 15:30:48 UTC+1, Despite wrote: Is there a clean way to index into an array returned by a function? When I try to do it directly, I get a parser error. I have to assign the array to a new variable and index that. # This fails $dc = split($domain,'[.]')[0] # This works $split_domain = split($domain,'[.]') $dc = $split_domain[0] I guess it really doesn't matter, it's just annoying and breaks my expectations. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/MPmtu9jtUnsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Calling custom functions from functions, parameter weirdness
Hi, Ruby DSL and templates (via e.g. inline_template) would have the same problem, unless this was handled properly on the function's side. KW On Friday, 22 June 2012 18:53:55 UTC+1, ad wrote: Josh, I appreciate the help. Using function_foo(['bar']) rather than function_foo('bar') works as expected. I'm sure this will also solve the same issue I was having calling a custom function from a Ruby DSL defined type. Cheers, Adam On Friday, June 22, 2012 12:01:24 PM UTC-5, Josh Cooper wrote: On Fri, Jun 22, 2012 at 9:13 AM, ad adam.denn...@gmail.com wrote: I just tested this on CentOS/Puppet 2.7.12 with the same result. - Adam On Friday, June 22, 2012 10:20:52 AM UTC-5, ad wrote: This is on Windows running 2.7.16. I haven't tested on Linux or other versions. I'm still relatively new to Puppet and haven't used custom functions before, so wanted to run this by the list before filing a bug. When calling custom functions from functions, arguments are being converted to decimal arrays. That is, passing the argument 'bar' from a custom function to another function results in arg[0]: 98 arg[1]: 97 arg[2]: 114 Here's a full example in case I'm doing something wrong here. Function 1: module Puppet::Parser::Functions newfunction(:foo) do |args| puts 'args[0]:' + args[0].to_s puts 'args.size:' + args.size.to_s end end Function 2: module Puppet::Parser::Functions newfunction(:foo2) do |args| Puppet::Parser::Functions.**autoloader.loadall function_foo('from_function') Since you are calling foo with a single argument, I believe the args in function foo is a string, not an array. If you instead say `function_foo(['from_function'])`, it should do what function foo expects. end end A manifest: foo('from_manifest') foo2() Puppet Agent run Result: args[0]:from_manifest args.size:1 args[0]:102 args.size:13 13 is the string length of 'from_function', and 102 is the decimal representation of 'f'. - Adam -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-eqfuh4NRI0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. -- Josh Cooper Developer, Puppet Labs -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/UAzUIA3jQWkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: OT: Monitoring solutions
Hi, Have a look at https://github.com/monitoringsucks/ KW On Sunday, 24 June 2012 21:45:50 UTC+1, k...@mocker.org wrote: All, I'm curious what monitoring solutions everyone is using and recommend, some of the ones I've been looking at recently: Nagios: Old stand-by, used quite a bit but doesn't provide a cohesive solution (have to have add-ons for graphing, etc..) Zabbix: Currently using, decent but seems to be a bit resource intenstive Zenoss: Never used, no opinion yet Icinga: Never used, Nagios fork that I have no opinion on yet Shinkin: Never used, no opinion yet Centreon: Never used, no opinion yet There are (lots) more out there, recommendations from someone who has used the product would be great to hear. Obviously integration into puppet would be a great feature to have. :) Thanks, Kyle Sexton -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/coe-pqnA37YJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Look for existing Facter Modules for retrieving some system description information
Hi, On Thursday, May 24, 2012 2:13:08 PM UTC+1, Christophe L wrote: Hello, Thanks for pointing your kwilczynski github repo, it gave me most of the information I was looking for ! Glad you found it useful. I put a list of information below, does anyone know facts or facter module which would be able to extract the below information please ? [...] - about processors / cpus max_speed: 3 MHz voltage: 3.3 V Version: Pentium(R) Pro Current Speed: 2533 MHz Manufacturer: GenuineIntel Family: Pentium Pro Above wound not be hard to do. - about memory socket Installed Size: 1024 MB (Single-bank Connection) Enabled Size: 1024 MB (Single-bank Connection) Type: EDO DIMM Ah, you see this is where it gets nasty. Memory related details like that can be read from DMI (Desktop Management Interface) and/or SMBIOS (System Management BIOS), but unfortunately there is not standard which dictates what fields are mandatory and their format. Therefore, most often information conceived there is bad... like REALY bad, and very inconsistent between vendors (if they include anything at all). In other words, there is no easy and consistent way to get this data. - about mount points, is there a way to have the information returned by puppet resource mount as facts ? Is the mount points face not enough? Or you want to get some form of auditing? KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/YM4D1yQOOWEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Look for existing Facter Modules for retrieving some system description information
Hi, On Monday, May 21, 2012 8:31:48 AM UTC+1, Christophe L wrote: Hello, I have not been able to find existing Facter modules for retrieving the information I listed below. Could you point me on some modules which would anwer my needs please ? Below the list of information I would need to retrieve. Thanks in advance for your help. Best regards, Christophe 1) Bios Information version:6.00, bios_revision:4.6, release_date:10/13/2009,vendor:Phoenix Technologies LTD, 2) processor related information max_speed:3 MHz, signature:Type 0, Family 6, Model 30, Stepping 5, voltage:3.3 V Socket Designation:CPU socket #0, Version:Pentium(R) Pro, Current Speed:2533 MHz, ID:E5 06 01 00 FF FB EB 0F, Manufacturer:GenuineIntel, Family:Pentium Pro, cache_size:8192 KB, 3) mouting points list /dev/sda1:{ kb_size:15791024, uuid:88eb9c66-5ce8-458e- a7da-3b20cfcf3278, mount_options:[ rw, errors=remount-ro ], fs_type:ext3, mount:/, 4) memory chip related information Installed Size:1024 MB (Single-bank Connection), record_id:0x000D, Socket Designation:RAM socket #0, Enabled Size:1024 MB (Single-bank Connection), Error Status:OK, Type:EDO DIMM 5) network related information default_gateway:10.66.112.1 6) block devices sda:{ model:Virtual disk, size:33554432, timeout:180, rev:1.0, removable:0, vendor:VMware, state:running 7) users and groups group:{ mygroup:{ gid:1000, passwd:{ myuser:{ gecos:My User gid:1000, dir:/home/ myuser, uid:1000, shell:/bin/bash Where do you look for these? Some of them are already there in Facter, others can be found on people's github profiles (including mine). Google Fu needs working on a little :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SMapjLfr-XwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Announce: PuppetDB 0.9.0 (first release) is available
Hi, Awesome sauce, definitely +1 :) KW On Friday, May 18, 2012 3:21:26 PM UTC+1, Michael Stanhke wrote: PuppetDB, a component of the Puppet Data Library, is a centralized storage daemon for auto-generated data. This initial release of PuppetDB targets the storage of catalogs and facts: * It’s a drop-in, 100% compatible replacement for storeconfigs * It’s a drop-in, 100% compatible replacement for inventory service * It hooks into your Puppet infrastructure using Puppet’s pre-existing extension points (catalog/facts/resource/node terminuses) * It’s much faster, much more space-efficient, and much more scalable than current storeconfigs and the current inventory service. * We can handle a few thousand nodes, with several hundred resources each, with a 30m runinterval on our laptops during development. * It stores the entire catalog, including all dependency and containment information * It exposes well-defined, HTTP-based methods for accessing stored information * Documented at http://docs.puppetlabs.com/puppetdb * It presents a superset of the storeconfigs and inventory service APIs for use in scripts or by other tools * In particular, we support arbitrarily nested boolean operators * It decouples catalog and fact storage from the compilation process * Goodbye puppetq...PuppetDB subsumes it * It works Very Hard to store everything you send it; we auto-retry all storage requests, persist storage requests across restarts, and preserve full traces of all failed requests for post-mortem analysis * It’s secured using Puppet’s built-in SSL infrastructure * It’s heavily instrumented and easy to integrate its performance info into your monitoring frameworks As this is the first public release, the version is 0.9.0 (a.k.a. “open beta”). While we’ve been using PuppetDB internally at Puppet Labs for months without incident, we encourage you to try it out, hammer it with data, and let us know if you run into any issues! A 1.0 release will come after a few cycles of bug squashing. # Downloads Available in native package format at http://yum.puppetlabs.com http://apt.puppetlabs.com Source (same license as Puppet): http://github.com/puppetlabs/puppetdb Available for use with Puppet Enterprise 2.5.1 and later at http://yum-enterprise.puppetlabs.com/ and http://apt-enterprise.puppetlabs.com/ # Documentation (including how to install): http://docs.puppetlabs.com/puppetdb # Issues can be filed at: http://projects.puppetlabs.com/projects/puppetdb/issues Michael Stahnke Community Manager Puppet Labs -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/VvP4ox-Zt90J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Puppet stdlib - Is there a validate_in function
Hi, On Sunday, April 29, 2012 3:25:48 PM UTC+1, Peter wrote: Hi KW, On Apr 29, 4:30 am, Krzysztof Wilczynski krzysztof.wilczyn...@linux.com wrote: Hi, I was hoping that I could just simply do a: validate_in($::{ensure}, $::{valid_ensure_values}) How would that be different than using the in in your if statement? :) Or, what is wrong with using if? Unless I am missing something? :) KW Nothing is wrong with using if statements per-say. To put my problem slightly differently, in the module I am working on I have have five checks that would benefit by having the helper function (it would be cleaner, easier to maintain and easier to read). Also I hope that by doing the check purely in ruby it would be slightly faster to process rather then return a couple of times. To give you an example within my module in the param's file I have: $valid_package_ensure_values = [ present, installed, latest, absent, purged, held ] $valid_service_ensure_values= [ running, true, stopped, false ] $valid_service_enable_values= [ true, false, manual ] $valid_module_config_values= [ file, template ] $valid_module_tpml_loc_values= [ module, site ] If I had the validate_in helper function and used the other validate functions in the stdlib the validation code would look like (extracted): -- class module::server::base ( $package_ensure = undef, $service_ensure = undef, $service_enable = undef, $module_config = undef, $template_loc= undef, $use_storeconfig = undef, $proxy_port = undef, $cache_dir = undef, $log_dir = undef, $cache_net_adr = undef ) { include module::params validate_in(${package_ensure}, ${valid_package_ensure_values}) validate_in(${service_ensure}, ${valid_service_ensure_values}) validate_in(${service_enable}, ${valid_service_enable_values}) validate_in(${module_config}, ${valid_module_config_values}) validate_in(${template_loc}, ${valid_module_tpml_loc_values}) is_integer($proxy_port) validate_absolute_path($cache_dir, $log_dir) validate_bool($use_storeconfig) # start using the values in code below -- The above code is very easy to read and you could see at a glance exactly what is happening. Also if the error message follows the format described in my previous message debugging would be very simple. I could see myself using the same pattern in other modules I develop. Bottom line instead of the current 35 lines of validation code I have, I could replace it with the above 8 lines which would do the same amount of work (4:1 ratio)! Funnily enough after I sent the original email I stumbled on puppetlabs-stdlib/lib/puppet/parser/functions/member.rb which is almost exactly what I am looking for, I notice that you wrote it ;) Thoughts? If you have a moment, then write to me directly :) We can work-out what is needed and I will happily create any function for you :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Q9mf6835WtIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Puppet stdlib - Is there a validate_in function
Hi, [...] $valid_ensure_values = [ present, absent ] if ! ($::{ensure} in $::{valid_ensure_values}) { $test_ = inline_template(%= ($::apt-cacher-ng::params::valid_ensure_values).join(', ') %) fail(${module_name}::server - Invalid ensure value [currently - ${ensure}], valid values are [$::{valid_ensure_values}]) } I was hoping that I could just simply do a: validate_in($::{ensure}, $::{valid_ensure_values}) How would that be different than using the in in your if statement? :) Or, what is wrong with using if? Unless I am missing something? :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7ekhlWECNEcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: ordering or chaining for generate() function
Hi, Am I right in thinking that something like that has place. On the Master: generate() - template() and/or static file - /config/file/on/the/client Then, if /config/file/on/the/client exists, you do not use generate(), yet when on the contrary, then you have to fire generate() first to generate content for said client-side configuration file? KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/6q9nKC6RZqIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: ordering or chaining for generate() function
Hi, On Wednesday, April 25, 2012 5:49:03 PM UTC+1, psychobyte wrote: Essentially, yeah. [...] I want to guarantee that the generate function runs before any file resources. In such case, look at stages, perhaps it will help. Other than that, if you want to make sure that said configuration file is not present on the client side and only then run generate, you could have a fact (I can help writing one) that yields a boolean if the configuration file exists or not and then use this value in an if-statement where you'd run generate() function conditionally. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Y-sbYG_nwV0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: help with array in a template.
Hi, [...] It is in the split in fact I don't have space between the value but carried returns, so if I split to \n, it works. This is slightly worrisome. I encourage you to go with separating values with a comma, not only because it follows style of how other facts return values, but also ensures that things will not break by accident (something may happen now and/or in the future). As far as having single space there to separate results is also acceptable, then having \n there might not be what you want. I do encourage you to strip surplus new lines and join values on single comma :) My 2p, I hope you don't mind :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/95nyFfV8ytsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: How to increment variable in erb template ?
Hi, On Tuesday, 24 April 2012 14:38:28 UTC+1, AnOnJoe wrote: Hi', I'm looking for a way to increment variable in template (erb file). I tried this, but it didn't work Compteur %= compteur % % compteur = compteur + 1 % Compteur %= compteur % I've got this error : Error 400 on SERVER: Failed to parse template test/test.erb: undefined method `+' for nil:NilClass Would that help? kwilczynski@desktop:~$ irb irb(main):001:0 require 'erb' = true irb(main):002:0 t = ERB.new -EOS irb(main):003:0 %= c = c ? c += 1 : 1 % irb(main):004:0 EOS = #ERB:0x7f2cde07cbe8 @safe_level=nil, @src=_erbout = ''; _erbout.concat(( c = c ? c += 1 : 1 ).to_s); _erbout.concat \\\n\\n; _erbout, @filename=nil irb(main):005:0 t.result(binding) = 1\n irb(main):006:0 t.result(binding) = 2\n irb(main):007:0 t.result(binding) = 3\n irb(main):008:0 KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/RTEW8ohAolsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: How to increment variable in erb template ?
Hi, \o/ KW On Tuesday, 24 April 2012 15:18:56 UTC+1, AnOnJoe wrote: I've got it : Compteur %= compteur % *% compteur = compteur.to_i -%* % compteur += 1 -% Compteur %= compteur % Le mardi 24 avril 2012 15:38:28 UTC+2, AnOnJoe a écrit : Hi', I'm looking for a way to increment variable in template (erb file). I tried this, but it didn't work Compteur %= compteur % % compteur = compteur + 1 % Compteur %= compteur % I've got this error : Error 400 on SERVER: Failed to parse template test/test.erb: undefined method `+' for nil:NilClass -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/w1e5oy4P_8sJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] What is the false directory?
Hi, On Tuesday, April 24, 2012 6:38:27 PM UTC+1, Nigel Kersten wrote: This should get reported as a bug though. We should probably only accept absolute paths for the 'path' parameter, and false should get interpreted as the boolean. +1 KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/9JTXiNpMVkUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppet calling stat() on managed symlinks
Hi Tim, On Monday, 23 April 2012 05:41:31 UTC+1, Tim wrote: [...] IANAE here, but it seems that this open is unnecessary? [...] This is not Puppet doing open on this directory (not explicitly anyway). Have a look on this: kwilczynski@desktop:~/Development/Sandbox/Test$ mkdir -p a/{b,c/d} kwilczynski@desktop:~/Development/Sandbox/Test$ tree . └── a ├── b └── c └── d 4 directories, 0 files kwilczynski@desktop:~/Development/Sandbox/Test$ strace -e open,lstat,getdents ruby -e Dir['./**/*'] open(/etc/ld.so.cache, O_RDONLY) = 3 open(/usr/lib/libruby1.8.so.1.8, O_RDONLY) = 3 open(/lib/libpthread.so.0, O_RDONLY) = 3 open(/lib/librt.so.1, O_RDONLY) = 3 open(/lib/libdl.so.2, O_RDONLY) = 3 open(/lib/libcrypt.so.1, O_RDONLY)= 3 open(/lib/libm.so.6, O_RDONLY)= 3 open(/lib/libc.so.6, O_RDONLY)= 3 open(/dev/urandom, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW) = 3 open(., O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 getdents(3, /* 3 entries */, 32768) = 72 lstat(./a, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open(./a, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 getdents(4, /* 4 entries */, 32768) = 96 lstat(./a/b, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open(./a/b, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5 getdents(5, /* 2 entries */, 32768) = 48 getdents(5, /* 0 entries */, 32768) = 0 lstat(./a/c, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open(./a/c, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5 getdents(5, /* 3 entries */, 32768) = 72 lstat(./a/c/d, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 open(./a/c/d, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 6 getdents(6, /* 2 entries */, 32768) = 48 getdents(6, /* 0 entries */, 32768) = 0 getdents(5, /* 0 entries */, 32768) = 0 getdents(4, /* 0 entries */, 32768) = 0 getdents(3, /* 0 entries */, 32768) = 0 kwilczynski@desktop:~/Development/Sandbox/Test$ And then ... kwilczynski@desktop:~/Development/Sandbox/Test$ strace -e open,lstat,getdents ruby -e Dir['./*'] open(/etc/ld.so.cache, O_RDONLY) = 3 open(/usr/lib/libruby1.8.so.1.8, O_RDONLY) = 3 open(/lib/libpthread.so.0, O_RDONLY) = 3 open(/lib/librt.so.1, O_RDONLY) = 3 open(/lib/libdl.so.2, O_RDONLY) = 3 open(/lib/libcrypt.so.1, O_RDONLY)= 3 open(/lib/libm.so.6, O_RDONLY)= 3 open(/lib/libc.so.6, O_RDONLY)= 3 open(/dev/urandom, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW) = 3 open(., O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 getdents(3, /* 3 entries */, 32768) = 72 getdents(3, /* 0 entries */, 32768) = 0 Or, an equivalent: kwilczynski@desktop:~/Development/Sandbox/Test$ strace -e open,lstat,getdents ruby -e Dir.entries('.') open(/etc/ld.so.cache, O_RDONLY) = 3 open(/usr/lib/libruby1.8.so.1.8, O_RDONLY) = 3 open(/lib/libpthread.so.0, O_RDONLY) = 3 open(/lib/librt.so.1, O_RDONLY) = 3 open(/lib/libdl.so.2, O_RDONLY) = 3 open(/lib/libcrypt.so.1, O_RDONLY)= 3 open(/lib/libm.so.6, O_RDONLY)= 3 open(/lib/libc.so.6, O_RDONLY)= 3 open(/dev/urandom, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW) = 3 open(., O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 getdents(3, /* 3 entries */, 32768) = 72 getdents(3, /* 0 entries */, 32768) = 0 kwilczynski@desktop:~/Development/Sandbox/Test$ Also, two more examples: kwilczynski@desktop:~/Development/Sandbox/Test$ cat ftw.c #include ftw.h #include stdio.h #include stdlib.h int callback(const char *name, const struct stat *status, int type); int main(int argc, char *argv[]) { char *root = .; ftw((char *) root, callback, 1); return 0; } int callback(const char *name, const struct stat *status, int type) { if (type == FTW_NS) return 0; if (type == FTW_F || type == FTW_SL || type == FTW_D) printf(%s\n, name); return 0; } kwilczynski@desktop:~/Development/Sandbox/Test$ gcc -o ftw ftw.c kwilczynski@desktop:~/Development/Sandbox/Test$ ./ftw . ./a ./a/b ./a/c ./a/c/d ./readdir.c ./readdir ./ftw.c ./ftw kwilczynski@desktop:~/Development/Sandbox/Test$ strace -e open,lstat,getdents ./ftw open(/etc/ld.so.cache, O_RDONLY) = 3 open(/lib/libc.so.6, O_RDONLY)= 3 open(., O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 . getdents(3, /* 7 entries */, 32768) = 192 getdents(3, /* 0 entries */, 32768) = 0 open(./a, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ./a getdents(3, /* 4 entries */, 32768) = 96 getdents(3, /* 0 entries */, 32768) = 0 open(./a/b, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ./a/b getdents(3, /* 2 entries */, 32768) = 48 getdents(3, /* 0 entries */, 32768) = 0 open(./a/c, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ./a/c getdents(3, /* 3 entries */, 32768) = 72 getdents(3, /* 0 entries */, 32768) = 0 open(./a/c/d, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ./a/c/d getdents(3, /* 2 entries */, 32768) = 48 getdents(3, /* 0 entries */, 32768) = 0 ./readdir.c ./readdir ./ftw.c ./ftw
[Puppet Users] Re: puppet calling stat() on managed symlinks
[...] I forgot to add ... You probably do not want Puppet to follow symbolic links which in conjunction with the recurse = true is leading to open() done on each new directory during traversal. Perhaps setting links = ignore will help, not sure, thought. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-ZEF7r2mrzAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Monday, 23 April 2012 13:59:00 UTC+1, Dennis Jacobfeuerborn wrote: Thanks, this looks like it will do the trick. The lack of puppet:// support probably means I will have to hard-code a path to a directory somewhere but that shouldn't be to big of a deal. [...] Apologies for that :-( Adding support for puppet:// is quite tricky (there is a lot going on under-the-hood with this one), and I never have the time to do it (unless somebody is willing to help out and/or sponsor). For the time being, please bare with fully-qualified paths ... KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/EkfQJ_W21WUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Monday, 23 April 2012 16:14:59 UTC+1, Dennis Jacobfeuerborn wrote: [...] If I make any progress there you can expect a pull request for the changes :) [...] Thank you! That's very kind :) Let me know if I can help and/or we can join efforts. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/FSqkMxG3cyEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Sunday, 22 April 2012 02:15:19 UTC+1, Dennis Jacobfeuerborn wrote: [...] The twist I need to add though is that I only want to do this if a copy of that file for the node exists on the server. If this file doesn't exists then I want puppet to not replace the file on the client and not restart the service. Is there a way to accomplish this sort of conditional execution? Have a look on: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/exists.rb Maybe it will be of any use to you in this case. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7QWPj4QhYvkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Custom Function to generate random password
Hi, On Tuesday, 3 April 2012 07:36:06 UTC+1, r0k5t4r wrote: Hi, I'm currently trying to write a simple function to generate a random password. I have looked at the fqdn_rand.rb script to get things going but unfortunately my ruby skills are very bad. [...] Try this one: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/random_password.rb KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/53Dd49kLNDcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Custom Function to generate random password
Hi, I am glad you found it useful. KW On Tuesday, 3 April 2012 14:01:44 UTC+1, r0k5t4r wrote: Hi, thanks a lot. Just what I was looking for. Works like a charm. :) Best Regards On 3 Apr., 13:36, Krzysztof Wilczynski krzysztof.wilczyn...@linux.com wrote: Hi, On Tuesday, 3 April 2012 07:36:06 UTC+1, r0k5t4r wrote: Hi, I'm currently trying to write a simple function to generate a random password. I have looked at the fqdn_rand.rb script to get things going but unfortunately my ruby skills are very bad. [...] Try this one: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppe... KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/snUP4f6txQcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] stdlib/range issue
Hi, [...] I changed how the range works (also making it resists Ruby's string permutation bomb). Ideas implemented so far: https://gist.github.com/2277148 https://gist.github.com/2277144 https://gist.github.com/2270106 Also, the a..b and a...b notation should also be supported. I will push new version later. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SCJwCfMu9kEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] stdlib/range issue
Hi, irb(main):008:0 (08..12).to_a = [08, 09, 10, 11, 12] irb(main):010:0 (8..12).to_a = [8, 9, 10, 11, 12] But then, the range() function in stdlib, makes a type conversion, that breaks this possibility. I don't understand why do you do that conversion... the function is just an interface to the range capability of Ruby, right? I think it should allow the programmer to choose the type he wants. With great power comes great responsibility -- said that, please allow yourself to understand the following example: (abc01..abc99 ).to_a Observe this little (which may happen) mistake after abc99. That is the easily over-looked single space. If you do that in your manifest, let say ... by accident... then your Puppet Master will more likely become a happy candidate for OOM Killer to consider :) Do you know if, after editing a .rb file, I have to force some kind of reload to pick up the changes? No, there is no need to reload, but this is not the solution. Instead, in order to guarantee safe execution and also provide desired effect a different approach can be taken: You can scan for how many string-encoded digits you can fine within start of the range, count then and then based on this counter collect (or map if you like Perl so much) generated range with relevant substitution. If done right, then it will allow you to zero-padding of any size at any place in the string e.g. test00, 00test this00test, etc ... I will update my version f range shortly to do precisely that. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SsdPCfKazJwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: dsl check if port is open
Hi David, No problem, although there are few things to consider. For instance, I would avoid unneeded fork(), therefore no need to use netcat if you can achieve the same thing with pure Ruby (you can literally copy and paste code from the function I have created for you). Remember, that in terms of having a fact there, you have to maintain details about the remote port in the fact code, whereas in case of the functions you simply store this information inside a manifest. But, to be quite honest, if you have to resort to such active checks in order to determine state of your systems and therefore make an elaborated decision in the code about what to do, then I would say that you are doing something not necessary right. Well, in the end whatever works as Woody Allen would say :) KW On Wednesday, 28 March 2012 01:00:45 UTC+1, David Garvey wrote: Thanks Jeff and Krzysztof, I think I will write a facter using netcat or something then and catch it in the manifests. nc -z domain_name port Cheers, DGarvey On Tue, Mar 27, 2012 at 2:36 PM, Jeff McCune j...@puppetlabs.com wrote: On Tue, Mar 27, 2012 at 2:24 PM, Krzysztof Wilczynski krzysztof.wilczyn...@linux.com wrote: Ho David, On Tuesday, 27 March 2012 19:05:09 UTC+1, David Garvey wrote: Can I check if a port is open for DSL? I need to check if the box has an acl allowing the nagios server to connect via nrpe before writing nagios config. [...] Managing firewall using Puppet as well, as per what Jeff suggested, is of course the preferred way to solve this sort of problem, but if you need to check whether a port is open, then have a look: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/is_port_open.rb Jeff will probably not approve of that :-) Eh, I may surprise you... I don't think my approval matters much at all and I'm a fan of whatever works for the problem at hand given the tools we have today. I can totally see the value of a function that automatically figures out if a remote port is _actually_ open and listening, rather than _should_ be open and listening, from the perspective of the Puppet master. With that said, I'm more interested in the problem David is facing than I am in a specific solution solution because I'm pretty sure Puppet doesn't have the capability to solve this in a elegant, simple and easy way. We can solve it with a custom function or custom fact today, but I'd like to make this easier for everyone in the future. -Jeff -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. -- David Garvey -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/pzCRtD_gMD4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Facts loading 4-5x
Hi, It is a known issue in older version. A quick search yields: http://projects.puppetlabs.com/issues/3741 http://projects.puppetlabs.com/issues/8341 And probably more could pop-up in results (citation needed). KW On Wednesday, 28 March 2012 14:51:03 UTC+1, Christopher Johnston wrote: Is there any reason why my facts are loading 4-5x (I have even seen 6x) on puppet client runs? I am running 2.7.9, I remember running 2.6 and seeing usually 2x. Is there a known bug here or some configuration problem that could be causing this? Some of my facts collect/parse a bunch of data and can be time consuming. Adding an extra few seconds may not seem like a lot but when doing that across several 100 nodes at a time it adds up it seems a bit excessive. -Chris -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/3ieOWQbCmqIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: dsl check if port is open
Ho David, On Tuesday, 27 March 2012 19:05:09 UTC+1, David Garvey wrote: Can I check if a port is open for DSL? I need to check if the box has an acl allowing the nagios server to connect via nrpe before writing nagios config. [...] Managing firewall using Puppet as well, as per what Jeff suggested, is of course the preferred way to solve this sort of problem, but if you need to check whether a port is open, then have a look: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/is_port_open.rb Jeff will probably not approve of that :-) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/723yLiwMWB4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: virtual resources vs fqdn_rand
Hi, [...] I have worked around this by passing in a $minute argument, but this seems a bit inelegant -- the slave certainly has no business determining the backup schedule. Other than a feature request for fqdn_rand to allow a value to be passed in, any ideas on a more elegant way to accomplish this? Criticism welcome! I did this quickly for you: https://gist.github.com/2159360 kwilczynski@lamhirh ~/Sandbox $ RUBYLIB=. cat - | puppet 2 /dev/null notice random_crontab_minutes('rsync', $hostname) notice random_crontab_minutes('abc', 'def') notice: Scope(Class[main]): 10 notice: Scope(Class[main]): 6 notice: Finished catalog run in 0.03 seconds I am not sure if this will help / fit you use case, have a look :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/N-MA3hfkezUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: [Arrray] grep -v
Hi, So it doesn't work this way any thoughts? [...] Would that work for you: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/reject.rb ? KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/C-1pyK58Q6oJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: [Arrray] grep -v
Hi, thx a lot... it helps [...] I do hope that it fulfils your use case :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/cDL3aXljws0J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: [Arrray] grep -v
Hi, Just wanted to let you know, that I have added select.rb to the reject.rb, which is the opposite (to some extent). I hope you find them useful :) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/vDzyB_G2zsEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] custom fact issue
Hi, There is also no need to call date from within the shell saving on unnecessary fork, as Ruby can provide UTC time for you. More concise version: https://gist.github.com/2051811 KW On Friday, 16 March 2012 16:51:02 UTC, Jemmorey wrote: So far so good. In test environment it actually reports when I run it. Thank you very much Guy. I'll let you know how it goes in the environments which actually use noop. Appreciate the help :) Jordan On Friday, March 16, 2012 12:26:23 PM UTC-4, Guy Matz wrote: Hi! Does the following do what you might expect? fact_name = 'noop' Facter.add(fact_name) do setcode do utc_hour = %x{/bin/date -u +%H}.chomp.to_i environment = Facter.value(:environment) #puts env = #{environment} if environment.match(test|dev|qa) result = false else if utc_hour.between?(1,10) result = false else result = true end end #puts result #{result} result end end On Fri, Mar 16, 2012 at 10:56 AM, Jemmorey wrote: Would anyone please assist me on this one? This fact seems to work, but 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) result = false else result = true end end result end end /snip -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Ubou1ggrLusJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/sX_eQURls3MJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: is there a way to make the puppetlabs/firewall module implement the iptables -P flag?
HI Chris, Awesome, +1 :) KW On Friday, 16 March 2012 22:09:34 UTC, Chris O'Donnell wrote: FYI, I downloaded the following branch this morning: git clone -b ticket/10162-firewallchain_support_for_merge git:// github.com/kbarber/puppetlabs-firewall.git and found a bug where the args for iptables were being fed to it in the wrong order. I made the following patch, and emailed it to Ken: --- iptables_chain.rb.orig 2012-03-16 17:14:29.0 -0400 +++ iptables_chain.rb 2012-03-16 16:31:40.0 -0400 @@ -73,7 +73,7 @@ def policy=(value) return if value == :empty -allvalidchains do |t, table, chain| +allvalidchains do |t, chain, table| p = ['-t',table,'-P',chain,value.to_s.upcase] debug [set policy] #{t} #{p} t.call p -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Ke1j5IhgztcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: is there a way to make the puppetlabs/firewall module implement the iptables -P flag?
Hi, [...] Anyone have a hack (ugly or not) to implement this? A hack? Um. http://projects.puppetlabs.com/issues/10162 http://projects.puppetlabs.com/issues/10958 https://github.com/puppetlabs/puppetlabs-firewall/pull/59 It will probably be there in the near future. KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/KY3n3OZLUvwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: zombie child process
Hi, So /bin/sh gets defunc on Retrieving plugin.. What's my next step? I would imagine, that adding code to either ignore SIGCHLD, or collect child status (exit code), or use Process.detach could help :-) KW -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Mi_JyQmdX7QJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Casting Fixnum to String (Hiera/YAML)
Hi Lars, [...] It would be nice for a plain Integer (Fixnum) to work as well when it's coming from a YAML file. When you introduce a numeric value through the manifest, then Puppet will do the right thing during parsing it, but when you introduce Integer or Float from Hiera, then you will get them as-is after parsing YAML, meaning as intended types in Ruby, so to speak. And because Ruby is dynamic and uses duck-typing, it simply just work internally to the point when parser is trying to combine both types. I guess the question boils down to: Is there a way to cast from Fixnum to String? Yes, look below :) It seems like an inconsistency to me that in Puppet it works quoted and unquoted but not in YAML so I'd like to provide the same syntax for both versions. For now i've added a validate_string($port) call. Puppet in most cases treats non-negative Internet and Float as string (unless this behavior differs nowadays). Take a look on this: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/num2str.rb And this: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/type.rb I hope it helps a little :) KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Display correctly any array
Hi Steve, This is because puppet lacks the join() function, the obvious (but absent) partner to the split() function. [...] By default yes, it does. But you can mitigate this problem with puppetlabs-stdlib[1] and/or tackle this one: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/join.rb and probably this one might also come in handy: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/prefix.rb 1. https://github.com/puppetlabs/puppetlabs-stdlib KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Puppet Triage-A-Thon
Hi James, [...] Would it be possible to have one in London too? :-) KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Display correctly any array
Hi Felix, Seeing as this has not been mentioned in the thread yet, I'm compelled to add: $array_to_str = inline_template(%= array * ', ' %) or even notify { my-notify: message = inline_template(Here is the %= array * ', ' %.); } Ah, the oldie but goodie inline_template() abuse :-) We should stop endorsing this, really, hehe :) KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Display correctly any array
Hi Aaron, As long as we're lacking a builtin method for pretty-printing data structures during a debug session inline templates are going to continue to be popular in scenarios like this. Sadly, you are right. I personally dislike inline_template() hackety hacks and would rather solve a problem by making a more appropriate newfunction etc :) For instance, I have this simple dump() of mine, but something like a built-in var_dump() (a'la PHP) would be handy, indeed :) P.S. I am about to move dump() from Gists to a proper place on my github. KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Display correctly any array
Hi, [...] There is no way to put a clean IFS for the ouput... You could use join() to join array elements with a single space and display then with notice, or have a define that would iterate over array elements for you printing them one by one. You can also try this little function: https://gist.github.com/1621778 I hope that helps. KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppetlabs-functions repo
Hello, Just an FYI - since the work in: https://github.com/puppetlabs/puppetlabs-functions Is now merged into: https://github.com/puppetlabs/puppetlabs-stdlib It will be removed from our Github organisation as its no longer needed. Thanks to Krzysztof Wilczynski for this contribution. I will make sure (as the time permits) to merge repository on my github with this upstream one :-) So any future work can by carried out from within single upstream repository; thank you Ken :-) KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: puppetlabs-functions repo
Hello, [...] On that note... I was wondering, why functions would people like to see in Puppet (and in puppetlabs-stdlib)? Any suggestions more than welcome! :-) KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: how to check if a hash/array is empty or not in puppet .pp/module (not in template)?
Hello, Nan +1 [...] See empty function:https://github.com/puppetlabs/puppetlabs-stdlib/tree/master/lib/puppe... [...] Here is a newer version soon to be merged with stdlib: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/empty.rb KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: how to check if a hash/array is empty or not in puppet .pp/module (not in template)?
Hello, [...] See empty function:https://github.com/puppetlabs/puppetlabs-stdlib/tree/master/lib/puppe... There is newer version soon to be merged with stdlib: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/empty.rb KW -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.