From 3d6a55e59e2770374dfebc09d8515ea8edf2b5e5 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Tue, 20 Oct 2015 23:35:45 -0400 Subject: [PATCH] Supporting kernel 4.x in recent Amazon Linux releases Signed-off-by: Dave Henderson --- manifests/client/redhat/params.pp | 4 +--- spec/classes/client_redhat_spec.rb | 22 ++++++++++++++++++++++ spec/classes/client_spec.rb | 4 ++++ spec/classes/server_spec.rb | 16 ++++++++++------ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/manifests/client/redhat/params.pp b/manifests/client/redhat/params.pp index d70a63f..788065d 100644 --- a/manifests/client/redhat/params.pp +++ b/manifests/client/redhat/params.pp @@ -18,7 +18,7 @@ $osmajor = 7 } # Amazon linux operatingsystemrelease is verbose: 3.10.35-43.137.amzn1.x86_64 - /^3\.(\d|-|\.)+(amzn){1}/: { + /^[34]\.(\d|-|\.)+(amzn){1}/: { $osmajor = 6 } default:{ @@ -26,5 +26,3 @@ } } } - - diff --git a/spec/classes/client_redhat_spec.rb b/spec/classes/client_redhat_spec.rb index a99357a..23418b3 100644 --- a/spec/classes/client_redhat_spec.rb +++ b/spec/classes/client_redhat_spec.rb @@ -62,6 +62,28 @@ end end + context "operatingsystemrelease => 4.1.7-15.23.amzn1.x86_64" do + let(:facts) { {:operatingsystemrelease => "4.1.7-15.23.amzn1.x86_64" } } + it do + should contain_class('nfs::client::redhat::install') + should contain_class('nfs::client::redhat::configure') + should contain_class('nfs::client::redhat::service') + + should contain_service('nfslock').with( + 'ensure' => 'running' + ) + should contain_service('netfs').with( + 'enable' => 'true' + ) + should contain_package('nfs-utils') + should contain_class('nfs::client::redhat') + should contain_package('rpcbind') + should contain_service('rpcbind').with( + 'ensure' => 'running' + ) + end + end + context ":nfs_v4 => true" do let(:params) {{ :nfs_v4 => true }} let(:facts) {{ :operatingsystemrelease => '6.4' }} diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 37215c5..9dc93d3 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -41,6 +41,10 @@ let(:facts) { {:operatingsystem => 'Amazon', :operatingsystemrelease => '3.10.35-43.137.amzn1.x86_64' } } it { should contain_class('nfs::client::redhat') } end + context "operatingsysten => Amazon v4" do + let(:facts) { {:operatingsystem => 'Amazon', :operatingsystemrelease => '4.1.7-15.23.amzn1.x86_64' } } + it { should contain_class('nfs::client::redhat') } + end context "operatingsysten => gentoo" do let(:facts) { {:operatingsystem => 'gentoo', } } it { should contain_class('nfs::client::gentoo') } diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 0a6717b..0d20df7 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -17,21 +17,21 @@ let(:facts) { {:operatingsystem => 'ubuntu', :concat_basedir => '/tmp', } } it { should contain_class('nfs::server::ubuntu') } end - + context "operatingsysten => ubuntu with params for mountd" do let(:facts) { {:operatingsystem => 'ubuntu', :concat_basedir => '/tmp', } } let(:params) {{ :mountd_port => '4711', :mountd_threads => '99' }} - - it do + + it do should contain_class('nfs::server::ubuntu').with( 'mountd_port' => '4711', 'mountd_threads' => '99' ) end end - + context "operatingsysten => debian" do let(:facts) { {:operatingsystem => 'debian', :concat_basedir => '/tmp',} } it { should contain_class('nfs::server::debian') } end - + context "operatingsysten => scientific" do let(:facts) { {:operatingsystem => 'scientific', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } } it { should contain_class('nfs::server::redhat') } @@ -40,7 +40,7 @@ let(:facts) { {:operatingsystem => 'SLC', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } } it { should contain_class('nfs::server::redhat') } end - + context "operatingsysten => centos v6" do let(:facts) { {:operatingsystem => 'centos', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } } it { should contain_class('nfs::server::redhat') } @@ -53,6 +53,10 @@ let(:facts) { {:operatingsystem => 'Amazon', :concat_basedir => '/tmp', :operatingsystemrelease => '3.10.35-43.137.amzn1.x86_64' } } it { should contain_class('nfs::server::redhat') } end + context "operatingsysten => Amazon v3" do + let(:facts) { {:operatingsystem => 'Amazon', :concat_basedir => '/tmp', :operatingsystemrelease => '4.1.7-15.23.amzn1.x86_64' } } + it { should contain_class('nfs::server::redhat') } + end context "operatingsysten => gentoo" do let(:facts) { {:operatingsystem => 'gentoo', :concat_basedir => '/tmp',} } it { should contain_class('nfs::server::gentoo') }