Puppet Function: psquared::list_agent_platforms

Defined in:
lib/puppet/functions/psquared/list_agent_platforms.rb
Function type:
Ruby 4.x API

Overview

psquared::list_agent_platforms()Any

psquared::list_agent_platforms

Scan the classes provided by pe_repo and produce an array strings containing all of the shipped pe_repo::platform classes for this PE release. This solves the problem of having to keep psquared in sync with each PE release

Returns:

  • (Any)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/functions/psquared/list_agent_platforms.rb', line 6

Puppet::Functions.create_function(:psquared::list_agent_platforms') do

  def list_agent_platforms()
    platform_classes = []

    Dir.glob("/opt/puppetlabs/puppet/modules/pe_repo/manifests/platform/*.pp").each { |f|
      puppet_classpart = File.basename(f).gsub(/\.pp$/,'')

      # some classes are deprecated to agents being EOLed - these classes just
      # have a notify resource so can be safely ignored
      if File.readlines(f).grep(/deprecation/).size == 0
        platform_classes << "pe_repo::platform::#{puppet_classpart}"
      end
    }
    platform_classes
  end
end