The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Feature #5613

Appending to Variables in a global context

Added by Spenser Gilliland over 3 years ago. Updated about 1 year ago.

Status:Needs More InformationStart date:12/20/2010
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:language
Target version:-
Affected Puppet version: Branch:
Keywords:exported variables, globals, collections, query

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

I’d like a syntax style for returning an array in a global context.

IE: class redmine { instances = [] } define redmine::instance { instances += “name” }

Or another possible syntax style.

class redmine { instances = array_element <<| tag = “$fqdn” |>> }

define redmine { array_element{“$name”: tag => “$fqdn”} }

These would ideally both create an array of the defined instances names.

I describe the use case in this email thread in greater detail.

https://groups.google.com/group/puppet-users/browse_thread/thread/9c4299eba91c9d15/9f80f5d4aa766321?hl=en#9f80f5d4aa766321

History

#1 Updated by James Turnbull over 3 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Nigel Kersten

#2 Updated by Nigel Kersten about 3 years ago

  • Status changed from Needs Decision to Needs More Information
  • Assignee changed from Nigel Kersten to Anonymous

Daniel, I saw you comment on the original thread that you had a similar need.

Can you elaborate on that?

#3 Updated by Anonymous over 2 years ago

Nigel Kersten wrote:

Daniel, I saw you comment on the original thread that you had a similar need. Can you elaborate on that?

I had problems along the lines of “enumerate all nodes for the backup system”, or “list all application servers for web app X on the load balancer”. We generally solved those with either concat, custom code building out the file on the target machine, or collecting files on the master and using generate to combine them into a single variable in Puppet.

#4 Updated by Henrik Lindberg almost 2 years ago

  • Keywords changed from exported variables, globals to exported variables, globals, collections

This is part of a larger theme: added keyword collections

#5 Updated by Anonymous about 1 year ago

  • Assignee deleted (Anonymous)

#6 Updated by Henrik Lindberg about 1 year ago

  • Keywords changed from exported variables, globals, collections to exported variables, globals, collections, query

Updated keywords as this relates to query. There is functionality discussed in this area in ARM-8. Daléns puppet db query module with functions for querying PuppetDB also sounds like a solution.

Also available in: Atom PDF