diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2015-10-15 10:23:02 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2015-10-15 10:23:02 -0700 |
commit | 39126a7bc82797799280231fef7ef9706a113c6c (patch) | |
tree | 05d11f2ac10ff221a285e84659e677d7dfa753d8 /lib | |
parent | 57a8485223c221aa075d09c0a7de816a26daf1b0 (diff) | |
parent | 6aa7f2db9953d81afb75a3591358ba9e0dbc6935 (diff) |
Merge pull request #539 from mentat/MODULES-2696
Add check to ensure regex does not throw for none type.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/pe_version.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/facter/pe_version.rb b/lib/facter/pe_version.rb index 0cc0f64..c9f2181 100644 --- a/lib/facter/pe_version.rb +++ b/lib/facter/pe_version.rb @@ -10,8 +10,13 @@ # Facter.add("pe_version") do setcode do - pe_ver = Facter.value("puppetversion").match(/Puppet Enterprise (\d+\.\d+\.\d+)/) - pe_ver[1] if pe_ver + puppet_ver = Facter.value("puppetversion") + if puppet_ver != nil + pe_ver = puppet_ver.match(/Puppet Enterprise (\d+\.\d+\.\d+)/) + pe_ver[1] if pe_ver + else + nil + end end end |