File tree Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change 3
3
Facter . add ( :easyrsa ) do
4
4
confine kernel : 'Linux'
5
5
setcode do
6
- binaryv3 = ''
7
- operatingsystem = Facter . value ( :operatingsystem )
8
- operatingsystemrelease = Facter . value ( :operatingsystemrelease )
6
+ binary = case Facter . value [ :os ] [ 'family' ]
7
+ when 'RedHat'
8
+ '/usr/share/easy-rsa/3/easyrsa'
9
+ when 'Debian'
10
+ '/usr/share/easy-rsa/easyrsa'
11
+ when 'FreeBSD'
12
+ '/usr/local/share/easy-rsa/easyrsa'
13
+ when 'Solaris'
14
+ '/opt/local/bin/easyrsa'
15
+ else
16
+ ''
17
+ end
9
18
10
- case operatingsystem
11
- when %r{RedHat|CentOS|Amazon|Rocky|AlmaLinux|OracleLinux}
12
- binaryv3 = '/usr/share/easy-rsa/3/easyrsa'
13
- when %r{Ubuntu|Debian}
14
- binaryv3 = case operatingsystemrelease
15
- when %r{|11|12|22.04|24.04}
16
- '/usr/share/easy-rsa/easyrsa'
17
- else
18
- '/usr/share/doc/openvpn/examples/easy-rsa/3.0/easyrsa'
19
- end
20
- when %r{FreeBSD}
21
- binaryv3 = '/usr/local/share/easy-rsa/easyrsa'
22
- when %r{Solaris}
23
- binaryv3 = '/opt/local/bin/easyrsa'
24
- end
25
-
26
- if File . exist? binaryv3
27
- data = Facter ::Core ::Execution . execute ( "#{ binaryv3 } help" )
19
+ if File . exist? binary
20
+ data = Facter ::Core ::Execution . execute ( "#{ binary } help" )
28
21
version = '3.0' if data . gsub! ( %r{Easy-RSA 3 usage} , '' )
29
22
elsif Facter ::Util ::Resolution . which ( 'easyrsa' )
30
23
data = Facter ::Core ::Execution . execute ( 'easyrsa help' )
You can’t perform that action at this time.
0 commit comments