Issue #7217 has been updated by Ben Hughes.

Category set to file

The way to test the problem:

<pre>
[ben@paresthesia:~]% cat template.pp                                            
                                                                                
                   1
file { '/tmp/test':
    ensure  => file,
    content => template( '/tmp//iamatemplate.erb' ),
}
[ben@paresthesia:~]% puppet apply --verbose --debug template.pp
cadebug: Scope(Class[main]): Retrieving template /tmp//iamatemplate.erb
Invalid module name; module names must be alphanumeric (plus '-'), not '' at 
/Users/ben/template.pp:3 on node paresthesia.puppetlabs.lan
</pre>

The code is in lib/puppet/parser/files.rb  the "find_template" function.

It's the File.expand_path not matching the template name (due to Ruby removing 
the extra '/'s). So it falls through to the modules, which is where this error 
crops up, but it's not the right error. We should just do something clever or 
cleverer with expand_path before falling through, but I don't know what.
----------------------------------------
Bug #7217: double slashes error in template path
https://projects.puppetlabs.com/issues/7217

Author: stéphane travassac
Status: Accepted
Priority: Normal
Assignee: 
Category: file
Target version: 
Affected Puppet version: 2.6.7
Keywords: 
Branch: 


hello,<br>
When I include a template (content => template)  with double slashes in his 
path, Puppet cause an error

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could 
not find template 
'/etc/puppet/manifests/rs4repo/files/config**//**adm/dev/deploy/hosts.debian.tpl'
 at /etc/puppet/manifests/rs4repo/classes/common/hosts.pp:18 on node 
XXXXXXXXXXXXX

I can fix the problem by changing the line: <br> 
if template == File.expand_path(template) <br> 
by <br> 
if template = File.expand_path(template) <br> 

in file /usr/lib/ruby/1.8/puppet/parser/files.rb (line 37)<br>
Is template path must have only single slash ? if false this fix looks good ?



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to