On Thursday, June 28, 2012 8:29:25 AM UTC-5, Felix.Frank wrote: > > Then I shall go on a limb an suggest you forego camel-case (*cringe*) > and rename to ruby::gem_install, see if that helps. Otherwise I'd be > grateful for yet another verbatim copy of your defined type, also the > information in which manifest file the type declaration resides. > > define ruby::gem_install ( $r_gem = $name, $r_path = hiera('v_rubygem_path') ){
$r_gemName = regsubst($r_gem, '([^-]+)-.*\.gem', '\1') exec { "gem_install_${r_gem}": command => "/usr/local/bin/gem install ${r_gem}", cwd => $r_path, unless => "gem list -i ${r_gemName}", require => [ Package['rubygems'], File['gem_repo'] ], } } This works, but it appears to be executing for the whole list of gems I am passing it, even though those gems are already installed and the unless command should prevent it. But that's another matter that I should be able to figure out on my own. I did some other testing, and I noticed something that took me off guard and ready to file a bug report, though after a little research seems to at least be somewhat documented as intended behavior. I was trying to debug why it was still running the install command, so I changed my define slightly: define ruby::gem_install ( $r_gem = $name, $r_path = hiera('v_rubygem_path') ){ $r_gemName = regsubst($r_gem, '([^-]+)-.*\.gem', '\1') $r_gemVer = regsubst($r_gem, '[^-]+-(.*)\.gem', '\1') notify{"notify_1_${r_gem}": message => "r_path is: ${r_path} || r_gem is: ${r_gem} || r_gemName is: ${r_gemName} || r_gemVer is: ${r_gemVer}", } } This has all the expected values, and it lives in /etc/puppet/environments/test/modules/ruby/manifests/gem_install.pp. I then copied the file, renamed it to /etc/puppet/environments/test/modules/ruby/manifests/gemInstall.pp. I changed the first line, and ONLY the first line to: define ruby::gemInstall ( In my node def I am working on, I have the following: ruby::gem_install { 'actionmailer': r_gem => 'actionmailer-3.1.3.gem', r_path => hiera('v_rubygem_path'), } ruby::gemInstall { 'actionmailer': r_gem => 'actionmailer-3.1.3.gem', r_path => hiera('v_rubygem_path'), } And I get the following (same error as before): err: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type ruby::gemInstall at /etc/puppet/environments/test/manifests/nodes/MyTestNodeDef.pp:69 on node X I could have sworn I saw something that said acceptable names for classes/defines/variables was [a-z][a-zA-Z0-9]*, but when I went looking what I found was instead: "Class names, module names, and the names of defined and custom resource types should be restricted to lowercase alphanumeric characters and underscores, and should begin with a lowercase letter; that is, they should match the expression [a-z][a-z0-9_]*. Although some names that violate these restrictions currently work, using them is not recommended." But this was somewhat buried in the Language Guide (http://docs.puppetlabs.com/guides/language_guide.html), and I (later) found something along the same lines at http://docs.puppetlabs.com/puppet/2.7/reference/modules_fundamentals.html. The Style Guide (http://docs.puppetlabs.com/guides/style_guide) only says "When defining variables you should only use letters, numbers and underscores. You should specifically not make use of dashes." and makes no mention of not using camelCase. This document also makes no mention of case restrictions on class and define names. >From the tutorial section on defines (http://docs.puppetlabs.com/learning/definedtypes.html) no mention of an all lowercase requirement is made at all, though all examples are in all lowercase. Then again, none of the examples would be cases where people are likely to have wanted to use mixed case. On a second reading of the tutorial I did find a brief mention that class names have to be all lowercase, which I seem to have missed. The other rather interesting thing is that when I had my define in the same file as a class definition, it worked as expected. It was only after I moved the defines to their own files (as per the style guide) that I started having this problem. So... long story short, this is the second time in two weeks I am having to refactor all my code in order to prepare for a point release upgrade. While the overall software is very nice, and the support I have received when I have needed it has been very helpful, I am less than happy with this software right now. And while I do recognize that both rewrites could have been avoided with a more careful reading of the documentation, I and my team should not have to pick through the documentation line by line like it was some sort of contract I was getting ready to sign. For what it is worth, I think the forcing of all lowercase variables/classes/defines/modules is serious design flaw - even worse than not allowing hyphens, which I consider to be a pretty serious flaw (and from reading this list and various other bug reports, a lot of people agree) -- 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/-/VvJcDmhkKXEJ. 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.