Hi. i have "keys" class where I copy some files from puppet server. Example: #cat keys.pp class keys { $users=["user1","user2","user3"] <% users.each do |u| -%> file { "/etc/file/keys/<%= u %>_keys": owner => "<%= u %>", group => "root", mode => "440", replace => true, source => "puppet://server/files/file/keys/<%= u %>_keys", require => User["<%= u %>"], } <% end -%> } When I run puppet client I got the next error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment mera: Could not match % at / etc/puppet/manifes/mera/users/keys.pp:5 on node test-node. How to implement this? -- 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 Thu, Mar 03, 2011 at 09:39:02PM -0800, aleksey_k wrote:> Hi. i have "keys" class where I copy some files from puppet server.You''re trying to do ERB templating in a manifest. You can''t do that. You could use the ruby DSL, or in puppet language, try the following: define userkey() { file { "/etc/file/keys/${name}_keys": owner => $name, group => root, mode => "0440", replace => true, source => "puppet://server/files/file/keys/${name}_keys", require => User[$name], } } userkey{ ["user1","user2","user3"]: } -- Ben Hughes || http://www.puppetlabs.com/ -- 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 4 мар, 11:00, Ben Hughes <b...@puppetlabs.com> wrote:> On Thu, Mar 03, 2011 at 09:39:02PM -0800, aleksey_k wrote: > > Hi. i have "keys" class where I copy some files from puppet server. > > You''re trying to do ERB templating in a manifest. You can''t do that. > > You could use the ruby DSL, or in puppet language, try the following: > > define userkey() { > file { "/etc/file/keys/${name}_keys": > owner => $name, > group => root, > mode => "0440", > replace => true, > source => "puppet://server/files/file/keys/${name}_keys", > require => User[$name], > } > > } > > userkey{ ["user1","user2","user3"]: > > } > > -- > Ben Hughes ||http://www.puppetlabs.com/Hi. I done that: #cat keys.pp class keys { define userkey() { file { "/etc/file/keys/${name}_keys": #ensure => , owner => $name, group => "root", mode => "440", replace => true, source => "puppet://server/files/file/keys/${name} _keys", require => User[$name], } userkey{ ["user1","user2","user3"]: } } But puppet client don''t copy file from puppet server :( -- 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 Thu, Mar 03, 2011 at 11:20:38PM -0800, aleksey_k wrote:> But puppet client don''t copy file from puppet server :(Anything in the output or logs at all? Stop the client and run: # puppet agent --test and that should give you more information as to why. -- Ben Hughes || http://www.puppetlabs.com/ -- 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 4 мар, 12:23, Ben Hughes <b...@puppetlabs.com> wrote:> On Thu, Mar 03, 2011 at 11:20:38PM -0800, aleksey_k wrote: > # puppet agent --test >puppetmaster: #grep -i keys node/test-nodes.pp include "keys" puppetclient: #puppetd --version 2.6.2 #puppetd --test info: Caching catalog for test-node info: Applying configuration version ''1299224725'' notice: Finished catalog run in 2.00 seconds Log''s from puppetmaster: <ip> - - [04/Mar/2011:12:49:42 +0500] "GET /mera/file_metadata/files/ soft/zabbix-agent_1.8.3-2_i386.deb HTTP/1.1" 200 314 "-" "-" <ip> - - [04/Mar/2011:12:49:44 +0500] "GET /mera/file_metadata/files/ once HTTP/1.1" 200 278 "-" "-" <ip> - - [04/Mar/2011:12:49:44 +0500] "PUT /mera/report/test-node HTTP/ 1.1" 200 24 "-" "-" I don''t got some error or warning. Also when I add to array userkey nonexistent user I don''t got error that file not found... -- 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 Thu, Mar 03, 2011 at 11:59:25PM -0800, aleksey_k wrote:> > # puppet agent --testThrow a --debug on the end, and it should be a whole more talkative!> puppetmaster: > #grep -i keys node/test-nodes.pp > include "keys"You made a class for it? As it sounds like it''s not getting called at all. -- Ben Hughes || http://www.puppetlabs.com/ -- 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 4 мар, 13:08, Ben Hughes <b...@puppetlabs.com> wrote:> On Thu, Mar 03, 2011 at 11:59:25PM -0800, aleksey_k wrote: > > > # puppet agent --test > > Throw a --debug on the end, and it should be a whole more talkative! >Outpu here -> http://pastebin.com/0GHfkH63> You made a class for it? As it sounds like it''s not getting called at all. >Yes.I did a class for this: class keys { define userkey() { file { "/etc/file/keys/${name}_keys": #ensure => , owner => $name, group => "root", mode => "440", replace => true, source => "puppet://server/files/file/keys/${name} _keys", require => User[$name], } userkey{ ["user1","user2","user3"]: } } -- 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 03/04/2011 09:08 AM, Ben Hughes wrote:> On Thu, Mar 03, 2011 at 11:59:25PM -0800, aleksey_k wrote: > >>> # puppet agent --test > > Throw a --debug on the end, and it should be a whole more talkative! > >> puppetmaster: >> #grep -i keys node/test-nodes.pp >> include "keys" > > You made a class for it? As it sounds like it''s not getting called at all. >On such occasions, I prefer --test --evaltrace over --debug. Your files should show up in there. If not, your manifest is probably erronous. HTH, 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.
On Fri, Mar 04, 2011 at 02:24:59AM -0800, aleksey_k wrote:> On 4 мар, 13:08, Ben Hughes <b...@puppetlabs.com> wrote: > > On Thu, Mar 03, 2011 at 11:59:25PM -0800, aleksey_k wrote: > > > > # puppet agent --test > > > > Throw a --debug on the end, and it should be a whole more talkative! > > > Outpu here -> http://pastebin.com/0GHfkH63 > > > You made a class for it? As it sounds like it''s not getting called at all. > > > Yes.I did a class for this: >Your code 01 class keys { 02 define userkey() { 03 file { "/etc/file/keys/${name}_keys": 04 #ensure => , 05 owner => $name, 06 group => "root", 07 mode => "440", 08 replace => true, 09 source => "puppet://server/files/file/keys/${name}_keys", 10 require => User[$name], 11 } 12 13 userkey{ ["user1","user2","user3"]: } 14 15 } My comments 04: Use `ensure => file` so it is clear that something will be created 08: replace => true is the default so I wont specify it 09: Are you using modules? Maybe you''re specifying an incorrect path. Have a look at http://docs.puppetlabs.com/guides/modules.html and http://docs.puppetlabs.com/guides/file_serving.html 10: When you specify the owner of the file, puppet will create an implicit require you dont dont need that explicit require 12: There is a missing closing bracket for the define -Stefan
>> You made a class for it? As it sounds like it''s not getting called at all. >> > Yes.I did a class for this:are you including this class somewhere? ~pete -- 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.