view 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 source

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