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.
11 Facter.add('pe_version') do
13 puppet_ver = Facter.value('puppetversion')
15 pe_ver = puppet_ver.match(%r{Puppet Enterprise (\d+\.\d+\.\d+)})
23 Facter.add('is_pe') do
25 if Facter.value(:pe_version).to_s.empty?
33 Facter.add('pe_major_version') do
34 confine :is_pe => true
36 pe_version = Facter.value(:pe_version)
38 pe_version.to_s.split('.')[0]
43 Facter.add('pe_minor_version') do
44 confine :is_pe => true
46 pe_version = Facter.value(:pe_version)
48 pe_version.to_s.split('.')[1]
53 Facter.add('pe_patch_version') do
54 confine :is_pe => true
56 pe_version = Facter.value(:pe_version)
58 pe_version.to_s.split('.')[2]