FAQ
Hello,

Is it possible to override parameters of a class using a collector?
(similarly to
https://docs.puppetlabs.com/puppet/latest/reference/lang_resources.html#amending-attributes-with-a-collector)

The following gives "Resource type cls doesn't exist" error:

class cls($arg="default"){notify{$arg:}}

node foo
{
  Cls <| |> {arg => "override"}
  class{'cls':}
}

It works if I change "class" to "define" though.


Thanks,


Vlad

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/544151EF.7080709%40icecube.wisc.edu.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • José Luis Ledesma at Oct 17, 2014 at 7:31 pm
    Have you tried this?

    class cls($arg="default"){notify{$arg:}}

    node foo
    {
             Class <| name=='cls'|> {arg => "override"}
             class{'cls':}
    }
    El 17/10/2014 19:29, "Vladimir Brik" <vladimir.brik@icecube.wisc.edu>
    escribió:
    Hello,

    Is it possible to override parameters of a class using a collector?
    (similarly to https://docs.puppetlabs.com/puppet/latest/reference/lang_
    resources.html#amending-attributes-with-a-collector)

    The following gives "Resource type cls doesn't exist" error:

    class cls($arg="default"){notify{$arg:}}

    node foo
    {
    Cls <| |> {arg => "override"}
    class{'cls':}
    }

    It works if I change "class" to "define" though.


    Thanks,


    Vlad

    --
    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 view this discussion on the web visit https://groups.google.com/d/
    msgid/puppet-users/544151EF.7080709%40icecube.wisc.edu.
    For more options, visit https://groups.google.com/d/optout.
    --
    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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAF_B3dfZMfrra48cW-OQ86SLjVx07f5sYuV-uOBt%2B0g08vRC9A%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Henrik Lindberg at Oct 17, 2014 at 11:24 pm

    On 2014-17-10 19:29, Vladimir Brik wrote:
    Hello,

    Is it possible to override parameters of a class using a collector?
    (similarly to
    https://docs.puppetlabs.com/puppet/latest/reference/lang_resources.html#amending-attributes-with-a-collector)
    No, that does not work. In 4.0 you will get a specific error like this:
    "Error while evaluating a Virtual Query, Classes cannot be collected"

    It is not allowed by design, but in earlier versions than 3.7 with
    --parser future the error message is really bad.
    The following gives "Resource type cls doesn't exist" error:

    class cls($arg="default"){notify{$arg:}}

    node foo
    {
    Cls <| |> {arg => "override"}
    class{'cls':}
    }

    It works if I change "class" to "define" though.
    Yes, that is allowed.
    - henrik


    --

    Visit my Blog "Puppet on the Edge"
    http://puppet-on-the-edge.blogspot.se/

    --
    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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/m1s8et%24kov%241%40ger.gmane.org.
    For more options, visit https://groups.google.com/d/optout.
  • Jcbollinger at Oct 20, 2014 at 1:03 pm

    On Friday, October 17, 2014 12:29:32 PM UTC-5, Vladimir Brik wrote:
    Hello,

    Is it possible to override parameters of a class using a collector?
    (similarly to

    https://docs.puppetlabs.com/puppet/latest/reference/lang_resources.html#amending-attributes-with-a-collector)


    The following gives "Resource type cls doesn't exist" error:

    class cls($arg="default"){notify{$arg:}}

    node foo
    {
    Cls <| |> {arg => "override"}
    class{'cls':}
    }

    It works if I change "class" to "define" though.
    Yes. Classes are not resources, though the DSL downplays the distinction.
    There is simply no way to implement class parameter overriding that can
    work reliably. On the other hand, defined type instances *are* resources,
    just like instances of native types such as File.


    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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/9bf9a6e9-3a36-47f7-912f-6427ff7b115b%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 17, '14 at 5:29p
activeOct 20, '14 at 1:03p
posts4
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase