FAQ
Hello,

So I'm working my way through writing custom functions for puppet 2.7.6,
and what I think is valid seems not to be, and unfortunately I can't find
any additional help in the docs. I've got a pastebin link
(http://pastebin.com/HimPyWHh) that shows my function, site.pp, and the
file I'm trying to manipulate with my function. It's fairly basic as you
can tell.

I'm getting the following error from the client: err: Could not retrieve
catalog from remote server: Error 400 on SERVER: can't convert nil into
String at /etc/puppet/manifests/site.pp:81 on node thing
I've been through the troubleshooting stages, ruby -rpuppet fileModify.rb,
irb etc. and those work fine.

If I make a syntax error in the function, puppet quite happily complains
about it, so it can certainly read the function file.

any suggestions? questions? help? :)
ohh, and I'm following this guide here:
http://docs.puppetlabs.com/guides/custom_functions.html


Chris-

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Fd-wqOv1dBIJ.
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.

Search Discussions

  • Gary Larizza at Apr 19, 2012 at 3:21 am
    At first glance (on phone), Check this line:

    1. file = File.open(file, 'r+')


    Don't you want filename as the argument?


    n Wednesday, April 18, 2012, Chris Donovan wrote:
    Hello,

    So I'm working my way through writing custom functions for puppet 2.7.6,
    and what I think is valid seems not to be, and unfortunately I can't find
    any additional help in the docs. I've got a pastebin link (
    http://pastebin.com/HimPyWHh) that shows my function, site.pp, and the
    file I'm trying to manipulate with my function. It's fairly basic as you
    can tell.

    I'm getting the following error from the client: err: Could not retrieve
    catalog from remote server: Error 400 on SERVER: can't convert nil into
    String at /etc/puppet/manifests/site.pp:81 on node thing
    I've been through the troubleshooting stages, ruby -rpuppet fileModify.rb,
    irb etc. and those work fine.

    If I make a syntax error in the function, puppet quite happily complains
    about it, so it can certainly read the function file.

    any suggestions? questions? help? :)
    ohh, and I'm following this guide here:
    http://docs.puppetlabs.com/guides/custom_functions.html


    Chris-

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/Fd-wqOv1dBIJ.
    To post to this group, send email to puppet-users@googlegroups.com<javascript:_e({}, 'cvml', 'puppet-users@googlegroups.com');>
    .
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com <javascript:_e({}, 'cvml',
    'puppet-users%2Bunsubscribe@googlegroups.com');>.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
  • Chris Donovan at Apr 19, 2012 at 3:28 am
    Hi,

    Yes, filename is what is supposed to be there. That's not my issue
    however though, my issue is that it doesn't load / run properly.

    If puppet 2.7.6 still does not run functions on the client then that's
    great, and I'll write a provider, and possibly a type.


    Chris-
    On Thu, Apr 19, 2012 at 1:21 PM, Gary Larizza wrote:
    At first glance (on phone), Check this line:

    file = File.open(file, 'r+')


    Don't you want filename as the argument?


    n Wednesday, April 18, 2012, Chris Donovan wrote:
    Hello,

    So I'm working my way through writing custom functions for puppet 2.7.6,
    and what I think is valid seems not to be, and unfortunately I can't find
    any additional help in the docs.  I've got a pastebin link
    (http://pastebin.com/HimPyWHh) that shows my function, site.pp, and the file
    I'm trying to manipulate with my function.  It's fairly basic as you can
    tell.

    I'm getting the following error from the client: err: Could not retrieve
    catalog from remote server: Error 400 on SERVER: can't convert nil into
    String at /etc/puppet/manifests/site.pp:81 on node thing
    I've been through the troubleshooting stages, ruby -rpuppet fileModify.rb,
    irb etc. and those work fine.

    If I make a syntax error in the function, puppet quite happily complains
    about it, so it can certainly read the function file.

    any suggestions? questions? help? :)
    ohh, and I'm following this guide here:
    http://docs.puppetlabs.com/guides/custom_functions.html


    Chris-

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/Fd-wqOv1dBIJ.
    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.


    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
    --
    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.
  • Gary Larizza at Apr 19, 2012 at 3:34 am

    On Wednesday, April 18, 2012, Chris Donovan wrote:

    Hi,

    Yes, filename is what is supposed to be there. That's not my issue
    however though, my issue is that it doesn't load / run properly.

    If puppet 2.7.6 still does not run functions on the client then that's
    great, and I'll write a provider, and possibly a type.
    Puppet only executes functions on the master - that's by design. Custom
    facts are executed in the client.

    You might want to look at the file_line type (
    https://github.com/puppetlabs/puppetlabs-stdlib/blob/11156fd29a6ccee64663a5a32cf0b37d1867cfb0/lib/puppet/type/file_line.rb)
    or Augeas to modify lines in a file.


    Chris-
    On Thu, Apr 19, 2012 at 1:21 PM, Gary Larizza wrote:
    At first glance (on phone), Check this line:

    file = File.open(file, 'r+')


    Don't you want filename as the argument?


    n Wednesday, April 18, 2012, Chris Donovan wrote:
    Hello,

    So I'm working my way through writing custom functions for puppet 2.7.6,
    and what I think is valid seems not to be, and unfortunately I can't
    find
    any additional help in the docs. I've got a pastebin link
    (http://pastebin.com/HimPyWHh) that shows my function, site.pp, and
    the file
    I'm trying to manipulate with my function. It's fairly basic as you can
    tell.

    I'm getting the following error from the client: err: Could not retrieve
    catalog from remote server: Error 400 on SERVER: can't convert nil into
    String at /etc/puppet/manifests/site.pp:81 on node thing
    I've been through the troubleshooting stages, ruby -rpuppet
    fileModify.rb,
    irb etc. and those work fine.

    If I make a syntax error in the function, puppet quite happily complains
    about it, so it can certainly read the function file.

    any suggestions? questions? help? :)
    ohh, and I'm following this guide here:
    http://docs.puppetlabs.com/guides/custom_functions.html


    Chris-

    --
    You received this message because you are subscribed to the Google
    Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/Fd-wqOv1dBIJ.
    To post to this group, send email to puppet-users@googlegroups.com<javascript:;>
    .
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com <javascript:;>.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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<javascript:;> .
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com <javascript:;>.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    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<javascript:;>
    .
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com <javascript:;>.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
  • Chris Donovan at Apr 19, 2012 at 4:12 am
    OK, so now that I understand where the functions run, I'll write a
    type / provider.

    The reason I need to get something custom run on the client is to
    learn how puppet works at that level. Then once I'm happy with the
    level of knowledge I will get with customizing puppet, I'll be able to
    figure out what to use, and / or what I'll need to write.

    With regards to augeas, I think it's horrible and would never use
    that. The syntax alone is cringe worthy to me.

    On the type that you sent me via the link, where does it actually
    write IO to the file to insert / append the line?? Is there some
    additional function that the type uses? I'm still reading up on types
    right now.


    Chris-
    On Thu, Apr 19, 2012 at 1:34 PM, Gary Larizza wrote:

    On Wednesday, April 18, 2012, Chris Donovan wrote:

    Hi,

    Yes, filename is what is supposed to be there.  That's not my issue
    however though, my issue is that it doesn't load / run properly.

    If puppet 2.7.6 still does not run functions on the client then that's
    great, and I'll write a provider, and possibly a type.
    Puppet only executes functions on the master - that's by design. Custom
    facts are executed in the client.

    You might want to look at the file_line type (
    https://github.com/puppetlabs/puppetlabs-stdlib/blob/11156fd29a6ccee64663a5a32cf0b37d1867cfb0/lib/puppet/type/file_line.rb
    ) or Augeas to modify lines in a file.

    Chris-
    On Thu, Apr 19, 2012 at 1:21 PM, Gary Larizza wrote:
    At first glance (on phone), Check this line:

    file = File.open(file, 'r+')


    Don't you want filename as the argument?


    n Wednesday, April 18, 2012, Chris Donovan wrote:
    Hello,

    So I'm working my way through writing custom functions for puppet
    2.7.6,
    and what I think is valid seems not to be, and unfortunately I can't
    find
    any additional help in the docs.  I've got a pastebin link
    (http://pastebin.com/HimPyWHh) that shows my function, site.pp, and the
    file
    I'm trying to manipulate with my function.  It's fairly basic as you
    can
    tell.

    I'm getting the following error from the client: err: Could not
    retrieve
    catalog from remote server: Error 400 on SERVER: can't convert nil into
    String at /etc/puppet/manifests/site.pp:81 on node thing
    I've been through the troubleshooting stages, ruby -rpuppet
    fileModify.rb,
    irb etc. and those work fine.

    If I make a syntax error in the function, puppet quite happily
    complains
    about it, so it can certainly read the function file.

    any suggestions? questions? help? :)
    ohh, and I'm following this guide here:
    http://docs.puppetlabs.com/guides/custom_functions.html


    Chris-

    --
    You received this message because you are subscribed to the Google
    Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/Fd-wqOv1dBIJ.
    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.


    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
    --
    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.

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    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.
    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedApr 19, '12 at 3:15a
activeApr 19, '12 at 4:12a
posts5
users2
websitepuppetlabs.com

2 users in discussion

Chris Donovan: 3 posts Gary Larizza: 2 posts

People

Translate

site design / logo © 2022 Grokbase