Skip to content

Commit

Permalink
Fix legacy facts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoppe committed Jan 7, 2020
1 parent 4c73c1e commit 0b7bf58
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Data type: `Variant[String, Array[String]]`

The IP or hostname of the openvpn server service.

Default value: $::fqdn
Default value: $facts['networking']['fqdn']

##### `cipher`

Expand Down Expand Up @@ -1004,7 +1004,7 @@ Data type: `String`

Interface for openvpn to bind to.

Default value: $facts['ipaddress_eth0']
Default value: $facts['networking']['ip']

##### `logfile`

Expand Down
2 changes: 1 addition & 1 deletion manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
Boolean $persist_tun = true,
String $port = '1194',
Enum['tcp','udp'] $proto = 'tcp',
Variant[String, Array[String]] $remote_host = $::fqdn,
Variant[String, Array[String]] $remote_host = $facts['networking']['fqdn'],
String $resolv_retry = 'infinite',
Enum['none', 'nointeract', 'interact'] $auth_retry = 'none',
String $verb = '3',
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
class openvpn::config {

if $facts['osfamily'] == 'Debian' {
if $facts['os']['family'] == 'Debian' {
concat { '/etc/default/openvpn':
owner => root,
group => 0,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
Optional[String] $group = undef,
Boolean $ipp = false,
Boolean $duplicate_cn = false,
String $local = $facts['ipaddress_eth0'],
String $local = $facts['networking']['ip'],
Variant[Boolean, String] $logfile = false,
Boolean $manage_logfile_directory = false,
String[1] $logdirectory_user = 'nobody',
Expand Down
4 changes: 0 additions & 4 deletions spec/default_module_facts.yml

This file was deleted.

8 changes: 3 additions & 5 deletions spec/defines/openvpn_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,7 @@
context 'with easyrsa 2.0' do
let(:facts) do
facts.merge(
easyrsa: '2.0',
ipaddress_eth0: '1.2.3.4'
easyrsa: '2.0'
)
end

Expand Down Expand Up @@ -598,7 +597,7 @@
it { is_expected.not_to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^log\-append\s+test_server\/openvpn\.log$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^status\s+/var/log/openvpn/test_server-status\.log$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^dev\s+tun0$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^local\s+1\.2\.3\.4$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^local\s+10\.0\.2\.15$}) }
it { is_expected.not_to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^ifconfig-pool-persist}) }
it { is_expected.to contain_file('/etc/openvpn/test_server.conf').with_content(%r{^crl-verify\s+\/etc\/openvpn\/test_server\/crl.pem$}) }
it { is_expected.not_to contain_schedule('renew crl.pem schedule on test_server') }
Expand Down Expand Up @@ -806,8 +805,7 @@
context 'with easyrsa 3.0' do
let(:facts) do
facts.merge(
easyrsa: '3.0',
ipaddress_eth0: '1.2.3.4'
easyrsa: '3.0'
)
end

Expand Down

0 comments on commit 0b7bf58

Please sign in to comment.