diff options
author | mh <mh@immerda.ch> | 2017-04-08 12:55:24 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2017-04-08 12:55:24 +0200 |
commit | af0e6b36d7c5c52f7eaa2d1827d51befd9971e98 (patch) | |
tree | 24ab90aa50f00f1f70f3612b72711f1f7c4cd7ee /lib | |
parent | 9da596c12101c02e7cebc1d0d5d9f04952379007 (diff) |
add a full version fact and derive the maj from that one and make the fact work, even if there is no shorewall installed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/shorewall_major_version.rb | 3 | ||||
-rw-r--r-- | lib/facter/shorewall_version.rb | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/facter/shorewall_major_version.rb b/lib/facter/shorewall_major_version.rb index 0068b48..e247fc4 100644 --- a/lib/facter/shorewall_major_version.rb +++ b/lib/facter/shorewall_major_version.rb @@ -1,5 +1,6 @@ Facter.add("shorewall_major_version") do setcode do - Facter::Util::Resolution.exec('shorewall version').split('.').first || nil + v = Facter.value('shorewall_version') + v.nil? ? nil : v.split('.').first end end diff --git a/lib/facter/shorewall_version.rb b/lib/facter/shorewall_version.rb new file mode 100644 index 0000000..2a28828 --- /dev/null +++ b/lib/facter/shorewall_version.rb @@ -0,0 +1,5 @@ +Facter.add('shorewall_version') do + setcode do + Facter::Util::Resolution.exec('shorewall version') + end +end |