The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #12557

Inaccurate error message when calling a defined function without colon after $name

Added by zach armstrong about 2 years ago. Updated about 2 years ago.

Status:AcceptedStart date:02/10/2012
Priority:LowDue date:
Assignee:-% Done:

0%

Category:error reporting
Target version:-
Affected Puppet version:2.7.10 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

Calling a function, like

deploy::php_dev { "02" }  

throws this error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '}'; expected '}' at /etc/puppet/manifests/site.pp:72

It should say expected ':'

12557.pp (68 Bytes) Chris Price, 02/15/2012 09:58 am

History

#1 Updated by zach armstrong about 2 years ago

here is what deploy::php_dev looks like

define deploy::php_dev { 
#contents removed 
}

#2 Updated by Chris Price about 2 years ago

  • Status changed from Unreviewed to Investigating
  • Assignee set to Chris Price

Can you provide a full manifest that demonstrates this? I tried creating a file test.pp with these contents:

define deploy::php_dev {
}

deploy::php_dev { "02" }

and then ran:

$ puppet apply ./test.pp
Could not parse for environment production: Syntax error at '}' at /path/puppet/scratch/12557.pp:4 on node machine.domain

Which, while not as complete an error message as we would prefer or as you are suggesting, at least isn’t quite so misleading.

#3 Updated by Chris Price about 2 years ago

  • Status changed from Investigating to Needs More Information

#4 Updated by zach armstrong about 2 years ago

Hi Chris,

I tested using the same format you tried (plus line numbers):

61: node testnode {
62: test::tester { "hello" }
63: }
64: define test::tester {
65: }

which resulted in

Feb 14 17:03:45 client1 puppet-agent[13108]: Starting Puppet client version 2.7.10
Feb 14 17:03:48 client1 puppet-agent[13108]: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '}'; expected '}' at /etc/puppet/manifests/site.pp:62 on node client1 
Feb 14 17:03:48 client1 puppet-agent[13108]: Using cached catalog

Just in case this matters I am on Red Hat Enterprise Linux Server release 5.7 (Tikanga):

ruby-1.8.5-22.el5_7.1
ruby-libs-1.8.5-22.el5_7.1
ruby-augeas-0.4.1-1.el5
ruby-shadow-1.4.1-7.el5
libselinux-ruby-1.33.4-5.7.el5

And one other note, also updated to 2.7.10 (as seen in above log, no change.)

Let me know if there’s anything else I could do to help.

#5 Updated by Chris Price about 2 years ago

  • File 12557.pp added
  • Status changed from Needs More Information to Accepted
  • Assignee deleted (Chris Price)
  • Affected Puppet version changed from 2.7.9 to 2.7.10

That did it… must be some minor difference in your syntax vs what I was using before, but I am able to repro this now:

$ puppet apply ./scratch/12557.pp  
Could not parse for environment production: Syntax error at '}'; expected '}' at 
/path/scratch/12557.pp:2 on node machine.domain

Manifest file attached.

I’m not sure how soon we’ll be able to get to this, but this error handling should definitely be improved… thanks for the report!

#6 Updated by zach armstrong about 2 years ago

No worries. I’ll also take a look at the code when I have some time to see if I can put together a patch.

Edit: but don’t count on it. My ruby is quite lacking and I have not explored the puppet code base much at all.

Also available in: Atom PDF