Created
          February 13, 2013 22:47 
        
      - 
      
- 
        Save dctrwatson/4949092 to your computer and use it in GitHub Desktop. 
    Has to be better way of gathering all names of a certain defined resources in Puppet
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class info { | |
| define iota() {} | |
| Info::Iota<| |> | |
| $info_template = '<% scope.compiler.catalog.vertices.each do |resource| -%> | |
| <%- if resource.type == "Info::Iota" -%><%= resource.name %>,<% end -%> | |
| <%- end -%>' | |
| $all_iotas = unique(sort(split(chop(inline_template($info_template)),','))) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | node 'a' { | |
| @info::iota{ 'foo': } | |
| include info | |
| notice(join($info::all_iotas,',')) | |
| } | |
| node 'b' inherits 'a' { | |
| @info::iota{ 'bar': } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment