Skip to content

Commit

Permalink
Merge pull request #13 from traylenator/readme
Browse files Browse the repository at this point in the history
Leave readme-ifcfg-rh.txt untouched
  • Loading branch information
jhoblitt committed Dec 2, 2023
2 parents 0775c0a + f3a21a4 commit f1d7526
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@
Class['nm::install']
-> Class['nm::service']

$_ignore = $facts['os']['release']['major'] ? {
'7' => undef,
'8' => undef,
default => 'readme-ifcfg-rh.txt',
}

# remove ifcfg-* files to prevent conflicts between ifcfg- and .nmconnection
file { '/etc/sysconfig/network-scripts':
ensure => 'directory',
purge => true,
recurse => true,
force => true,
ignore => $_ignore,
}

# remove any conflicting nm drop-in config files
Expand Down
9 changes: 9 additions & 0 deletions spec/acceptance/nm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
it { is_expected.to be_installed }
end

describe file('/etc/sysconfig/network-scripts/readme-ifcfg-rh.txt') do
case fact('os.release.major')
when '7', '8'
it { is_expected.not_to be file }
else
it { is_expected.to be_file }
end
end

describe file('/etc/NetworkManager/NetworkManager.conf') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
)
end

case facts[:os]['release']['major']
when '7', '8'
it { is_expected.to contain_file('/etc/sysconfig/network-scripts').without_ignore }
else
it { is_expected.to contain_file('/etc/sysconfig/network-scripts').with_ignore('readme-ifcfg-rh.txt') }
end

it do
is_expected.to contain_file('/etc/NetworkManager/conf.d').with(
ensure: 'directory',
Expand Down

0 comments on commit f1d7526

Please sign in to comment.