1 # Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version
3 # Purpose: Return various facts about the PE state of the system
5 # Resolution: Uses a regex match against puppetversion to determine whether the
6 # machine has Puppet Enterprise installed, and what version (overall, major,
7 # minor, patch) is installed.
12 Facter.add('pe_version') do
14 puppet_ver = Facter.value('puppetversion')
16 pe_ver = puppet_ver.match(%r{Puppet Enterprise (\d+\.\d+\.\d+)})
25 Facter.add('is_pe') do
27 if Facter.value(:pe_version).to_s.empty?
35 # Fact: pe_major_version
36 Facter.add('pe_major_version') do
37 confine :is_pe => true
39 pe_version = Facter.value(:pe_version)
41 pe_version.to_s.split('.')[0]
46 # Fact: pe_minor_version
47 Facter.add('pe_minor_version') do
48 confine :is_pe => true
50 pe_version = Facter.value(:pe_version)
52 pe_version.to_s.split('.')[1]
57 # Fact: pe_patch_version
58 Facter.add('pe_patch_version') do
59 confine :is_pe => true
61 pe_version = Facter.value(:pe_version)
63 pe_version.to_s.split('.')[2]