template unable to find module

31 views
Skip to first unread message

kdo

unread,
Apr 4, 2016, 1:47:16 AM4/4/16
to Puppet Users
hi all,

I have a module in my test environment as follows :

/etc/puppetlabs/code/environment/test/site/profiles/manifests/userdb/
-> db.pp
-> authorized_keys.pp
-> mkuser.pp
-> mkgroup.pp 
 
within authorized_keys.pp I define a template as follows :
content => template("${module_name}/userdb/gen_auth_keys.erb"),

the template is located at :
 /etc/puppetlabs/code/environment/test/site/profiles/templates/userdb/gen_auth_keys.erb 

- the head of the template is as follows :

<%=
mod=Puppet::Module.find "userdb::db"
#
raise("cannot find userdb module") unless mod
#puts mod.path

keyDir=mod.path+"/profiles/files/userdb/public_keys"
#puts keyDir


the template can be found during a puppet run however parsing the template fails with cannot find module userdb. 

I am getting confused with defining my module within a modules/profiles setup

Could anyone please explain the first line to me and how I should be defining the module (path) within this template? mod=Puppet::Module.find "userdb::db"


Error message :
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Failed to parse template profiles/userdb/gen_auth_keys.erb:
  Filepath: /etc/puppetlabs/code/environments/test/site/profiles/templates/userdb/gen_auth_keys.erb
  Line: 4
  Detail: cannot find userdb module
 at /etc/puppetlabs/code/environments/test/site/profiles/manifests/userdb/authorized_keys.pp:50:18 at /etc/puppetlabs/code/environments/test/site/profiles/manifests/userdb/db.pp:63 on node xxxx.racqgroup.local


Reply all
Reply to author
Forward
0 new messages