FAQ
Is there a way to get the local scope values of puppet variables via
scope.? wat r all the available functions in scope? can anyone provide a
working example.....

--
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/-/zVW-0uI2yMAJ.
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

  • Abhijeet R at Nov 18, 2012 at 6:20 am
    Can you explain what is it that you intend to do by providing a
    self-contained example?
    On Fri 16 Nov 2012 06:00:43 PM IST, Jayapandian Ponraj wrote:
    Is there a way to get the local scope values of puppet variables via
    scope.? wat r all the available functions in scope? can anyone provide
    a working example.....

    --
    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/-/zVW-0uI2yMAJ.
    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.
    --
    Cheers,
    Abhijeet R
    http://blog.abhijeetr.com

    --
    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.
  • Jcbollinger at Nov 19, 2012 at 2:05 pm

    On Friday, November 16, 2012 6:30:43 AM UTC-6, Jayapandian Ponraj wrote:
    Is there a way to get the local scope values of puppet variables via
    scope.? wat r all the available functions in scope? can anyone provide a
    working example.....

    One normally accesses local-scope variables directly, rather than via the
    scope object:

    $foo = 'bar'
    # A stupid way to get the value of foo
    $foo_copy = inline_template('<%=@foo%>')

    Alternatively, you should be able to access any global or class variable
    via its fully-qualified name, including those from the local scope (if it
    is the top-level scope or a class scope).

    I suspect that doesn't answer your real question though. As Abhijeet
    asked, for what purpose do you want that?


    John

    --
    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/-/dZAhLmTyUB4J.
    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.
  • Jayapandian Ponraj at Nov 20, 2012 at 7:34 am
    I have a node(b) inheriting another node(a). node(a) includes a class(c)
    which inturn inherits class(d). I need to access the variable defined in
    node (b) from class (d). I am not sure if its possible.... As far as i know
    the node scope ends at node (a)....Wat ll be the fully qualified name for
    the variable in node(b)... My original question does not describe the
    problem well, ignore it.
    On Monday, November 19, 2012 7:34:57 PM UTC+5:30, jcbollinger wrote:


    On Friday, November 16, 2012 6:30:43 AM UTC-6, Jayapandian Ponraj wrote:

    Is there a way to get the local scope values of puppet variables via
    scope.? wat r all the available functions in scope? can anyone provide a
    working example.....

    One normally accesses local-scope variables directly, rather than via the
    scope object:

    $foo = 'bar'
    # A stupid way to get the value of foo
    $foo_copy = inline_template('<%=@foo%>')

    Alternatively, you should be able to access any global or class variable
    via its fully-qualified name, including those from the local scope (if it
    is the top-level scope or a class scope).

    I suspect that doesn't answer your real question though. As Abhijeet
    asked, for what purpose do you want that?


    John
    --
    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/-/u0xgfVNnZMQJ.
    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.
  • Jcbollinger at Nov 20, 2012 at 2:16 pm

    On Tuesday, November 20, 2012 1:34:23 AM UTC-6, Jayapandian Ponraj wrote:
    I have a node(b) inheriting another node(a). node(a) includes a class(c)
    which inturn inherits class(d). I need to access the variable defined in
    node (b) from class (d). I am not sure if its possible.... As far as i know
    the node scope ends at node (a)....Wat ll be the fully qualified name for
    the variable in node(b)... My original question does not describe the
    problem well, ignore it.

    Node variables do not have qualified names. If they are not accessible via
    unqualified names in the local scope then they are not accessible at all.

    On the other hand, in a node inheritance situation, the node variables of
    the parent node should be visible as node variables of the child node.

    On the third hand, it is unwise to use node variables to modulate the
    behavior of your classes. I recommend you avoid that. There are a number
    of alternatives, but I can't recommend a particular one for your case with
    the limited information available to me.

    Also, be very careful about class inheritance. It probably doesn't do what
    you think it does, and it is rarely the best solution to a problem. It's
    key and defining feature is the ability of subclasses to override
    parameters of resources declared by their superclasses. If your reason for
    subclassing does not center on that feature then you do not need or want to
    subclass. If the superclass is parametrized then you almost certainly do
    not want to subclass. Until you understand what I have just written, you
    definitely do not want to subclass.


    John

    --
    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/-/xh78Anj82O0J.
    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
postedNov 16, '12 at 2:47p
activeNov 20, '12 at 2:16p
posts5
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2021 Grokbase