Hi, I need to define the hostclass with special character for ex: "swift::proxy-ring" I have tried following ways but not worked: 1) hostclass :swift::proxy-ring do 2) hostclass ''swift::proxy-ring'' do 3) hostclass "swift::proxy-ring" do When I am using the 2 and 3 options it is giving following erroe: undefined method `[]'' for Class:Class at line 1 on node puppet- swproxy.persistent.co.in Thanks in advance, Sateesh B. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2012-Feb-08 12:35 UTC
Re: [Puppet Users] define hostclass with special characters
On 02/08/2012 12:57 PM, sateesh wrote:> I need to define the hostclass with special character for ex: > "swift::proxy-ring"Uhm...why? Dashes are not allowed in any puppet classes. Why do you want them so much? Can you not simply substitute and underscore (_) ? Cheers, Felix -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi Felix, Even I tried to remove that Hiphen and tried. Stil I am getting the same error. dir structure is /modules/swift/manifests/proxyinstall.rb in this I have declared the class hostclass "swift::proxyring" do #code here end Still I am getting same error. Can you give an example for that. Thanks, Sateesh B. On Feb 8, 5:35 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote:> On 02/08/2012 12:57 PM, sateesh wrote: > > > I need to define the hostclass with special character for ex: > > "swift::proxy-ring" > > Uhm...why? Dashes are not allowed in any puppet classes. Why do you want > them so much? Can you not simply substitute and underscore (_) ? > > Cheers, > Felix-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
sorry the dir structure is /modules/swift/manifests/proxyring.rb On Feb 8, 6:17 pm, sateesh <bbalasate...@gmail.com> wrote:> Hi Felix, > > Even I tried to remove that Hiphen and tried. Stil I am getting the > same error. > > dir structure is > > /modules/swift/manifests/proxyinstall.rb > > in this I have declared the class > > hostclass "swift::proxyring" do > #code here > end > > Still I am getting same error. > > Can you give an example for that. > > Thanks, > Sateesh B. > > On Feb 8, 5:35 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> > wrote: > > > On 02/08/2012 12:57 PM, sateesh wrote: > > > > I need to define the hostclass with special character for ex: > > > "swift::proxy-ring" > > > Uhm...why? Dashes are not allowed in any puppet classes. Why do you want > > them so much? Can you not simply substitute and underscore (_) ? > > > Cheers, > > Felix > >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Please give me any example for implementing this. Also when I am writing Puppet DSL, it is allowing me the dashes. On Feb 8, 5:35 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote:> On 02/08/2012 12:57 PM, sateesh wrote: > > > I need to define the hostclass with special character for ex: > > "swift::proxy-ring" > > Uhm...why? Dashes are not allowed in any puppet classes. Why do you want > them so much? Can you not simply substitute and underscore (_) ? > > Cheers, > Felix-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2012-Feb-08 13:27 UTC
Re: [Puppet Users] Re: define hostclass with special characters
On 02/08/2012 02:19 PM, sateesh wrote:> Please give me any example for implementing this. Also when I am > writing Puppet DSL, it is allowing me the dashes.Sorry, I have no idea what you''re trying to do. I never heard of "hostclass". I just reacted to your statement that "special characters" were your issue, which struck me as odd. Regards, Felix -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Walter Heck
2012-Feb-08 13:31 UTC
Re: [Puppet Users] Re: define hostclass with special characters
Also no idea what you are trying to do, but your manifest should have .pp as it''s extension. On Wed, Feb 8, 2012 at 15:27, Felix Frank <felix.frank@alumni.tu-berlin.de> wrote:> On 02/08/2012 02:19 PM, sateesh wrote: >> Please give me any example for implementing this. Also when I am >> writing Puppet DSL, it is allowing me the dashes. > > Sorry, I have no idea what you''re trying to do. I never heard of > "hostclass". I just reacted to your statement that "special characters" > were your issue, which struck me as odd. > > Regards, > Felix > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- Walter Heck -- follow @walterheck on twitter to see what I''m up to! -- Check out my new startup: Server Monitoring as a Service @ http://tribily.com Follow @tribily on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/tribily -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, I found what is the issue. The issue is in exec I am using require attribute in which I specified :require => Class[''swift::proxy-install''] How should I need to specify this in Ruby DSL. Thanks, Sateesh B. On Feb 8, 5:35 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote:> On 02/08/2012 12:57 PM, sateesh wrote: > > > I need to define the hostclass with special character for ex: > > "swift::proxy-ring" > > Uhm...why? Dashes are not allowed in any puppet classes. Why do you want > them so much? Can you not simply substitute and underscore (_) ? > > Cheers, > Felix-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan White
2012-Feb-08 14:29 UTC
Re: [Puppet Users] define hostclass with special characters
http://projects.puppetlabs.com/issues/5268 FYI: According to this bug-report, Ruby does not allow a dash in a class name, so neither does Puppet Try underscore instead: proxy_ring “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- sateesh <bbalasateesh@gmail.com> wrote:> Hi, > > I need to define the hostclass with special character for ex: > "swift::proxy-ring" > > I have tried following ways but not worked: > > 1) hostclass :swift::proxy-ring do > 2) hostclass ''swift::proxy-ring'' do > 3) hostclass "swift::proxy-ring" do > > When I am using the 2 and 3 options it is giving following erroe: > > undefined method `[]'' for Class:Class at line 1 on node puppet- > swproxy.persistent.co.in > > Thanks in advance, > Sateesh B. > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Feb-08 17:19 UTC
[Puppet Users] Re: define hostclass with special characters
On Feb 8, 7:31 am, Walter Heck <walterh...@gmail.com> wrote:> Also no idea what you are trying to do, but your manifest should have > .pp as it''s extension. > > On Wed, Feb 8, 2012 at 15:27, Felix Frank > > > > <felix.fr...@alumni.tu-berlin.de> wrote: > > On 02/08/2012 02:19 PM, sateesh wrote: > >> Please give me any example for implementing this. Also when I am > >> writing Puppet DSL, it is allowing me the dashes. > > > Sorry, I have no idea what you''re trying to do. I never heard of > > "hostclass".He is writing in Ruby DSL, not Puppet DSL, which is why the file has extension .rb. "hostclass" in Ruby DSL is analogous to "class" in Puppet DSL. I am by no means well-versed in Ruby DSL, but it seems suspicious to me that he is passing a String object to the hostclass() function when that function''s usual first argument is a symbol. It is possible that manually converting the string to a symbol would solve the issue: hostclass "swift::proxy_ring".to_sym do # ... end Of course, that begs the question of why he wouldn''t just write hostclass :''swift::proxy_ring'' do # ... end My Ruby-fu is mediocre at best, but I think the quotes are required because the symbol''s string value contains colons. The initial colon is definitely required as part of the syntax for a symbol literal. 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi John, I have solve that class issue. I have specified that as hostclass :''swift::proxy-ring'' and it worked. My problem is I have to run the exec command in the script for which the Class "swift::proxy- install" is required. So, in general puppet DSL we will write that as follows: exec {"somelabel": command => "command here", require => Class[''swift::proxy-install''] } I need the equivalent Ruby DSL code. I have written the following: create_resource :exec, "some label", :command => "command here", :require => Class[''swift::proxy-install'']. Here I got error because I place Class[''swift::proxy-install''] in require attribute. As Class is pre-defined in Ruby, we need to write it another way in Puppet DSL. I want that statement in Ruby DSL. Thanks in advance, Sateesh B. On Feb 8, 10:19 pm, jcbollinger <John.Bollin...@stJude.org> wrote:> On Feb 8, 7:31 am, Walter Heck <walterh...@gmail.com> wrote: > > > Also no idea what you are trying to do, but your manifest should have > > .pp as it''s extension. > > > On Wed, Feb 8, 2012 at 15:27, Felix Frank > > > <felix.fr...@alumni.tu-berlin.de> wrote: > > > On 02/08/2012 02:19 PM, sateesh wrote: > > >> Please give me any example for implementing this. Also when I am > > >> writing Puppet DSL, it is allowing me the dashes. > > > > Sorry, I have no idea what you''re trying to do. I never heard of > > > "hostclass". > > He is writing in Ruby DSL, not Puppet DSL, which is why the file has > extension .rb. "hostclass" in Ruby DSL is analogous to "class" in > Puppet DSL. > > I am by no means well-versed in Ruby DSL, but it seems suspicious to > me that he is passing a String object to the hostclass() function when > that function''s usual first argument is a symbol. It is possible that > manually converting the string to a symbol would solve the issue: > > hostclass "swift::proxy_ring".to_sym do > # ... > end > > Of course, that begs the question of why he wouldn''t just write > > hostclass :''swift::proxy_ring'' do > # ... > end > > My Ruby-fu is mediocre at best, but I think the quotes are required > because the symbol''s string value contains colons. The initial colon > is definitely required as part of the syntax for a symbol literal. > > 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Eric Shamow
2012-Feb-09 04:42 UTC
Re: [Puppet Users] Re: define hostclass with special characters
Sateesh, Still not following why you need to use the Ruby DSL. There are many great reasons to ultimately use the Ruby DSL, but right now you are seemingly struggling to learn/understand Puppet fundamentals. I would strongly suggest that the Puppet DSL is there for a reason - it will help you structure your thinking to match the infrastructure you''re working with. -Eric -- Eric Shamow Professional Services http://puppetlabs.com/ (c)631.871.6441 On Wednesday, February 8, 2012 at 11:37 PM, sateesh wrote:> Hi John, > > I have solve that class issue. I have specified that as > hostclass :''swift::proxy-ring'' and it worked. My problem is I have to > run the exec command in the script for which the Class "swift::proxy- > install" is required. So, in general puppet DSL we will write that as > follows: > > exec {"somelabel": > command => "command here", > require => Class[''swift::proxy-install''] > } > > I need the equivalent Ruby DSL code. I have written the following: > > create_resource :exec, "some label", :command => "command > here", :require => Class[''swift::proxy-install'']. > > Here I got error because I place Class[''swift::proxy-install''] in > require attribute. As Class is pre-defined in Ruby, we need to write > it another way in Puppet DSL. I want that statement in Ruby DSL. > > Thanks in advance, > Sateesh B. > > On Feb 8, 10:19 pm, jcbollinger <John.Bollin...@stJude.org (http://stJude.org)> wrote: > > On Feb 8, 7:31 am, Walter Heck <walterh...@gmail.com (http://gmail.com)> wrote: > > > > > Also no idea what you are trying to do, but your manifest should have > > > .pp as it''s extension. > > > > > > > > > > On Wed, Feb 8, 2012 at 15:27, Felix Frank > > > > > <felix.fr (http://felix.fr)...@alumni.tu-berlin.de (http://alumni.tu-berlin.de)> wrote: > > > > On 02/08/2012 02:19 PM, sateesh wrote: > > > > > Please give me any example for implementing this. Also when I am > > > > > writing Puppet DSL, it is allowing me the dashes. > > > > > > > > > > > > > > > > > > > > > > > > > > > Sorry, I have no idea what you''re trying to do. I never heard of > > > > "hostclass". > > > > > > > > > > > > > He is writing in Ruby DSL, not Puppet DSL, which is why the file has > > extension .rb. "hostclass" in Ruby DSL is analogous to "class" in > > Puppet DSL. > > > > I am by no means well-versed in Ruby DSL, but it seems suspicious to > > me that he is passing a String object to the hostclass() function when > > that function''s usual first argument is a symbol. It is possible that > > manually converting the string to a symbol would solve the issue: > > > > hostclass "swift::proxy_ring".to_sym do > > # ... > > end > > > > Of course, that begs the question of why he wouldn''t just write > > > > hostclass :''swift::proxy_ring'' do > > # ... > > end > > > > My Ruby-fu is mediocre at best, but I think the quotes are required > > because the symbol''s string value contains colons. The initial colon > > is definitely required as part of the syntax for a symbol literal. > > > > 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 (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.