Verbose debugging of template variable binding ?

1,154 views
Skip to first unread message

Francis Pereira

unread,
Mar 19, 2013, 9:29:12 AM3/19/13
to puppet...@googlegroups.com
I seem to have made some error in my template but cant seem find a way to debug it except for removing (deleting) parts of the template file and figuring out where there is a mistake. 

On my puppetmaster with --debug I get the following error
debug: template[/etc/puppet/manifests/lib/redis/templates/redis.conf.erb]: Bound template variables for /etc/puppet/manifests/lib/redis/templates/redis.conf.erb in 0.00 seconds

On the client I get 
err: Could not retrieve catalog from remote server: No content type in http response; cannot parse.

I am certain that there is something wrong in my template. How do I debug binding of template variables ?  Is there a verbose mode that would tell me where the binding breaks ?


Ironically, when running in standalone mode i.e puppet apply tests/ini.pp this module/template seems to work.


~Francis

Felix Frank

unread,
Mar 19, 2013, 10:11:58 AM3/19/13
to puppet...@googlegroups.com
On 03/19/2013 02:29 PM, Francis Pereira wrote:
> On my puppetmaster with --debug I get the following error
> debug:
> template[/etc/puppet/manifests/lib/redis/templates/redis.conf.erb]:
> Bound template variables for
> /etc/puppet/manifests/lib/redis/templates/redis.conf.erb in 0.00 seconds

Hmm, that doesn't look like an error at all. It seems to be just another
debug message.

Are you sure the template is what's causing breakage?

Regards,
Felix

Francis Pereira

unread,
Mar 19, 2013, 10:41:45 AM3/19/13
to puppet...@googlegroups.com
That's the last line I get on the master. After that the client run stops.

~Francis

On Mar 19, 2013, at 7:42 PM, Felix Frank
> --
> 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...@googlegroups.com.
> To post to this group, send email to puppet...@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Felix Frank

unread,
Mar 19, 2013, 10:49:10 AM3/19/13
to puppet...@googlegroups.com
All right, so - what happens if you remove that resource from the
manifest, or remove the content => parameter from the resource?
(Do use --noop on the agent side).

Felix

Francis Pereira

unread,
Mar 19, 2013, 11:26:20 AM3/19/13
to puppet...@googlegroups.com
Works as expected when the content parameter is #



~Francis

On Mar 19, 2013, at 8:19 PM, Felix Frank
<felix...@alumni.tu-berlin.de> wrote:

> All right, so - what happens if you remove that resource from the
> manifest, or remove the content => parameter from the resource?
> (Do use --noop on the agent side).
>
> Felix
>
> On 03/19/2013 03:41 PM, Francis Pereira wrote:
>> That's the last line I get on the master. After that the client run stops.
>>
>> ~Francis
>>
>> On Mar 19, 2013, at 7:42 PM, Felix Frank
>> <felix...@alumni.tu-berlin.de> wrote:
>>
>>>> On 03/19/2013 02:29 PM, Francis Pereira wrote:
>>>>>> On my puppetmaster with --debug I get the following error
>>>>>> debug:
>>>>>> template[/etc/puppet/manifests/lib/redis/templates/redis.conf.erb]:
>>>>>> Bound template variables for
>>>>>> /etc/puppet/manifests/lib/redis/templates/redis.conf.erb in 0.00 seconds
>

Felix Frank

unread,
Mar 19, 2013, 11:31:50 AM3/19/13
to puppet...@googlegroups.com
Hmm, I'm about stumped then. Sorry.

Regards,
Felix

Ellison Marks

unread,
Mar 19, 2013, 1:34:43 PM3/19/13
to puppet...@googlegroups.com
If it's working using the declaration from your tests directory, but not from your master, then it stands to reason that either something is wrong with the way you're calling it on the master or something is wrong in your master setup that is causing a communication error. Could you post how you're calling it from your master?

Francis Pereira

unread,
Mar 20, 2013, 2:09:06 AM3/20/13
to puppet...@googlegroups.com
Figured it out - by removing the line 'daemonize <%= daemonize %>' from the template, the template works as expected. Looks like the variable whose name is deamonize ( <%= daemonize %>)  for some reason does not play nice in a template. Can someone shed some light on reserved variables in templates


~Francis


Francis Pereira

unread,
Mar 20, 2013, 3:09:50 AM3/20/13
to puppet...@googlegroups.com
Looks like this is related to https://projects.puppetlabs.com/issues/9901 I have changed 'daemonize <%= daemonize %>' to 'daemonize <%= @daemonize %>' and it seems to work. 

The variable daemonize seems to collide with Ruby method names as docuimented here http://docs.puppetlabs.com/guides/templating.html

Helpful error messages would be nice in these cases


~Francis

Felix Frank

unread,
Mar 20, 2013, 5:02:56 AM3/20/13
to puppet...@googlegroups.com
On 03/20/2013 08:09 AM, Francis Pereira wrote:
> Looks like this is related
> to https://projects.puppetlabs.com/issues/9901 I have changed 'daemonize
> <%= daemonize %>' to 'daemonize <%= @daemonize %>' and it seems to work.
>
> The variable daemonize seems to collide with Ruby method names as
> docuimented here http://docs.puppetlabs.com/guides/templating.html

Good find!

> Helpful error messages would be nice in these cases

Humm, difficult - the problem originates in the bowels of the erb engine
I presume. Calling a daemonize method is not even strictly illegal, so
there is likely no exception to catch and process. Perhaps it can be
made illegal. I'll take a look at that bug report some time.

Cheers,
Felix
Reply all
Reply to author
Forward
0 new messages