diff modules/ssh/lib/facter/ssh.rb @ 385:d9009f54eb23

Migrate to a fully-fledged SSH module This handles lots of the server path differences for us
author IBBoard <dev@ibboard.co.uk>
date Mon, 03 Jan 2022 17:05:54 +0000
parents
children adf6fe9bbc17
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/ssh/lib/facter/ssh.rb	Mon Jan 03 17:05:54 2022 +0000
@@ -0,0 +1,16 @@
+Facter.add('ssh_version') do
+  setcode do
+    if Facter::Util::Resolution.which('ssh')
+      Facter::Util::Resolution.exec('ssh -V 2>&1').match(/^[A-Za-z0-9._]+/)[0]
+    end
+  end
+end
+
+Facter.add('ssh_version_numeric') do
+  setcode do
+    ssh_version = Facter.value(:ssh_version)
+    if ssh_version
+      ssh_version.match(/(\d+\.\d+\.\d+|\d+\.\d+)/)[0]
+    end
+  end
+end