Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3731

Accessing arguments in exported resource collection override for override.

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:

      Description

      Sorry I don't know how to name the subject any better...

      I came up with something which would be particularly useful for advanced puppet users, which I don't think exists at the moment. If it does, please let me know, if not, then consider this a feature request!

      Given:

      @@foo::bar { 'some_name':
          value => 'hello',
          thing => 'world',
          tag => 'mytag',
      }
      

      and (on a different machine):

      I'd like to be able to access the properties of the element being created, for use in it's override block...
      Here is a very contrived example, I've made up a fake syntax of round brackets: $(thing) to show where i am using a variable from the object. This could be sort of like regexp conditional capture variables, but named...

      Foo::Bar <<| tag == 'mytag' |>> {
          value => "override",
          thing => $(value) ? {                 # $(value) should be one of the arguments
              'world' => 'Earth',
              'baz' => "$(name)",               # here we're using the name this define has...
              'yeah' => "$(tag)",               # or maybe we want a property like tag
              default => "$(thing)-whatever",   # here's another example, but this time with $thing
          },
      }
      

      Please note that the syntax of $(foo) that I made up is probably the wrong thing... It can't be ${foo} because of course you always want to be able to still access the main scope variables named as such, so perhaps something special is needed. Maybe $:var (single colon?) or $::special_namespace_identifier::foo, such as $::__override::foo, or Foo::Bar::Variable ?

      Cheers,
      James

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                redmine.exporter redmine.exporter
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: