I''ve got a generic user "java" that owns Java applications. Due to circumstances beyond my control, I cannot dictate a change here, so I need to make Puppet work with the infrastructure on hand. The big problem, though, is that java''s home directory varies with the application that''s being run. My thought for working around this was class jboss { include users User["java"]{home => "/home/app1" realize(User["java"]) } where java is declared in class users { @user{"java": uid=500, gid=501} } Sadly, I get "err: Could not retrieve catalog from remote server: Error 400 on SERVER: Only subclasses can override parameters at /var/puppet/src/modules/jboss/manifests/init.pp:23". Is there any way to do this that isn''t going to cause me severe pain? I suppose I can use a define for this particular account, but it seems ... stupid. -- 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.
On Jun 14, 1:14 pm, Brian Gallew <g...@gallew.org> wrote:> class jboss { > include users > User["java"]{home => "/home/app1" > realize(User["java"])} > > where java is declared in > > class users { > @user{"java": uid=500, gid=501} > > }Brian, I''m still in .24.8 land, so some of this is WAG. For your stated example the error means you need to use ''class jboss inherits users { }''[1]. This puts your Class[jboss] resources in the right scope so you can redefine existing resources from Class[users]. The existing ''include users'' will add that puppetclass, and resources, to your node but you aren''t in the correct scope to redefine them. You might also try #1088[2] style collections, with overrides[3]. I haven''t used these, but I think you''d do something like: class users { @user{ "java": uid => 500, gid => 500 } } class jboss { include users User <| name == "java" |> { home => "/home/app1" } } class notjboss { include users User <| name == "java" |> { home => "/home/app2" } } [1] http://docs.reductivelabs.com/guides/language_tutorial.html#classes [2] http://projects.puppetlabs.com/issues/1088 [3] http://docs.reductivelabs.com/guides/exported_resources.html -- 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.
Thanks. I''ll try that when I get in to the office tomorrow. On Mon, Jun 14, 2010 at 4:00 PM, donavan <donavan@desinc.net> wrote:> On Jun 14, 1:14 pm, Brian Gallew <g...@gallew.org> wrote: > > class jboss { > > include users > > User["java"]{home => "/home/app1" > > realize(User["java"])} > > > > where java is declared in > > > > class users { > > @user{"java": uid=500, gid=501} > > > > } > > Brian, > > I''m still in .24.8 land, so some of this is WAG. > For your stated example the error means you need to use ''class jboss > inherits users { }''[1]. This puts your Class[jboss] resources in the > right scope so you can redefine existing resources from Class[users]. > The existing ''include users'' will add that puppetclass, and resources, > to your node but you aren''t in the correct scope to redefine them. > > You might also try #1088[2] style collections, with overrides[3]. I > haven''t used these, but I think you''d do something like: > > class users { > @user{ "java": uid => 500, gid => 500 } > } > > class jboss { > include users > User <| name == "java" |> { home => "/home/app1" } > } > > class notjboss { > include users > User <| name == "java" |> { home => "/home/app2" } > } > > [1] http://docs.reductivelabs.com/guides/language_tutorial.html#classes > [2] http://projects.puppetlabs.com/issues/1088 > [3] http://docs.reductivelabs.com/guides/exported_resources.html > > -- > 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<puppet-users%2Bunsubscribe@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.
On 14.06.2010 22:14, Brian Gallew wrote:> I''ve got a generic user "java" that owns Java applications. Due to > circumstances beyond my control, I cannot dictate a change here, so I > need to make Puppet work with the infrastructure on hand. The big > problem, though, is that java''s home directory varies with the > application that''s being run. My thought for working around this was > > class jboss { > include users > User["java"]{home => "/home/app1" > realize(User["java"]) > } > where java is declared in > > class users { > @user{"java": uid=500, gid=501} > } > > Sadly, I get "err: Could not retrieve catalog from remote server: Error > 400 on SERVER: Only subclasses can override parameters at > /var/puppet/src/modules/jboss/manifests/init.pp:23". Is there any way > to do this that isn''t going to cause me severe pain? I suppose I can > use a define for this particular account, but it seems ... stupid.The documentation is very unfortunately using Users as example for virtual resources when in actuality they seldom need this extra indirection. I''d recommend the following approach in you case:> class java { > user { java: ... } > } > > class jboss inherits java { > User[java] { home => "/home/jboss" } > } > > class tomcat inherits java { > User[java] { home => "/home/tomcat" } > }This will set the home of "java" to either of the two specified values, depending on which of the two classes jboss or tomcat you include. Including both leads to an error, keeping you from creating impossible configs. Best Regards, David -- 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.