FAQ
Hi all,
I have a tricky problem where I need your support. We use the regsubst
function in one of our manifests to extract certain information from the
fqdn. That code is running in production since months and does extactly
what it should.

7: $customer = upcase(regsubst($::fqdn, '(^[^-]*)-[^-]*.*', "\\1"))
8: $environment = upcase(regsubst($::hostname, '^[^-]*-([^-]*).*', "\\1"))
9: $product = upcase(regsubst($::hostname, '^[^-]*-[^-]*-([^\.1-9]*).*',
"\\1"))

Last week I discovered the stdlib module from PuppetLabs and gave it a try.
Really nice functions, and I used them of course for my next module. But
since then it looks like the regsubst function is not working anymore.

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Function 'regsubst' does not return a value at
/etc/puppet/environments/dev_foo/modules/auth/manifests/hosting.pp:7 on
node unic-dev-foo.p.unic24.net

It even fails when I run puppet against a environment without the stdlib
module, which confuses me most. Does anybody of you have an idea, why that
code now fails? We use Puppet 2.7.18.

Cheers,
Christian

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

Search Discussions

  • Jcbollinger at Jun 11, 2013 at 12:53 pm

    On Tuesday, June 11, 2013 1:10:16 AM UTC-5, c!w wrote:
    Hi all,
    I have a tricky problem where I need your support. We use the regsubst
    function in one of our manifests to extract certain information from the
    fqdn. That code is running in production since months and does extactly
    what it should.

    7: $customer = upcase(regsubst($::fqdn, '(^[^-]*)-[^-]*.*', "\\1"))
    8: $environment = upcase(regsubst($::hostname, '^[^-]*-([^-]*).*', "\\1"))
    9: $product = upcase(regsubst($::hostname, '^[^-]*-[^-]*-([^\.1-9]*).*',
    "\\1"))

    Last week I discovered the stdlib module from PuppetLabs and gave it a
    try. Really nice functions, and I used them of course for my next module.
    But since then it looks like the regsubst function is not working anymore.

    err: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Function 'regsubst' does not return a value at
    /etc/puppet/environments/dev_foo/modules/auth/manifests/hosting.pp:7 on
    node unic-dev-foo.p.unic24.net

    It even fails when I run puppet against a environment without the stdlib
    module, which confuses me most.

    That part confuses me least. Puppet does not segregate custom functions or
    types based on environment. If one of the stdlib native components is
    somehow breaking regsubst(), then it is to be expected that it would be
    seen in all environments.


    Does anybody of you have an idea, why that code now fails? We use
    Puppet 2.7.18.
    And what version of stdlib did you install? Support for Puppet 2.7 was
    dropped as of stdlib 4.0.0. (Current is 4.1.0; see
    https://forge.puppetlabs.com/puppetlabs/stdlib.) Like most other things
    Puppet, stdlib moves fairly quickly, so stdlib 3 isn't actually all that
    old.


    John



    --
    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.
  • C!w at Jun 11, 2013 at 12:58 pm
    Yes, therefore we use stdlib 3.2.0.

    Christian

    Am Dienstag, 11. Juni 2013 14:53:50 UTC+2 schrieb jcbollinger:

    On Tuesday, June 11, 2013 1:10:16 AM UTC-5, c!w wrote:

    Hi all,
    I have a tricky problem where I need your support. We use the regsubst
    function in one of our manifests to extract certain information from the
    fqdn. That code is running in production since months and does extactly
    what it should.

    7: $customer = upcase(regsubst($::fqdn, '(^[^-]*)-[^-]*.*', "\\1"))
    8: $environment = upcase(regsubst($::hostname, '^[^-]*-([^-]*).*',
    "\\1"))
    9: $product = upcase(regsubst($::hostname, '^[^-]*-[^-]*-([^\.1-9]*).*',
    "\\1"))

    Last week I discovered the stdlib module from PuppetLabs and gave it a
    try. Really nice functions, and I used them of course for my next module.
    But since then it looks like the regsubst function is not working anymore.

    err: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Function 'regsubst' does not return a value at
    /etc/puppet/environments/dev_foo/modules/auth/manifests/hosting.pp:7 on
    node unic-dev-foo.p.unic24.net

    It even fails when I run puppet against a environment without the stdlib
    module, which confuses me most.

    That part confuses me least. Puppet does not segregate custom functions
    or types based on environment. If one of the stdlib native components is
    somehow breaking regsubst(), then it is to be expected that it would be
    seen in all environments.


    Does anybody of you have an idea, why that code now fails? We use
    Puppet 2.7.18.
    And what version of stdlib did you install? Support for Puppet 2.7 was
    dropped as of stdlib 4.0.0. (Current is 4.1.0; see
    https://forge.puppetlabs.com/puppetlabs/stdlib.) Like most other things
    Puppet, stdlib moves fairly quickly, so stdlib 3 isn't actually all that
    old.


    John

    --
    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.
  • Jcbollinger at Jun 11, 2013 at 8:16 pm

    On Tuesday, June 11, 2013 7:58:39 AM UTC-5, c!w wrote:
    Yes, therefore we use stdlib 3.2.0.
    Lots of people use stdlib, and lots of people use regsubst(), so you are
    unlikely to be the only person using them together. I have not heard any
    other reports of the behavior you describe, however, nor do I find any
    reports of it on the PL bug tracker (not even closed ones). Whatever the
    nature of your problem, therefore, I suspect that there's more to it than
    simply stdlib breaking regsubst().

    It may be illuminating to create a simplified test case. Build a new,
    clean, v 2.7.18 master, install stdlib 3.2.0 in it, and deploy a very
    simple manifest that exercises regsubst(). Something like this might do
    the trick:

    site.pp
    ======
    node default {
       $value = 'foo'
       $subst = regsubst($value, 'f', 'b')
       notice("Ghosts say '$subst'")
    }


    If the problem is a straight-up incompatibility between stdlib and the
    Puppet core, then any time the master tries to compile a catalog it ought
    to experience your error. If it does, then you have a test case you can
    submit when you file a ticket against the issue. Otherwise, either you
    have clobbered your primary master some other way, or else the issue is
    more complicated than you suppose.


    John

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 11, '13 at 7:29a
activeJun 11, '13 at 8:16p
posts4
users2
websitepuppetlabs.com

2 users in discussion

Jcbollinger: 2 posts C!w: 2 posts

People

Translate

site design / logo © 2022 Grokbase