Re: [Puppet Users] Circular RPM dependencies...
On 08/22/2011 06:29 PM, Mike Lococo wrote: This is a long-standing bug, and one that I consider fairly major but has been hard to get puppetlabs focused on. - The circular deps bug was reported 2 years ago. http://projects.puppetlabs.com/issues/1935 - A few months later a patch is submitted to batch rpm transactions. This solves the circular-deps issue and also has significant performance benefits during puppet runs with many package installs. http://projects.puppetlabs.com/issues/2198 This comes up periodically and inevitably someone proposes that the architecturally correct solution is for RedHat not to employ circular deps, which shuts down discussion of a potential solution for another 3-6 months: http://groups.google.com/group/puppet-users/browse_thread/thread/8a083899386909d5/ http://groups.google.com/group/puppet-users/browse_thread/thread/9cbeadad62741b0a/ I could incorporate that patch into RPM's... ensure = purged is obviously not a good idea after all (although it works). I have another question about packages... What if I define something like this: package {'httpd': ensure = absent, } package {'mod_ssl': ensure = latest, } It is obvious that httpd is a dependency of mod_ssl. What will happen in this case?! I'm asking because I have a template for all my machines with minimal package requirements, and I do that with lots of ensure=absent. But if some package requires some of the absent pacakges, what happens then? -- 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: Multiple swap spaces
On Aug 22, 11:46 am, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 08:19:35AM -0700, jcbollinger wrote: On Aug 21, 2:56 pm, Brian Troutwine br...@troutwine.us wrote: [...] Problem is that mount conflates the name of the resource with it's mount path; I'm defining the same thing two ways each time. I _could_ write out my own fstab as a file resource, but that somewhat defeats the purpose of even having a mount type. Am I missing something? Is it possible to have multiple swap spaces with puppet? I'm guessing that this is not supported, but here's a long shot: try altering your second variation to use the 'path' property instead of 'name' (even though the docs say it's deprecated). Even if that works, I recommend filing a ticket: I see no inherent reason why Puppet shouldn't be able to handle this. This wouldnt work because you have two lines in fstab that match each mount resource (one in sync, the other one is not (because device is wrong). And I dont see a way out of it. Well it's a question of the definition of match, now isn't it? Unix permits different file systems to be mounted on the same (logical) mount point, as the OP's example demonstrates. Unix -- some flavors, at least -- also permit the same device to be mounted on multiple mount points. But it is not meaningful or useful to define the same device mounted more than once on the same mount point, so there *is* a unique key for fstab entries and mounted file systems. On a more abstract level, if it's meaningful to the system to have two fstab entries with some particular properties in common, then Puppet's resource model both can and should support that. That's not to say that the current version of Puppet supports it -- I strongly suspect it doesn't. But some future version certainly could and should, hence my recommendation to file a ticket. John -- 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: Multiple swap spaces
On Aug 22, 12:12 pm, Stefan Schulte stefan.schu...@taunusstein.net wrote: Whenever you have the wrong device for a mount in your fstab you end up with mounts in mounts. For me this would happens a lot for nfs mounts where some machines are configured with hostname:/share and others with hostname.domain.tld:/share If puppet identifies a mount with name AND device I will end up with two lines in fstab for the same share. Pretty ugly. Again, Puppet needs to model the application space. I grant, however, that there may be corners that are not cost-effective (in time and resources) to model. Multiple swap spaces are not one of them. Puppet could address this issue by being either smart or configurable about whether multiple fstab entries referring to the same mount point are allowed. Configurable would mean at least one new property on the resource. Smart might anything, but might involve, for example, allowing multiple mounts only on mount points that are not absolute. John -- 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: Breaking operations on errors
On Aug 22, 9:28 am, Brian Troutwine br...@troutwine.us wrote: On Mon, Aug 22, 2011 at 10:11 AM, jcbollinger john.bollin...@stjude.orgwrote: On Aug 19, 7:30 pm, Brian Troutwine br...@troutwine.us wrote: Hello, all. Let's say I am building a super-weapon robot to destroy the world, save for the people on a whitelist, and am using puppet to manage the configuration of this robot. $ cat files/do_not_kill.txt Me Mom Dad Wife The robot will only being its rampage when /root/have_a_good_time exists. My puppet configuration, in part, looks like so: file { '/root/have_a_good_time': ensure = present, ... require = File['/root/do_not_kill.txt'], } file { '/root/do_not_kill.txt': ensure = present, ... source = puppet:///files/donut_kill.txt, } Those with sharp eyes will note that the inclusion of the whitelist will fail miserably: the source is wrong. But then, # puppet agent --test Uh oh. The enabler of the killer robot will be put into place because, despite the error, execution continued and we're all dead, me especially. How do I signal that I want to break execution on errors or, at least, not continue on with the sub-tree of actions which the erroring resource is the root of? You left out the MUWAHAHAAHHH!!! Did you perhaps also leave out the output from 'puppet agent'? The behavior you request is what Puppet normally provides: if applying a resource fails then other resources that depend on it do not get applied. How about posting the output from 'puppet agent --test -- debug' with your manifest? Also, make sure that the agent is actually getting the catalog with those resources. How do I ensure this last bit? The last catalog received from the server is cached on the client in YAML form. Look on the client in /var/lib/puppet. It is fairly readable for simple manifests, but you would probably want a YAML browser for complex ones. John -- 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: exported resources and templating
Hmmm. I upgraded, but when running a test I get: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- puppet/rails/resources (MissingSourceFile) # puppet help hostname err: no such file to load -- puppet/rails/resources There are: /usr/lib/ruby/site_ruby/1.8/puppet/parser/resource /usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb but no resources. I'm think I'm up to date with ruby: ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux] Is there an updated puppet gem that I am missing? Thanks again. On Aug 22, 10:45 am, Nan Liu n...@puppetlabs.com wrote: On Mon, Aug 22, 2011 at 6:11 AM, puppetlurker under.my.cont...@gmail.com wrote: Greetings, I'm having an issue with my implementation of exported resources. I have a memcache server pool, and want to update the /etc/php.d/ memcache.ini with the ips of all the servers. Previously, I hard coded the $memcacheservers array in the node manifest and the template collected and populated the template. Now that I'm moving to exported resouces, how do I get it to set an array in a way I can access it from a different scope? I tried moving the file { /etc/php.d/memcache.ini: content = template(memcache/ memcache.ini.erb) to the resource function (I understand exported resources shoulld not define other resources), but it only populates the first server collected, and complains about a duplicate resource if I have more than 1 exported server. I've tried defining the resource without the content the first time, then override the define with the content, but that only picks up the 2nd server. I've tried accessing the variable that gets populated after the Memcache::Servers | | but it doesn't get populated in this scope. I've tried looking up the scope.lookupvar('memcached::servers::memcacheservers') but the exported resource is a define not a class and I couldn't get it to work. I've tried just using a script to populate the file with the proper contents, but there is no way to ensure it is filled with all the servers, for example the script is executed out of order, replaced 3 times if there are 3 servers, and may contain 1, 2, or 3 servers after a puppet run. Any suggestions? I was looking at a similar issue where I need to export data, not resource, and be able to lookup the data. It just happens that Dan has published a prototype along the line of what you are looking for:https://github.com/puppetlabs/puppetlabs-nodesearch Thanks, Nan -- 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: exported resources and templating
Nevermind, I found it: http://projects.puppetlabs.com/projects/puppet/wiki/Generating_a_config_file_from_fragments On Aug 23, 9:21 am, jcbollinger john.bollin...@stjude.org wrote: On Aug 22, 8:11 am, puppetlurker under.my.cont...@gmail.com wrote: Greetings, I'm having an issue with my implementation of exported resources. I have a memcache server pool, and want to update the /etc/php.d/ memcache.ini with the ips of all the servers. Previously, I hard coded the $memcacheservers array in the node manifest and the template collected and populated the template. Now that I'm moving to exported resouces, how do I get it to set an array in a way I can access it from a different scope? I tried moving the file { /etc/php.d/memcache.ini: content = template(memcache/ memcache.ini.erb) to the resource function (I understand exported resources shoulld not define other resources), but it only populates the first server collected, and complains about a duplicate resource if I have more than 1 exported server. I've tried defining the resource without the content the first time, then override the define with the content, but that only picks up the 2nd server. I've tried accessing the variable that gets populated after the Memcache::Servers | | but it doesn't get populated in this scope. I've tried looking up the scope.lookupvar('memcached::servers::memcacheservers') but the exported resource is a define not a class and I couldn't get it to work. I've tried just using a script to populate the file with the proper contents, but there is no way to ensure it is filled with all the servers, for example the script is executed out of order, replaced 3 times if there are 3 servers, and may contain 1, 2, or 3 servers after a puppet run. Any suggestions? The way to do this with exported resources is for each node to export a resource containing its own information only. The trick is choosing the resource to use for this. The simplest case would be if /etc/php.d/memcache.ini supports some kind of 'include' directive, especially if it understands globs. Then each server can export its own (distinctly-named) file intended for inclusion, and the node(s) that collect them need only to put the appropriate 'include' directive(s) into the main memcache.ini. Alternatively, there is a module available that provides for building files from fragments. Your server could export fragment resources of the type defined by that module, and the node(s) that collect them would use them to build the memcache.ini file. Remember: an exported resource is one that you make available for other nodes to include in their catalogs, as if they were declared in those nodes' own manifests. All the normal rules apply in the context where they are collected. In particular, name and title uniqueness is still required, but for exported resources you may get lost resource data instead of Puppet errors when there are name collisions. John -- 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] Allow node to request a class/module?
We have a need for nodes to specify a class to be included in their catalog. What's the best (?) way to do this? Best I can tell, we'd have to customize the Facter facts reported by the node to the master. -- 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/-/JFR3BY0hyj8J. 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: err: Could not run Puppet configuration client: execution expired
Sadly, Steven, I ran into this same exact problem in Puppet. Your solution won't be found in changing to a different server setup (webrick to Passenger, for instance). I've tested both with a large number of files and they both fall on their face. Puppet simply is not capable of serving large trees of files the way it is designed. The only solution I have found is to make native OS packages to distribute and install (instead of simply transferring the tree of files). Coming from a CFengine backround (and perhaps going right back to it, the verdict is still out), this was a major disappointment to find while evaluating Puppet. It takes CFengine 2.1.x only 1-2 minutes to transfer 14,000 files totalling 147MB. Puppet took many hours and memory growth was enormous. -- 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/-/ov8kSP2h0XQJ. 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] property file provider
I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed #{hash[:name]}=#{hash[:value]} end which handles the other line types. To handle wrapping values in quotes, I changed the type like this; newproperty(:value) do munge do |value| ''+value.to_s+'' end newvalues(/^\S+$/) end so, that line where value.to_s is wrapped with quotes seems to work nicely. My other problem now is that aside from handling these variations # comment lines key=value I also need to handle this; key=value #optional comment I could add to the regex for the line matching (in record_line :parsed). Then, I'm not sure how to get that into to_line for output. David On Mon, Aug 22, 2011 at 8:48 PM, David Kavanagh dkavan...@gmail.com wrote: Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file look like: key=value 1. I'm not getting the quotes surrounding the value, which I think I can figure out myself. 2. I get all blanks and comments replaced by =, which is more of a problem. David require 'puppet/provider/parsedfile' eucaconf = /etc/eucalyptus/eucalyptus.conf Puppet::Type.type(:eucalyptus_config).provide( :parsed, :parent = Puppet::Provider::ParsedFile, :default_target = eucaconf, :filetype = :flat ) do confine :exists = eucaconf text_line :comment, :match = /^#/; text_line :blank, :match = /^\s*$/; record_line :parsed, :fields = %w{line}, :match = /(.*)/ , :post_parse = proc { |hash| Puppet.debug(eucalyptus config line:#{hash[:line]} has been parsed) if hash[:line] =~ /^\s*(\S+)\s*=\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=$2 elsif hash[:line] =~ /^\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=false else raise Puppet::Error, Invalid line: #{hash[:line]} end } instead of the post_parse hook you can probably just change your regex :fields = %w{name value}, :optional = %w{value}, :match = /^\s*(.*?)(?:\s*=\s*(\S+))?\s*$/ This matches line like foo and foo = bar def self.to_line(hash) #{hash[:name]}=#{hash[:value]} end If you just overwrite the to_line method you have to take care of the different record_types (you defined :comment, :text and :parsed). So you have to do def self.to_line(hash) return super unless hash[:record_type] == :parsed if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end end Nevertheless the right thing to do is to pass a block to the record_line method: record_line :parsed, :fields = ..., :match = ..., :to_line = proc { |hash| if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end } Hope that helps. -Stefan -- 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] Resource Defaults and Virtual Resources
Hello, I am trying to set a defaults groups before realize virtual resource (user) The default value is not used, is it possible to define the default groups at this level ? User { groups = 'ops' } realize( User[vincent], .. -- 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.
Re: [Puppet Users] property file provider
On Tue, Aug 23, 2011 at 10:32:54AM -0400, David Kavanagh wrote: I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed #{hash[:name]}=#{hash[:value]} end As I said, I wouldn't to that. Just pass a :to_line = proc {...} to your record_line call because you will then just overwrite the to_line method of that particular record_type. which handles the other line types. To handle wrapping values in quotes, I changed the type like this; newproperty(:value) do munge do |value| ''+value.to_s+'' end newvalues(/^\S+$/) end so, that line where value.to_s is wrapped with quotes seems to work nicely. Hm, in my opinion using a regex that gets the value as an unqoted string and put the quotes back to the string in the to_line method looks saner than munging the value. My other problem now is that aside from handling these variations # comment lines key=value I also need to handle this; key=value #optional comment I could add to the regex for the line matching (in record_line :parsed). Then, I'm not sure how to get that into to_line for output. You have to store the inlinecomment in the record hash and then put it back in the to_line hook. So this should work (to test the regex I recommend rubular.com) record_line :parsed, :fields = %w{name value comment}, :optional = %w{value comment}, :regex= /^\s*(.*?)(?:\s*=\s*(.*?))?(?:\s*#\s*(.*))?\s*$/, :to_line = proc { |hash| str = hash[:name] str += =\#{hash[:value]}\ if hash[:value] != :absent str += # #{hash[:comment]} if hash[:comment] != :absent str } David On Mon, Aug 22, 2011 at 8:48 PM, David Kavanagh dkavan...@gmail.com wrote: Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file look like: key=value 1. I'm not getting the quotes surrounding the value, which I think I can figure out myself. 2. I get all blanks and comments replaced by =, which is more of a problem. David require 'puppet/provider/parsedfile' eucaconf = /etc/eucalyptus/eucalyptus.conf Puppet::Type.type(:eucalyptus_config).provide( :parsed, :parent = Puppet::Provider::ParsedFile, :default_target = eucaconf, :filetype = :flat ) do confine :exists = eucaconf text_line :comment, :match = /^#/; text_line :blank, :match = /^\s*$/; record_line :parsed, :fields = %w{line}, :match = /(.*)/ , :post_parse = proc { |hash| Puppet.debug(eucalyptus config line:#{hash[:line]} has been parsed) if hash[:line] =~ /^\s*(\S+)\s*=\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=$2 elsif hash[:line] =~ /^\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=false else raise Puppet::Error, Invalid line: #{hash[:line]} end } instead of the post_parse hook you can probably just change your regex :fields = %w{name value}, :optional = %w{value}, :match = /^\s*(.*?)(?:\s*=\s*(\S+))?\s*$/ This matches line like foo and foo = bar def self.to_line(hash) #{hash[:name]}=#{hash[:value]} end If you just overwrite the to_line method you have to take care of the different record_types (you defined :comment, :text and :parsed). So you have to do def self.to_line(hash) return super unless hash[:record_type] == :parsed if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end end Nevertheless the right thing to do is to pass a block to the record_line method: record_line :parsed, :fields = ..., :match = ..., :to_line = proc { |hash| if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end } Hope that helps. -Stefan -- 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. pgpH9X2rIXtih.pgp Description: PGP signature
Re: [Puppet Users] Resource Defaults and Virtual Resources
On Tue, Aug 23, 2011 at 7:34 AM, Vincent vlouvi...@gmail.com wrote: Hello, I am trying to set a defaults groups before realize virtual resource (user) The default value is not used, is it possible to define the default groups at this level ? User { groups = 'ops' } realize( User[vincent], .. The resource default should occur before declaration of virtual resource instead of the realize function. User { groups = 'ops' } @user { 'vincent': ... } You can use the other realize syntax to override values (however if the virtual resource @user { 'vincent': } declared a groups attribute it will be replaced with 'ops'): User | title='vincent' | { groups = 'ops', } Thanks, Nan -- 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.
Re: [Puppet Users] Allow node to request a class/module?
On Tue, Aug 23, 2011 at 07:26, jblaine cjbla...@gmail.com wrote: We have a need for nodes to specify a class to be included in their catalog. What's the best (?) way to do this? Best I can tell, we'd have to customize the Facter facts reported by the node to the master. You got it in one: report whatever property of the machine that you want to support, and then on the master use that data to make your decision. Facts are the most obvious way, but if you have some external system you can report into and query from that manually. Daniel -- ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ Made with 100 percent post-consumer electrons -- 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] Difference between include and require
Can someone please succinctly explain to me the difference between include and require? The documentation implies that simply putting 'require class' at the top of a different class automatically means that class is fully implemented as a dependency. However, it doesn't seem to work that way. Also, I'm not seeing a situation where the use of include seems to be automatically resolving dependancies. This is puppet 0.25.5. Doug -- 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.
Re: [Puppet Users] Difference between include and require
It seems there's a problem including a class multiple times. By stating that one class requires another, you formalize the dependency, but don't actually have an include. What you do then is to include the class in your main implementation which uses that class. That way, if you have several classes that depend on one other class, it is included once at the top level, but used many places (where it is required). Is that as clear as I think it is? David On Tue, Aug 23, 2011 at 1:51 PM, Douglas Garstang doug.garst...@gmail.com wrote: Can someone please succinctly explain to me the difference between include and require? The documentation implies that simply putting 'require class' at the top of a different class automatically means that class is fully implemented as a dependency. However, it doesn't seem to work that way. Also, I'm not seeing a situation where the use of include seems to be automatically resolving dependancies. This is puppet 0.25.5. Doug -- 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. -- 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] Parameterized classes vs defined-types
Out of curiosity, how are people using parameterized classes in a way that is distinct from defined-types? -- Digant C Kasundra dig...@stanford.edu Infrastructure Systems Software Developer, ITS:IDG, Stanford University -- 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] 2.7.1 slowness?
Is anyone else noticing slowness with 2.7.1? When I run puppet on my 2.6.8 box, it takes 11 seconds. On my second box with exactly the same catalog, it takes 35 seconds. -- Digant C Kasundra dig...@stanford.edu Infrastructure Systems Software Developer, ITS:IDG, Stanford University -- 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: Dynamic lookup of $var
Same here, Chuck. Updated the issue. -- 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/-/CyGTQlF3kJUJ. 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] property file provider
Hi Stefan, I have it working using your suggestions (I took out my hacks). I adjusted the match regex to match the quotes in the value portion. Otherwise, I kept getting more quotes added in each time the file was processed. The only glitch now is that it always thinks there's a comment, so even if there isn't a comment after the value, it adds a # at the end of line. David On Tue, Aug 23, 2011 at 11:45 AM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Tue, Aug 23, 2011 at 10:32:54AM -0400, David Kavanagh wrote: I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed #{hash[:name]}=#{hash[:value]} end As I said, I wouldn't to that. Just pass a :to_line = proc {...} to your record_line call because you will then just overwrite the to_line method of that particular record_type. which handles the other line types. To handle wrapping values in quotes, I changed the type like this; newproperty(:value) do munge do |value| ''+value.to_s+'' end newvalues(/^\S+$/) end so, that line where value.to_s is wrapped with quotes seems to work nicely. Hm, in my opinion using a regex that gets the value as an unqoted string and put the quotes back to the string in the to_line method looks saner than munging the value. My other problem now is that aside from handling these variations # comment lines key=value I also need to handle this; key=value #optional comment I could add to the regex for the line matching (in record_line :parsed). Then, I'm not sure how to get that into to_line for output. You have to store the inlinecomment in the record hash and then put it back in the to_line hook. So this should work (to test the regex I recommend rubular.com) record_line :parsed, :fields = %w{name value comment}, :optional = %w{value comment}, :regex = /^\s*(.*?)(?:\s*=\s*(.*?))?(?:\s*#\s*(.*))?\s*$/, :to_line = proc { |hash| str = hash[:name] str += =\#{hash[:value]}\ if hash[:value] != :absent str += # #{hash[:comment]} if hash[:comment] != :absent str } David On Mon, Aug 22, 2011 at 8:48 PM, David Kavanagh dkavan...@gmail.com wrote: Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file look like: key=value 1. I'm not getting the quotes surrounding the value, which I think I can figure out myself. 2. I get all blanks and comments replaced by =, which is more of a problem. David require 'puppet/provider/parsedfile' eucaconf = /etc/eucalyptus/eucalyptus.conf Puppet::Type.type(:eucalyptus_config).provide( :parsed, :parent = Puppet::Provider::ParsedFile, :default_target = eucaconf, :filetype = :flat ) do confine :exists = eucaconf text_line :comment, :match = /^#/; text_line :blank, :match = /^\s*$/; record_line :parsed, :fields = %w{line}, :match = /(.*)/ , :post_parse = proc { |hash| Puppet.debug(eucalyptus config line:#{hash[:line]} has been parsed) if hash[:line] =~ /^\s*(\S+)\s*=\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=$2 elsif hash[:line] =~ /^\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=false else raise Puppet::Error, Invalid line: #{hash[:line]} end } instead of the post_parse hook you can probably just change your regex :fields = %w{name value}, :optional = %w{value}, :match = /^\s*(.*?)(?:\s*=\s*(\S+))?\s*$/ This matches line like foo and foo = bar def self.to_line(hash) #{hash[:name]}=#{hash[:value]} end If you just overwrite the to_line method you have to take care of the different record_types (you defined :comment, :text and :parsed). So you have to do def self.to_line(hash) return super unless hash[:record_type] == :parsed if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end end Nevertheless the right thing to do is to pass a block to the record_line method: record_line :parsed, :fields = ..., :match = ..., :to_line = proc { |hash| if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end } Hope that helps. -Stefan -- You
Re: [Puppet Users] property file provider
for reference, here's how the regex matches the trailing comment; http://rubular.com/r/vJUtBWpB6J On Tue, Aug 23, 2011 at 4:17 PM, David Kavanagh dkavan...@gmail.com wrote: Hi Stefan, I have it working using your suggestions (I took out my hacks). I adjusted the match regex to match the quotes in the value portion. Otherwise, I kept getting more quotes added in each time the file was processed. The only glitch now is that it always thinks there's a comment, so even if there isn't a comment after the value, it adds a # at the end of line. David On Tue, Aug 23, 2011 at 11:45 AM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Tue, Aug 23, 2011 at 10:32:54AM -0400, David Kavanagh wrote: I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed #{hash[:name]}=#{hash[:value]} end As I said, I wouldn't to that. Just pass a :to_line = proc {...} to your record_line call because you will then just overwrite the to_line method of that particular record_type. which handles the other line types. To handle wrapping values in quotes, I changed the type like this; newproperty(:value) do munge do |value| ''+value.to_s+'' end newvalues(/^\S+$/) end so, that line where value.to_s is wrapped with quotes seems to work nicely. Hm, in my opinion using a regex that gets the value as an unqoted string and put the quotes back to the string in the to_line method looks saner than munging the value. My other problem now is that aside from handling these variations # comment lines key=value I also need to handle this; key=value #optional comment I could add to the regex for the line matching (in record_line :parsed). Then, I'm not sure how to get that into to_line for output. You have to store the inlinecomment in the record hash and then put it back in the to_line hook. So this should work (to test the regex I recommend rubular.com) record_line :parsed, :fields = %w{name value comment}, :optional = %w{value comment}, :regex = /^\s*(.*?)(?:\s*=\s*(.*?))?(?:\s*#\s*(.*))?\s*$/, :to_line = proc { |hash| str = hash[:name] str += =\#{hash[:value]}\ if hash[:value] != :absent str += # #{hash[:comment]} if hash[:comment] != :absent str } David On Mon, Aug 22, 2011 at 8:48 PM, David Kavanagh dkavan...@gmail.com wrote: Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file look like: key=value 1. I'm not getting the quotes surrounding the value, which I think I can figure out myself. 2. I get all blanks and comments replaced by =, which is more of a problem. David require 'puppet/provider/parsedfile' eucaconf = /etc/eucalyptus/eucalyptus.conf Puppet::Type.type(:eucalyptus_config).provide( :parsed, :parent = Puppet::Provider::ParsedFile, :default_target = eucaconf, :filetype = :flat ) do confine :exists = eucaconf text_line :comment, :match = /^#/; text_line :blank, :match = /^\s*$/; record_line :parsed, :fields = %w{line}, :match = /(.*)/ , :post_parse = proc { |hash| Puppet.debug(eucalyptus config line:#{hash[:line]} has been parsed) if hash[:line] =~ /^\s*(\S+)\s*=\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=$2 elsif hash[:line] =~ /^\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=false else raise Puppet::Error, Invalid line: #{hash[:line]} end } instead of the post_parse hook you can probably just change your regex :fields = %w{name value}, :optional = %w{value}, :match = /^\s*(.*?)(?:\s*=\s*(\S+))?\s*$/ This matches line like foo and foo = bar def self.to_line(hash) #{hash[:name]}=#{hash[:value]} end If you just overwrite the to_line method you have to take care of the different record_types (you defined :comment, :text and :parsed). So you have to do def self.to_line(hash) return super unless hash[:record_type] == :parsed if hash[:value] == :absent hash[:name] else #{hash[:name]}=\#{hash[:value]}\ end end Nevertheless the right thing to do is to pass a block to the record_line method: record_line :parsed, :fields = ..., :match = ..., :to_line = proc {
Re: [Puppet Users] property file provider
I understand regular expressions. been doing them a long time in various languages. But, how are the fields determined from this regex? David On Tue, Aug 23, 2011 at 4:19 PM, David Kavanagh dkavan...@gmail.com wrote: for reference, here's how the regex matches the trailing comment; http://rubular.com/r/vJUtBWpB6J On Tue, Aug 23, 2011 at 4:17 PM, David Kavanagh dkavan...@gmail.com wrote: Hi Stefan, I have it working using your suggestions (I took out my hacks). I adjusted the match regex to match the quotes in the value portion. Otherwise, I kept getting more quotes added in each time the file was processed. The only glitch now is that it always thinks there's a comment, so even if there isn't a comment after the value, it adds a # at the end of line. David On Tue, Aug 23, 2011 at 11:45 AM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Tue, Aug 23, 2011 at 10:32:54AM -0400, David Kavanagh wrote: I did get this working. In a nutshell, I modified to_line like this; def self.to_line(hash) return super unless hash[:record_type] == :parsed #{hash[:name]}=#{hash[:value]} end As I said, I wouldn't to that. Just pass a :to_line = proc {...} to your record_line call because you will then just overwrite the to_line method of that particular record_type. which handles the other line types. To handle wrapping values in quotes, I changed the type like this; newproperty(:value) do munge do |value| ''+value.to_s+'' end newvalues(/^\S+$/) end so, that line where value.to_s is wrapped with quotes seems to work nicely. Hm, in my opinion using a regex that gets the value as an unqoted string and put the quotes back to the string in the to_line method looks saner than munging the value. My other problem now is that aside from handling these variations # comment lines key=value I also need to handle this; key=value #optional comment I could add to the regex for the line matching (in record_line :parsed). Then, I'm not sure how to get that into to_line for output. You have to store the inlinecomment in the record hash and then put it back in the to_line hook. So this should work (to test the regex I recommend rubular.com) record_line :parsed, :fields = %w{name value comment}, :optional = %w{value comment}, :regex = /^\s*(.*?)(?:\s*=\s*(.*?))?(?:\s*#\s*(.*))?\s*$/, :to_line = proc { |hash| str = hash[:name] str += =\#{hash[:value]}\ if hash[:value] != :absent str += # #{hash[:comment]} if hash[:comment] != :absent str } David On Mon, Aug 22, 2011 at 8:48 PM, David Kavanagh dkavan...@gmail.com wrote: Thanks, I'll try to work through your suggestions. I took this from the nova_config stuff on github, so that was my example. David On Mon, Aug 22, 2011 at 7:36 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Mon, Aug 22, 2011 at 06:33:27PM -0400, David Kavanagh wrote: I'm working on a type/provider for the eucalyptus.conf file. What I have generally works for modifying properties. I have a couple of issues and not being very experienced with Ruby and custom providers, I wonder if anyone can help? The code is included below. The key/value constructs in the file look like: key=value 1. I'm not getting the quotes surrounding the value, which I think I can figure out myself. 2. I get all blanks and comments replaced by =, which is more of a problem. David require 'puppet/provider/parsedfile' eucaconf = /etc/eucalyptus/eucalyptus.conf Puppet::Type.type(:eucalyptus_config).provide( :parsed, :parent = Puppet::Provider::ParsedFile, :default_target = eucaconf, :filetype = :flat ) do confine :exists = eucaconf text_line :comment, :match = /^#/; text_line :blank, :match = /^\s*$/; record_line :parsed, :fields = %w{line}, :match = /(.*)/ , :post_parse = proc { |hash| Puppet.debug(eucalyptus config line:#{hash[:line]} has been parsed) if hash[:line] =~ /^\s*(\S+)\s*=\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=$2 elsif hash[:line] =~ /^\s*(\S+)\s*$/ hash[:name]=$1 hash[:value]=false else raise Puppet::Error, Invalid line: #{hash[:line]} end } instead of the post_parse hook you can probably just change your regex :fields = %w{name value}, :optional = %w{value}, :match = /^\s*(.*?)(?:\s*=\s*(\S+))?\s*$/ This matches line like foo and foo = bar def self.to_line(hash) #{hash[:name]}=#{hash[:value]} end If you just overwrite the to_line method you have to take care of the different record_types (you defined :comment, :text and :parsed). So you have to do def self.to_line(hash) return super unless hash[:record_type] == :parsed if hash[:value] == :absent hash[:name] else
[Puppet Users] Host timeouts.
When I try to use mcollective to restart some jboss servers that take a bit of time we get a timeout fail shown below. We are using the mc- shellcmd plugin which does have a timeout of 300 listed in the rb but we move that around and it seems to do no good. Is there a default timeout variable we can set to possibly give us more time for our slow moving jboss implementation? What I see: Finished processing 0 / 2 hosts in 5007.88 ms No response from: host1 host2 -- 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.
Re: [Puppet Users] property file provider
On Tue, Aug 23, 2011 at 04:19:40PM -0400, David Kavanagh wrote: for reference, here's how the regex matches the trailing comment; http://rubular.com/r/vJUtBWpB6J Yes, rubular shows all fields but the last field is in fact nil and not an empty string. Try to replace str += # #{hash[:comment]} if hash[:comment] != :absent with str += # #{hash[:comment]} unless hash[:comment].nil? Does this work? -Stefan pgprmXlf1wiyo.pgp Description: PGP signature
Re: [Puppet Users] property file provider
Like a charm! What designates the fields in the regex? I'm having trouble finding documentation on that part. David On Tue, Aug 23, 2011 at 4:59 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Tue, Aug 23, 2011 at 04:19:40PM -0400, David Kavanagh wrote: for reference, here's how the regex matches the trailing comment; http://rubular.com/r/vJUtBWpB6J Yes, rubular shows all fields but the last field is in fact nil and not an empty string. Try to replace str += # #{hash[:comment]} if hash[:comment] != :absent with str += # #{hash[:comment]} unless hash[:comment].nil? Does this work? -Stefan -- 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.
Re: [Puppet Users] property file provider
On Tue, Aug 23, 2011 at 04:27:30PM -0400, David Kavanagh wrote: I understand regular expressions. been doing them a long time in various languages. But, how are the fields determined from this regex? David You have to put everything you want to capture in parentheses, so /^Hello (.*)$/.match('Hello World').captures == ['World'] However if you want to just define a block and you don't want to capture it you can use (?: and ) instead of ( and ). I used that in the regex like in (?:\s*=\s*(.*?))? This means there is an optional equal sign with stuff after it as indicated by the quotation mark after the block marked with the outer parentheses (?: and ). But I dont want to capture the whole block so I just capture what is after the equal sign (the inner parentheses). Does this answers your question? -Stefan pgpFVghA6uyOC.pgp Description: PGP signature
[Puppet Users] Re: Host timeouts.
Oops, sorry, I moved this message over to mcollective users google groups. On Aug 23, 1:55 pm, Charlie Wyse charlie.w...@gmail.com wrote: When I try to use mcollective to restart some jboss servers that take a bit of time we get a timeout fail shown below. We are using the mc- shellcmd plugin which does have a timeout of 300 listed in the rb but we move that around and it seems to do no good. Is there a default timeout variable we can set to possibly give us more time for our slow moving jboss implementation? What I see: Finished processing 0 / 2 hosts in 5007.88 ms No response from: host1 host2 -- 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.
Re: [Puppet Users] property file provider
yes, That's actually does. I wasn't finding much to read about this. David On Tue, Aug 23, 2011 at 5:12 PM, Stefan Schulte stefan.schu...@taunusstein.net wrote: On Tue, Aug 23, 2011 at 04:27:30PM -0400, David Kavanagh wrote: I understand regular expressions. been doing them a long time in various languages. But, how are the fields determined from this regex? David You have to put everything you want to capture in parentheses, so /^Hello (.*)$/.match('Hello World').captures == ['World'] However if you want to just define a block and you don't want to capture it you can use (?: and ) instead of ( and ). I used that in the regex like in (?:\s*=\s*(.*?))? This means there is an optional equal sign with stuff after it as indicated by the quotation mark after the block marked with the outer parentheses (?: and ). But I dont want to capture the whole block so I just capture what is after the equal sign (the inner parentheses). Does this answers your question? -Stefan -- 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.
Re: [Puppet Users] Difference between include and require
Yes... that's what I had On Tue, Aug 23, 2011 at 10:53 AM, David Kavanagh dkavan...@gmail.comwrote: It seems there's a problem including a class multiple times. By stating that one class requires another, you formalize the dependency, but don't actually have an include. What you do then is to include the class in your main implementation which uses that class. That way, if you have several classes that depend on one other class, it is included once at the top level, but used many places (where it is required). Is that as clear as I think it is? David On Tue, Aug 23, 2011 at 1:51 PM, Douglas Garstang doug.garst...@gmail.com wrote: Can someone please succinctly explain to me the difference between include and require? The documentation implies that simply putting 'require class' at the top of a different class automatically means that class is fully implemented as a dependency. However, it doesn't seem to work that way. Also, I'm not seeing a situation where the use of include seems to be automatically resolving dependancies. This is puppet 0.25.5. Doug -- 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. -- 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. -- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garst...@gmail.com Cell: +1-805-340-5627 -- 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.
Re: [Puppet Users] property file provider
On Tue, Aug 23, 2011 at 05:47:07PM -0400, David Kavanagh wrote: yes, That's actually does. I wasn't finding much to read about this. David Maybe http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UN -Stefan pgppZP1OBsrlU.pgp Description: PGP signature
[Puppet Users] Re: facter identifies Oracle Linux 6.1 as 'RedHat'
Hi, On Aug 23, 8:58 am, Jeffrey jeffreymle...@yahoo.com wrote: Noticed today that facter-1.6.0 is reporting Oracle Linux 6.1 as RedHat. I've added an issue for this on the Puppet Labs site[1] and submitted a patch via GitHub to determine OracleLinux properly from 5 Update 6 and 6. This adds OracleLinux as an operatingsystem. Cheers, Avi [1] http://projects.puppetlabs.com/issues/9178 -- 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.