Puppet: System Administration Automated

Support

Ticket #1115 (new enhancement)

Opened 7 months ago

Last modified 5 months ago

Allow checking tags from ERb templates

Reported by: jgoldschrafe Assigned to: community
Priority: normal Milestone: unplanned
Component: language Version: 0.24.1
Severity: normal Keywords: tag tags tagged erb template classes
Cc: Triage Stage: Accepted
Attached Patches: Insufficient Complexity: Easy

Description

The current Puppet architecture does not allow tags to be checked from ERb templates. This should be changed to allow conditional behavior to be set in the templates based on whether or not a resource possesses a certain tag.

Currently, tagged() is a Puppet function with no corresponding callable in pure Ruby. The appropriate functionality should be refactored into a pure Ruby function that is callable from an ERb template. This will probably require providing additional data to the ERb binding.

Attachments

puppet_erb_classes_tags.patch (1.1 kB) - added by johnf on 03/31/08 09:26:23.

Change History

03/06/08 20:20:55 changed by luke

  • complexity changed from Unknown to Easy.
  • stage changed from Unreviewed to Accepted.
  • milestone set to unplanned.

03/31/08 09:24:51 changed by johnf

  • keywords changed from tag tags tagged erb template to tag tags tagged erb template classes.
  • patch changed from None to Code.

Created a patch for this. http://www.inodes.org/~johnf/git/puppet pending/ticket_1115 branch.

defines to variables available in ERB

classes - An array of all the classes for the node tags - An array of all the tags for the node

Puppet Templating should be updated once this has been applied.

Also maybe we should reserve some space in the style guide and these should be called Classes and Tags or maybe puppet_classes

03/31/08 09:26:23 changed by johnf

  • attachment puppet_erb_classes_tags.patch added.

04/01/08 04:09:51 changed by luke

  • patch changed from Code to Insufficient.

There is a 'tags' method on the catalog that you should be using for tags, rather than just the classes for tags.

Also, I'd like tests for this, especially since it should be pretty easy.

04/24/08 08:12:59 changed by luke

  • component changed from server to language.