diff --git a/.kitchen.yml b/.kitchen.yml index e2406d9..025001c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -5,8 +5,6 @@ driver: provisioner: name: chef_solo product_name: chef - product_version: 13.8.5 - #product_version: 14.3.37 install_strategy: always channel: stable @@ -14,6 +12,7 @@ platforms: - name: ubuntu-16.04 - name: ubuntu-14.04 - name: centos-7.4 + - name: centos-8.1 - name: centos-6.10 - name: debian-8.11 - name: debian-9.5 @@ -26,4 +25,3 @@ suites: run_list: - recipe[nfs::server] - recipe[nfs_test::issue46] - attributes: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1823c13..18198b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ +v2.7.0 +------ + +* @rexcsn - corrected nfs-idmap service name + v2.6.4 ------ -* Set default_env so exportfs can be found under Chef 14.2+ +* @Vancelot11 - added CentOS 8 support v2.6.3 ------ diff --git a/Gemfile b/Gemfile index 5cb56eb..f2e4eb7 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'chefspec', '~> 7.2.1' gem 'rspec', '~> 3.7' gem 'fauxhai', '~> 5.6.0' gem 'cookstyle', '~> 2.1.0' +gem 'ohai', '~> 16.5.6' gem 'rake' group :integration do diff --git a/attributes/default.rb b/attributes/default.rb index bcd5224..0d9f24b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -56,19 +56,26 @@ case node['platform_family'] when 'rhel' - if node['platform'] == 'amazon' - # For future amazon versions - elsif node['platform_version'].to_i <= 5 + if node['platform_version'].to_i <= 5 # RHEL5 edge case package set and portmap name default['nfs']['packages'] = %w(nfs-utils portmap) default['nfs']['service']['portmap'] = 'portmap' elsif node['platform_version'].to_i >= 7 - default['nfs']['service']['lock'] = 'nfs-lock' default['nfs']['service']['server'] = 'nfs-server' - default['nfs']['service']['idmap'] = 'nfs-idmap' + # If EL 8 + if node['platform_version'].to_i >= 8 + default['nfs']['service']['lock'] = 'nfs-client.target' + default['nfs']['service']['idmap'] = 'nfs-idmapd' + else # EL 7 + default['nfs']['service']['lock'] = 'nfs-lock' + default['nfs']['service']['idmap'] = 'nfs-idmap' + end + default['nfs']['config']['client_templates'] = %w(/etc/sysconfig/nfs /etc/modprobe.d/lockd.conf) default['nfs']['client-services'] = if node['platform_version'] == '7.0.1406' %w(nfs-lock.service) + elsif node['platform_version'].to_i > 7 + %w(nfs-client.target) else %w(nfs-config.service nfs-client.target) end diff --git a/metadata.rb b/metadata.rb index b6be80a..b834224 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,14 +4,13 @@ description 'Installs and configures NFS, and NFS exports' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) name 'nfs' -version '2.6.4' +version '2.7.0' source_url 'https://github.com/atomic-penguin/cookbook-nfs' if respond_to?(:source_url) issues_url 'https://github.com/atomic-penguin/cookbook-nfs/issues' if respond_to?(:issues_url) chef_version '>= 13.0' if respond_to?(:chef_version) supports 'ubuntu', '>= 12.04' supports 'debian', '>= 8.0' -supports 'amazon', '>= 2014.09' supports 'centos', '>= 6.8' supports 'redhat', '>= 6.8' supports 'scientific', '>= 6.8' @@ -19,4 +18,4 @@ supports 'sles', '>= 11.1' supports 'freebsd', '>= 9.3' -depends 'line', '>= 2.0' +depends 'line', '~> 2.1' diff --git a/spec/server_spec.rb b/spec/server_spec.rb index eb94ca9..01f1c80 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -1,49 +1,44 @@ require 'spec_helper' describe 'nfs::server' do - context 'on Centos 5.11' do - cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'centos', version: 5.11).converge(described_recipe) - end - - it 'includes recipe nfs::_common' do - expect(chef_run).to include_recipe('nfs::_common') - end - - %w(nfs).each do |svc| - it "starts the #{svc} service" do - expect(chef_run).to start_service(svc) + %w(5.11 6.8 8).each do |release| + context "on Centos #{release}" do + cached(:chef_run) do + ChefSpec::ServerRunner.new(platform: 'centos', version: release).converge(described_recipe) end - it "enables the #{svc} service" do - expect(chef_run).to enable_service(svc) + it 'includes recipe nfs::_common' do + expect(chef_run).to include_recipe('nfs::_common') end - end - end - - context 'on Centos 6.8' do - cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'centos', version: 6.8).converge(described_recipe) - end - it 'includes recipe nfs::_common' do - expect(chef_run).to include_recipe('nfs::_common') - end + case release + when '5.11', '6.8' + %w(nfs).each do |svc| + it "starts the #{svc} service" do + expect(chef_run).to start_service(svc) + end - %w(nfs).each do |svc| - it "starts the #{svc} service" do - expect(chef_run).to start_service(svc) - end - - it "enables the #{svc} service" do - expect(chef_run).to enable_service(svc) + it "enables the #{svc} service" do + expect(chef_run).to enable_service(svc) + end + end + when '8' + %w(nfs-server).each do |svc| + it "starts the #{svc} service" do + expect(chef_run).to start_service(svc) + end + + it "enables the #{svc} service" do + expect(chef_run).to enable_service(svc) + end + end end end end context 'on Amazon 2014.09' do cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'amazon', version: 2014.09).converge(described_recipe) + ChefSpec::ServerRunner.new(platform: 'amazon', version: '2015.03').converge(described_recipe) end it 'includes recipe nfs::_common' do @@ -63,7 +58,7 @@ context 'on FreeBSD' do cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'freebsd', version: 9.3).converge(described_recipe) + ChefSpec::ServerRunner.new(platform: 'freebsd', version: '11.1').converge(described_recipe) end it 'includes recipe nfs::_common' do @@ -89,7 +84,7 @@ end end - %w(16.04 14.04 12.04).each do |release| + %w(18.04 16.04).each do |release| # Submit Ubuntu Fauxhai to https://github.com/customink/fauxhai for better Ubuntu coverage context "on Ubuntu #{release}" do cached(:chef_run) do @@ -120,41 +115,9 @@ end end - context 'on Debian 7.2' do - cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'debian', version: 7.2).converge(described_recipe) - end - - it 'includes recipe nfs::_common' do - expect(chef_run).to include_recipe('nfs::_common') - end - - it 'creates file /etc/default/nfs-kernel-server with: RPCMOUNTDOPTS="-p 32767"' do - expect(chef_run).to render_file('/etc/default/nfs-kernel-server').with_content(/RPCMOUNTDOPTS="-p +32767"/) - end - - it 'creates file /etc/default/nfs-kernel-server with: RPCNFSDCOUNT="8"' do - expect(chef_run).to render_file('/etc/default/nfs-kernel-server').with_content(/RPCNFSDCOUNT="8"/) - end - - %w(nfs-kernel-server).each do |nfs| - it "installs package #{nfs}" do - expect(chef_run).to install_package(nfs) - end - - it "starts the #{nfs} service" do - expect(chef_run).to start_service(nfs) - end - - it "enables the #{nfs} service" do - expect(chef_run).to enable_service(nfs) - end - end - end - - context 'on Debian 8.2' do + context 'on Debian 8.9' do cached(:chef_run) do - ChefSpec::ServerRunner.new(platform: 'debian', version: 8.2).converge(described_recipe) + ChefSpec::ServerRunner.new(platform: 'debian', version: '8.9').converge(described_recipe) end it 'includes recipe nfs::_common' do