Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
atomic-penguin authored Nov 4, 2020
2 parents 36ce681 + 664440b commit 9880806
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 80 deletions.
4 changes: 1 addition & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ driver:
provisioner:
name: chef_solo
product_name: chef
product_version: 13.8.5
#product_version: 14.3.37
install_strategy: always
channel: stable

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
Expand All @@ -26,4 +25,3 @@ suites:
run_list:
- recipe[nfs::server]
- recipe[nfs_test::issue46]
attributes:
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
------
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
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'
supports 'oracle', '>= 6.8'
supports 'sles', '>= 11.1'
supports 'freebsd', '>= 9.3'

depends 'line', '>= 2.0'
depends 'line', '~> 2.1'
99 changes: 31 additions & 68 deletions spec/server_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9880806

Please sign in to comment.