Mercurial > repos > other > Puppet
annotate 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 |
rev | line source |
---|---|
385
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 Facter.add('ssh_version') do |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 setcode do |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 if Facter::Util::Resolution.which('ssh') |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 Facter::Util::Resolution.exec('ssh -V 2>&1').match(/^[A-Za-z0-9._]+/)[0] |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 end |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 end |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 end |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 Facter.add('ssh_version_numeric') do |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 setcode do |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 ssh_version = Facter.value(:ssh_version) |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 if ssh_version |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 ssh_version.match(/(\d+\.\d+\.\d+|\d+\.\d+)/)[0] |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 end |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 end |
d9009f54eb23
Migrate to a fully-fledged SSH module
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 end |