I have written a module with a init class. Now I have to pass a dynamic value. so I have created a params class and inherited in the init class and trying to access the value. But puppet says Could not find parent resource type <myclass>::params of type hostclass error. Any idea? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ff29ad11-7e0f-4f9e-bfa4-2db5010923be%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
This looks pretty bad :-) Can you paste (excerpts of) your manifest code on pastebin or a similar service? On 11/21/2013 10:11 AM, Raj kumar V wrote:> I have written a module with a init class. Now I have to pass a dynamic > value. so I have created a params class and inherited in the init class > and trying to access the value. But puppet says > > Could not find parent resource type <myclass>::params of type hostclass > > error. Any idea?-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/528DDC65.2020006%40alumni.tu-berlin.de. For more options, visit https://groups.google.com/groups/opt_out.
In my module folder, <module/mymodule> I have 2 files. init.pp params.pp My init code: class myclass($api_key=$myclass::params::myclassagent_APIkey) inherits myclass::params{ include myclass::params some code here... }include myclass params.pp got: class myclass::params{ myclassagent_APIkey='' '' } What am i missing? On Thursday, 21 November 2013 15:41:49 UTC+5:30, Felix.Frank wrote:> > This looks pretty bad :-) > > Can you paste (excerpts of) your manifest code on pastebin or a similar > service? > > On 11/21/2013 10:11 AM, Raj kumar V wrote: > > I have written a module with a init class. Now I have to pass a dynamic > > value. so I have created a params class and inherited in the init class > > and trying to access the value. But puppet says > > > > Could not find parent resource type <myclass>::params of type hostclass > > > > error. Any idea? >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f59055d3-7888-400f-9f46-3bd02fe3160a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Hi, comments inline. On 11/21/2013 12:17 PM, Raj kumar V wrote:> In my module folder, <module/mymodule> > > I have 2 files. > > init.pp > params.pp > > My init code: > > class myclass($api_key=$myclass::params::myclassagent_APIkey) inherits > myclass::params{No need to inherit the params class. I would get rid of that first.> include myclass::paramsThis is likely needed, although I''m not sure wether $myclass::params::myclassagent_APIkey will already be available when puppet encounters the class declaration header.> some code here... > > }include myclass > > params.pp got: > > class myclass::params{ > myclassagent_APIkey='' '' > }That looks all right, except for the missing $ on the variable name. HTH, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/528DF5F5.8030205%40alumni.tu-berlin.de. For more options, visit https://groups.google.com/groups/opt_out.
And to make autoloading work : ...modules/myclass/init.pp /params.pp hth Jo On 11/21/2013 01:00 PM, Felix Frank wrote:> Hi, > > comments inline. > > On 11/21/2013 12:17 PM, Raj kumar V wrote: >> In my module folder, <module/mymodule> >> >> I have 2 files. >> >> init.pp >> params.pp >> >> My init code: >> >> class myclass($api_key=$myclass::params::myclassagent_APIkey) inherits >> myclass::params{ > No need to inherit the params class. I would get rid of that first. > >> include myclass::params > This is likely needed, although I''m not sure wether > $myclass::params::myclassagent_APIkey will already be available when > puppet encounters the class declaration header. > >> some code here... >> >> }include myclass >> >> params.pp got: >> >> class myclass::params{ >> myclassagent_APIkey='' '' >> } > That looks all right, except for the missing $ on the variable name. > > HTH, > Felix >-- Johan De Wit Open Source Consultant Red Hat Certified Engineer (805008667232363) Puppet Certified Professional 2013 (PCP0000006) _________________________________________________________ Open-Future Phone +32 (0)2/255 70 70 Zavelstraat 72 Fax +32 (0)2/255 70 71 3071 KORTENBERG Mobile +32 (0)474/42 40 73 BELGIUM http://www.open-future.be _________________________________________________________ Next Events: Puppet Advanced Training | https://www.open-future.be/puppet-advanced-training-12-till-14th-november Zabbix Certified Training | http://www.open-future.be/zabbix-certified-training-18-till-20th-november Zabbix Large Environments Training | http://www.open-future.be/zabbix-large-environments-training-21-till-22nd-november Puppet Fundamentals Training | http://www.open-future.be/puppet-fundamentals-training-10-till-12th-december Subscribe to our newsletter | http://eepurl.com/BUG8H -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/528DF77E.7080808%40open-future.be. For more options, visit https://groups.google.com/groups/opt_out.
Still the same error. I have the params in the same init location. http://pastebin.com/nCmcgMi4 look at the pp scripts here.... On Thursday, 21 November 2013 14:41:01 UTC+5:30, Raj kumar V wrote:> > I have written a module with a init class. Now I have to pass a dynamic > value. so I have created a params class and inherited in the init class and > trying to access the value. But puppet says > > Could not find parent resource type <myclass>::params of type hostclass > > error. Any idea? >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c6c1d05b-4e7a-46cc-9876-a726a421bb46%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Warning: Scope(Class[<>]): Could not look up qualified variable ''<>::params::<>_APIkey''; class <>::params could not be found Warning: Scope(Class[<>]): Could not look up qualified variable ''<>::params::<>_APIkey''; class <>::params could not be found Error: Could not find class site24x7::params for <machine name> On Thursday, 21 November 2013 14:41:01 UTC+5:30, Raj kumar V wrote:> > I have written a module with a init class. Now I have to pass a dynamic > value. so I have created a params class and inherited in the init class and > trying to access the value. But puppet says > > Could not find parent resource type <myclass>::params of type hostclass > > error. Any idea? >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c53f59b2-c58e-4b0a-8540-aa2cd3d7cc20%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Felix Frank
2013-Nov-21 12:39 UTC
Re: [Puppet Users] Re: Could not find parent resource type
Just a quick remark: If anonymisation is an issue for you, you should definitely go back to pastebin and anynonymise the code there as well. I notice some anti-patterns, but nothing stands out to me that should make the agent fail like that... Cheers, Felix On 11/21/2013 01:26 PM, Raj kumar V wrote:> Warning: Scope(Class[<>]): Could not look up qualified variable > ''<>::params::<>_APIkey''; class <>::params could not be found > > Warning: Scope(Class[<>]): Could not look up qualified variable > ''<>::params::<>_APIkey''; class <>::params could not be found > Error: Could not find class site24x7::params for <machine name>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/528DFEF3.8010706%40alumni.tu-berlin.de. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, November 21, 2013 6:07:26 AM UTC-6, Johan De Wit wrote:> > And to make autoloading work : > > ...modules/myclass/init.pp > /params.pp > >Make that modules/myclass/*manifests*/init.pp and modules/myclass/*manifests*/params.pp John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/43c0cc9f-06b5-4cc5-ad29-e744f611bf0b%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, November 21, 2013 6:00:53 AM UTC-6, Felix.Frank wrote:> > On 11/21/2013 12:17 PM, Raj kumar V wrote: > > In my module folder, <module/mymodule> > > > > I have 2 files. > > > > init.pp > > params.pp > > > > My init code: > > > > class myclass($api_key=$myclass::params::myclassagent_APIkey) inherits > > myclass::params{ > > No need to inherit the params class. I would get rid of that first. >I''m afraid there *is* a reason: class myclass uses a variable from class myclass::params as the default value for its class parameter. The only self-contained way to ensure that that variable''s value is already set when class myclass is evaluated is to inherit from myclass::params. I don''t like that much, but it has become a widely-used pattern.> > > include myclass::params > > This is likely needed, although I''m not sure wether > $myclass::params::myclassagent_APIkey will already be available when > puppet encounters the class declaration header. >That''s absolutely unneeded if the class inherits from myclass::params, as shown. On the other hand, it would be needed and appropriate if the body of class myclass used any variables of class myclass::params and myclass did not inherit from myclass::params.> > some code here... > > > > }include myclass >I''m not very comfortable with putting that ''include'' statement at top level of the module''s init.pp. I think I understand the idea, but it could lead to subtle errors. In fact, it leaves you in the realm of undocumented behavior if you ever try to declare class myclass elsewhere via a parameterized-style declaration (not that I generally account parameterized-style class declarations a good idea, but that seems the direction this is heading). John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d70b79a6-5130-41ac-b358-c4a6ea0e3bd5%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.