David Pires
2013-May-15 00:14 UTC
[Puppet Users] Custom function help: works locally, "wrong header line format" error on master
I have a custom function (http://docs.puppetlabs.com/guides/custom_functions.html) working locally using `puppet apply --modulepath=` and a test manifest. The issue I am having is when I run it on a node I get a "wrong header line format" error on the puppet master and I can''t figure out why. It is not a erb template issue as I have tested all my erb''s and they are fine, I have pinpointed the error to wherever I use the function. I have run through all the troubleshooting steps (irb, ruby -rpuppet etc.) they all work correctly. The same error occurs whether I use the function in my main site manifest or through a module class. Any help to further debug this is appreciated. -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
Nan Liu
2013-May-15 15:13 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
On Tue, May 14, 2013 at 5:14 PM, David Pires <david.pires@gmail.com> wrote:> I have a custom function ( > http://docs.puppetlabs.com/guides/custom_functions.html) working locally > using `puppet apply --modulepath=` and a test manifest. > > The issue I am having is when I run it on a node I get a "wrong header > line format" error on the puppet master and I can''t figure out why. It is > not a erb template issue as I have tested all my erb''s and they are fine, I > have pinpointed the error to wherever I use the function. > > I have run through all the troubleshooting steps (irb, ruby -rpuppet etc.) > they all work correctly. The same error occurs whether I use the function > in my main site manifest or through a module class. > > Any help to further debug this is appreciated. >On the master try ''puppet master --compile <node_name> --trace'' HTH, Nan -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-15 15:46 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
It compiles fine, no errors. Both the master and nodes are Ubuntu 12.04, puppet version 2.7.11 On Wednesday, May 15, 2013 11:13:20 AM UTC-4, Nan Liu wrote:> > On Tue, May 14, 2013 at 5:14 PM, David Pires <david...@gmail.com<javascript:> > > wrote: > >> I have a custom function ( >> http://docs.puppetlabs.com/guides/custom_functions.html) working locally >> using `puppet apply --modulepath=` and a test manifest. >> >> The issue I am having is when I run it on a node I get a "wrong header >> line format" error on the puppet master and I can''t figure out why. It is >> not a erb template issue as I have tested all my erb''s and they are fine, I >> have pinpointed the error to wherever I use the function. >> >> I have run through all the troubleshooting steps (irb, ruby -rpuppet >> etc.) they all work correctly. The same error occurs whether I use the >> function in my main site manifest or through a module class. >> >> Any help to further debug this is appreciated. >> > > On the master try ''puppet master --compile <node_name> --trace'' > > HTH, > > Nan > > > >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
Dean Wilson
2013-May-15 16:03 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
On Wed, May 15, 2013 at 08:46:57AM -0700, David Pires wrote:> It compiles fine, no errors. Both the master and nodes are Ubuntu 12.04, > puppet version 2.7.11Only time I''ve ever seen this message is in broken templates - which I know you''ve already checked. Last time I saw it was an unmatched '' Did you run something like erb -P -x -T ''-'' mytemplate.erb | ruby -c over each template? Do you have anything in the http log? Dean -- Dean Wilson http://www.unixdaemon.net @unixdaemon http://www.puppetcookbook.com @puppetcookbook -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-15 16:19 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
Just ran the template again, ''Syntax OK'' Nothing in the masterhttp log. I really don''t think its a template issue as all other modules work fine, its only when i add the reference to the function that I get the header error. Maybe its something about the directory structure of my module? I created a module like any other with no manifest at first, with the proper structure for plugins (lib/parser/functions etc.) I then added a blank class to the module manifest to see if that was the issue, and it wasn''t same error... On Wednesday, May 15, 2013 12:03:02 PM UTC-4, (Dean Wilson) wrote:> > On Wed, May 15, 2013 at 08:46:57AM -0700, David Pires wrote: > > It compiles fine, no errors. Both the master and nodes are Ubuntu 12.04, > > puppet version 2.7.11 > > Only time I''ve ever seen this message is in broken templates - which I > know you''ve already checked. Last time I saw it was an unmatched '' > > Did you run something like erb -P -x -T ''-'' mytemplate.erb | ruby -c over > each template? > > Do you have anything in the http log? > > Dean > -- > Dean Wilson > http://www.unixdaemon.net @unixdaemon > http://www.puppetcookbook.com @puppetcookbook >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-15 16:32 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
I have tried stripping the custom function (type rvalue) down to returning a string to see if it some other error. No luck, same header error. The test manifest I was using was something like this: The function is simply returning a string of IP addresses from EC2 called get_nodes() I''ve tried 2 ways of referencing the function 1) In the site manifest through a class parameter class { "": ips => get_nodes() } 2) In the actual class $ips = get_nodes() Both give the same error and stop the catalog. On Wednesday, May 15, 2013 12:19:02 PM UTC-4, David Pires wrote:> > Just ran the template again, ''Syntax OK'' > > Nothing in the masterhttp log. I really don''t think its a template issue > as all other modules work fine, its only when i add the reference to the > function that I get the header error. > > Maybe its something about the directory structure of my module? I created > a module like any other with no manifest at first, with the proper > structure for plugins (lib/parser/functions etc.) I then added a blank > class to the module manifest to see if that was the issue, and it wasn''t > same error... > > On Wednesday, May 15, 2013 12:03:02 PM UTC-4, (Dean Wilson) wrote: >> >> On Wed, May 15, 2013 at 08:46:57AM -0700, David Pires wrote: >> > It compiles fine, no errors. Both the master and nodes are Ubuntu >> 12.04, >> > puppet version 2.7.11 >> >> Only time I''ve ever seen this message is in broken templates - which I >> know you''ve already checked. Last time I saw it was an unmatched '' >> >> Did you run something like erb -P -x -T ''-'' mytemplate.erb | ruby -c over >> each template? >> >> Do you have anything in the http log? >> >> Dean >> -- >> Dean Wilson >> http://www.unixdaemon.net @unixdaemon >> http://www.puppetcookbook.com @puppetcookbook >> >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-15 19:46 UTC
Re: [Puppet Users] Custom function help: works locally, "wrong header line format" error on master
Initially I had the custom function in a helper module and was referencing it from another module. I have now tried adding the function the the only module that is using it. No luck, same error. The custom function has been stripped down to the following: module Puppet::Parser::Functions newfunction(:get_nodes, :type => :rvalue) do |args| return "FOO" end end I also tried again to test the function on the master using a test manifest test.pp: $nodes = get_nodes() notify { $nodes: } puppet appy test.pp --modulepath=./modules This is successful on the puppet master. notice: FOO notice: /Stage[main]//Notify[FOO]/message: defined ''message'' as ''FOO'' notice: Finished catalog run in 0.18 seconds It still fails when running from the node. "Could not retrieve catalog from remote server: wrong header line format" It can''t be a template issue as the module using it has templates and when I remove the get_nodes() function call it is successful. On Wednesday, May 15, 2013 12:32:25 PM UTC-4, David Pires wrote:> > I have tried stripping the custom function (type rvalue) down to returning > a string to see if it some other error. No luck, same header error. > > The test manifest I was using was something like this: > > The function is simply returning a string of IP addresses from EC2 called > get_nodes() > > I''ve tried 2 ways of referencing the function > > 1) In the site manifest through a class parameter > class { "": > ips => get_nodes() > } > > 2) In the actual class > $ips = get_nodes() > > Both give the same error and stop the catalog. > > On Wednesday, May 15, 2013 12:19:02 PM UTC-4, David Pires wrote: >> >> Just ran the template again, ''Syntax OK'' >> >> Nothing in the masterhttp log. I really don''t think its a template issue >> as all other modules work fine, its only when i add the reference to the >> function that I get the header error. >> >> Maybe its something about the directory structure of my module? I created >> a module like any other with no manifest at first, with the proper >> structure for plugins (lib/parser/functions etc.) I then added a blank >> class to the module manifest to see if that was the issue, and it wasn''t >> same error... >> >> On Wednesday, May 15, 2013 12:03:02 PM UTC-4, (Dean Wilson) wrote: >>> >>> On Wed, May 15, 2013 at 08:46:57AM -0700, David Pires wrote: >>> > It compiles fine, no errors. Both the master and nodes are Ubuntu >>> 12.04, >>> > puppet version 2.7.11 >>> >>> Only time I''ve ever seen this message is in broken templates - which I >>> know you''ve already checked. Last time I saw it was an unmatched '' >>> >>> Did you run something like erb -P -x -T ''-'' mytemplate.erb | ruby -c >>> over >>> each template? >>> >>> Do you have anything in the http log? >>> >>> Dean >>> -- >>> Dean Wilson >>> http://www.unixdaemon.net @unixdaemon >>> http://www.puppetcookbook.com @puppetcookbook >>> >>-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-16 19:13 UTC
[Puppet Users] Re: Custom function help: works locally, "wrong header line format" error on master
I''ve tried putting the custom function in the puppetmaster $libdir as a last ditch effort, still no luck, same header error. On Tuesday, May 14, 2013 8:14:17 PM UTC-4, David Pires wrote:> > I have a custom function ( > http://docs.puppetlabs.com/guides/custom_functions.html) working locally > using `puppet apply --modulepath=` and a test manifest. > > The issue I am having is when I run it on a node I get a "wrong header > line format" error on the puppet master and I can''t figure out why. It is > not a erb template issue as I have tested all my erb''s and they are fine, I > have pinpointed the error to wherever I use the function. > > I have run through all the troubleshooting steps (irb, ruby -rpuppet etc.) > they all work correctly. The same error occurs whether I use the function > in my main site manifest or through a module class. > > Any help to further debug this is appreciated. >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-17 20:03 UTC
[Puppet Users] Re: Custom function help: works locally, "wrong header line format" error on master
I''ve narrowed the error down to puppet mishandling the parsing of my function. I am using the aws-sdk in my custom function and I can connect fine, but as soon as I try to iterate or filter an EC2InstanceCollection, thats when I get the "wrong header line format" error on the node. E.g: ec2 = AWS.ec2(:region=>"us-west-2") # works fine, connection established ec2.instances.tagged("TAG").tagged_values("VALUE").each do | instance | ... end # anything here fails, I''ve tried filter as well. This is really strange, as when I run the function in a test manifest it works correctly. On Tuesday, May 14, 2013 8:14:17 PM UTC-4, David Pires wrote:> > I have a custom function ( > http://docs.puppetlabs.com/guides/custom_functions.html) working locally > using `puppet apply --modulepath=` and a test manifest. > > The issue I am having is when I run it on a node I get a "wrong header > line format" error on the puppet master and I can''t figure out why. It is > not a erb template issue as I have tested all my erb''s and they are fine, I > have pinpointed the error to wherever I use the function. > > I have run through all the troubleshooting steps (irb, ruby -rpuppet etc.) > they all work correctly. The same error occurs whether I use the function > in my main site manifest or through a module class. > > Any help to further debug this is appreciated. >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.
David Pires
2013-May-21 04:12 UTC
[Puppet Users] Re: Custom function help: works locally, "wrong header line format" error on master
I ended up creating workaround; Instead of using the ec2 api in the function, I am using it elsewhere to write a file, and my custom function reads this file as a string. I still don''t know why the parser chokes when trying to iterate a collection. I tried updating the master and agent to 3.1.1 and the issue still exists. On Tuesday, May 14, 2013 8:14:17 PM UTC-4, David Pires wrote:> > I have a custom function ( > http://docs.puppetlabs.com/guides/custom_functions.html) working locally > using `puppet apply --modulepath=` and a test manifest. > > The issue I am having is when I run it on a node I get a "wrong header > line format" error on the puppet master and I can''t figure out why. It is > not a erb template issue as I have tested all my erb''s and they are fine, I > have pinpointed the error to wherever I use the function. > > I have run through all the troubleshooting steps (irb, ruby -rpuppet etc.) > they all work correctly. The same error occurs whether I use the function > in my main site manifest or through a module class. > > Any help to further debug this is appreciated. >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@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.