On Thursday, November 14, 2013 5:32:50 AM UTC-6, Patricia Jung wrote:
>
> Dear puppet wizards, 
>
> http://docs.puppetlabs.com/puppet/3/reference/lang_defined_types.htmldoes not 
> suggest to me that nested parametrized defines would be forbidden



You are correct.  Defined type bodies may declare resources of any type, 
including defined types.

 

> , hence I expected the following code to work: 
>
> add_to_ssh_authorized_keys.pp: 
> -------- 
> define a::ssh_keys::add_to_ssh_authorized_keys($homebasedir="/home", 
> $targetuser="root", $keyowner, $keyownername, $state="present" ) { 
>


To be clear, that should appear in <module 
path>/a/manifests/ssh_keys/add_to_ssh_authorized_keys.pp in order for the 
autoloader to be able to find it.

 

> it_services_admins.pp: 
> --------- 
> define a::ssh_keys::it_services_admins($user='root'){ 
>


Likewise, that should appear in <module 
path>/a/manifests/ssh_keys/it_services_admins.pp

 

>
>     censhare::ssh_keys::add_to_ssh_authorized_keys{ "$user-blah": 
>         targetuser => "$user", 
>         keyowner => 'blah', 
>         keyownername => 'blah', 
>     } 
>


That resource type is not declared among the manifest fragments you 
presented, although there is a similarly-named one in your module "a".
 

> } 
>
> --------- 
>
> class file: 
>


I suppose you mean that this is the file of the module main class, <module 
path>/<module_name>/manifests/init.pp

 

> ------------ 
> class ….{ 
>        censhare::ssh_keys::it_services_admins{ 'b': 
>                user => 'b' 
>            } 
>            censhare::ssh_keys::it_services_admins { 'root': 
>                user => 'root' 
>            } 
> } 
>
>

If you change "censhare" to "a" in those declarations then they will match 
up with the defined types you presented earlier.

 

> ----- 
> I do however get: "Invalid resource type 
> a::ssh_keys::add_to_ssh_authorized_keys at 
> /etc/puppet/modules/censhare/manifests/ssh_keys/:7" 
>
>

My first guess would be that the file containing the definition is not 
where the autoloader expects it to be.

 

> Any hints? If parametrized defines in fact can't be nested I would 
> appreciate it if the documentation clearly said so, would safe a lot of 
> headache. If it should work I can't figure out the correct syntax and would 
> appreciate an example. 
>


Have you attempted to obfuscate the manifest fragments you presented?  
Because they don't seem to line up with each other with respect to names.  
If those are literal excerpts from your manifests then the name mismatches 
are at least part of your problem.

If you have attempted to obfuscate, then please stop.  Do remove sensitive 
information (keys, passwords) and reduce the example to a simple form that 
exhibits the issue, but we're going to have trouble helping you if you 
introduce new errors that are not present in the original manifests.

Also, it will be helpful to present file paths relative to the module path, 
as the locations of your manifest files are significant to Puppet.


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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/76295f76-8c92-462a-902e-96b2a93c0ecc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to