Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #25 from haw-hh-ai-lab/configurable_tcp_port_squashed
Browse files Browse the repository at this point in the history
add mountd option params and add/fix tests to make the work.
  • Loading branch information
dwerder committed Jun 4, 2015
2 parents a71496c + 3bcec28 commit f8f2dec
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ fixtures:
concat:
repo: "git://github.com/puppetlabs/puppetlabs-concat.git"
ref: "1.1.1"
# transitive requirement of augeasproviders_shellvar
augeasproviders_core:
repo: "git://github.com/hercules-team/augeasproviders_core.git"
augeasproviders_shellvar:
repo: "git://github.com/hercules-team/augeasproviders_shellvar.git"
symlinks:
"nfs": "#{source_dir}"
2 changes: 1 addition & 1 deletion manifests/client/debian/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ensure => installed,
}

Package['rpcbind'] -> Service ['rpcbind']
Package['rpcbind'] -> Service['rpcbind']


package { ['nfs-common', 'nfs4-acl-tools']:
Expand Down
4 changes: 4 additions & 0 deletions manifests/client/redhat/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
require => Class['nfs::client::redhat::configure']
}

# lint:ignore:selector_inside_resource would not add much to readability

service {'nfslock':
ensure => running,
name => $::nfs::client::redhat::params::osmajor ? {
Expand All @@ -32,6 +34,8 @@
}
}

# lint:endignore

if $::nfs::client::redhat::params::osmajor == 6 or $::nfs::client::redhat::params::osmajor == 7 {
service {'rpcbind':
ensure => running,
Expand Down
7 changes: 6 additions & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@
$nfs_v4_root_export_atboot = false,
$nfs_v4_root_export_options = '_netdev',
$nfs_v4_root_export_bindmount = undef,
$nfs_v4_root_export_tag = undef
$nfs_v4_root_export_tag = undef,
#
$mountd_port = undef,
$mountd_threads = 1
) inherits nfs::params {

class { "nfs::server::${::nfs::params::osfamily}":
nfs_v4 => $nfs_v4,
nfs_v4_idmap_domain => $nfs_v4_idmap_domain,
mountd_port => $mountd_port,
mountd_threads => $mountd_threads,
}

include nfs::server::configure
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'nfs_exports_header':
target => '/etc/exports',
content => "# This file is configured through the nfs::server puppet module\n",
order => 01;
order => '01';
}

if $nfs::server::nfs_v4 == true {
Expand Down
4 changes: 3 additions & 1 deletion manifests/server/darwin.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class nfs::server::darwin(
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
$nfs_v4_idmap_domain = undef,
$mountd_port = undef,
$mountd_threads = 1
) {
fail('NFS server is not supported on Darwin')
}
16 changes: 14 additions & 2 deletions manifests/server/debian.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Debian specifix stuff
class nfs::server::debian(
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef,
$mountd_port = undef,
$mountd_threads = 1
) {

if !defined(Class['nfs::client::debian']) {
Expand All @@ -11,5 +13,15 @@
}
}

if ($mountd_port != undef){
shellvar { 'rpc-mount-options':
ensure => present,
target => '/etc/default/nfs-kernel-server',
variable => 'RPCMOUNTDOPTS',
value => "--manage-gids --port ${mountd_port} --num-threads ${mountd_threads}",
notify => Service['nfs-kernel-server'],
}
}

include nfs::server::debian::install, nfs::server::debian::service
}
8 changes: 7 additions & 1 deletion manifests/server/gentoo.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Gentoo specifix stuff
class nfs::server::gentoo(
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
$nfs_v4_idmap_domain = undef,
$mountd_port = undef,
$mountd_threads = 1
) {

if !defined(Class['nfs::client::gentoo']) {
Expand All @@ -11,6 +13,10 @@
}
}

if ($mountd_port != undef){
fail('setting the mountd port currently not supported on Gentoo')
}

include nfs::server::gentoo::install, nfs::server::gentoo::service

}
2 changes: 1 addition & 1 deletion manifests/server/nfs_v4/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'nfs_exports_root':
target => '/etc/exports',
content => "${nfs::server::nfs_v4_export_root} ${nfs::server::nfs_v4_export_root_clients}\n",
order => 02
order => '02'
}
file {
$nfs::server::nfs_v4_export_root:
Expand Down
10 changes: 8 additions & 2 deletions manifests/server/redhat.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class nfs::server::redhat(
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef
$nfs_v4 = false,
$nfs_v4_idmap_domain = undef,
$mountd_port = undef,
$mountd_threads = 1
) {

if !defined(Class['nfs::client::redhat']) {
Expand All @@ -10,6 +12,10 @@
}
}

if ($mountd_port != undef){
fail('Setting mountd port currently not supported on RedHat')
}

include nfs::server::redhat::install, nfs::server::redhat::service


Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"issues_url": "https://github.com/echocat/puppet-nfs/issues",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"},
{"name":"puppetlabs/concat","version_requirement":">= 1.1.1"}
{"name":"puppetlabs/concat","version_requirement":">= 1.1.1"},
{"name":"herculesteam/augeasproviders_shellvar","version_requirement":">= 2.1.0"}
]
}
8 changes: 4 additions & 4 deletions spec/classes/client_redhat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'nfs::client::redhat' do
context "operatingsystemrelease => 7.0" do
let(:facts) { {:operatingsystemrelease => 7.0 } }
let(:facts) { {:operatingsystemrelease => '7.0' } }
it do
should contain_class('nfs::client::redhat::install')
should contain_class('nfs::client::redhat::configure')
Expand All @@ -19,7 +19,7 @@
end

context "operatingsystemrelease => 6.4" do
let(:facts) { {:operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystemrelease => '6.4' } }
it do
should contain_class('nfs::client::redhat::install')
should contain_class('nfs::client::redhat::configure')
Expand Down Expand Up @@ -64,14 +64,14 @@

context ":nfs_v4 => true" do
let(:params) {{ :nfs_v4 => true }}
let(:facts) {{ :operatingsystemrelease => 6.4 }}
let(:facts) {{ :operatingsystemrelease => '6.4' }}
it do
should contain_augeas('/etc/idmapd.conf')
end
end

context "operatingsystemrelease => 5.3" do
let(:facts) { {:operatingsystemrelease => 5.3 } }
let(:facts) { {:operatingsystemrelease => '5.3' } }
it do
should contain_class('nfs::client::redhat')
should contain_package('portmap')
Expand Down
14 changes: 7 additions & 7 deletions spec/classes/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
it { should contain_class('nfs::client::debian') }
end
context "operatingsysten => scientific" do
let(:facts) { {:operatingsystem => 'scientific', :operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystem => 'scientific', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => SLC" do
let(:facts) { {:operatingsystem => 'SLC', :operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystem => 'SLC', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => centos v7" do
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => 7.0 } }
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => '7.0' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => centos v6" do
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => centos v5" do
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => 5.4 } }
let(:facts) { {:operatingsystem => 'centos', :operatingsystemrelease => '5.4' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => redhat v7" do
let(:facts) { {:operatingsystem => 'redhat', :operatingsystemrelease => 7.0 } }
let(:facts) { {:operatingsystem => 'redhat', :operatingsystemrelease => '7.0' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => redhat v6" do
let(:facts) { {:operatingsystem => 'redhat', :operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystem => 'redhat', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::client::redhat') }
end
context "operatingsysten => Amazon v3" do
Expand Down
4 changes: 4 additions & 0 deletions spec/classes/coverage_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# activate coverage calculation for the whole project
#
at_exit { RSpec::Puppet::Coverage.report! }
10 changes: 9 additions & 1 deletion spec/classes/server_debian_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

require 'spec_helper'
describe 'nfs::server::debian' do
describe 'nfs::server::debian', :type => :class do
it do
should contain_class('nfs::client::debian')
should contain_class('nfs::server::debian::service')
should contain_package('nfs-kernel-server')
should contain_service('nfs-kernel-server').with( 'ensure' => 'running' )
end
Expand All @@ -13,5 +14,12 @@
end

end
context "mountd params set" do
let(:params) {{ :mountd_port => '4711' }}
it do
should contain_shellvar('rpc-mount-options') #.with( 'ensure' => 'present' )
end

end
end

1 change: 1 addition & 0 deletions spec/classes/server_gentoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

it do
should contain_class('nfs::client::gentoo')
should contain_class('nfs::server::gentoo::service')
should contain_service('nfs').with( 'ensure' => 'running' )
end
context ":nfs_v4 => true" do
Expand Down
16 changes: 13 additions & 3 deletions spec/classes/server_redhat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
require 'spec_helper'
describe 'nfs::server::redhat' do
context "operatingsystemrelease => 6.4" do
let(:facts) { {:operatingsystemrelease => 6.4} }
let(:facts) { {:operatingsystemrelease => '6.4'} }
it do
should contain_class('nfs::client::redhat')
should contain_service('nfs').with( 'ensure' => 'running' )
end
end

context "operatingsystemrelease => 7.1" do
let(:facts) { {:operatingsystemrelease => 7.1} }
let(:facts) { {:operatingsystemrelease => '7.1'} }
it do
should contain_class('nfs::client::redhat')
should contain_class('nfs::server::redhat::service')
should contain_service('nfs-server').with( 'ensure' => 'running' )
end

context ":nfs_v4 => true" do
let(:params) {{ :nfs_v4 => true , :nfs_v4_idmap_domain => 'teststring' }}
it do
should contain_augeas('/etc/idmapd.conf').with_changes(/set Domain teststring/)
end
end

context "setting mountd port" do
let(:params) {{ :mountd_port => 4711 }}
it do
expect {
should contain_class('nfs::server::redhat')
}.to raise_error(Puppet::Error, /Setting mountd port currently not supported on RedHat/)
end
end
end
end
20 changes: 16 additions & 4 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,36 @@
let(:facts) { {:operatingsystem => 'ubuntu', :concat_basedir => '/tmp', } }
it { should contain_class('nfs::server::debian') }
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
should contain_class('nfs::server::debian').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 } }
let(:facts) { {:operatingsystem => 'scientific', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::server::redhat') }
end
context "operatingsysten => SLC" do
let(:facts) { {:operatingsystem => 'SLC', :concat_basedir => '/tmp', :operatingsystemrelease => 6.4 } }
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 } }
let(:facts) { {:operatingsystem => 'centos', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::server::redhat') }
end
context "operatingsysten => redhat v6" do
let(:facts) { {:operatingsystem => 'redhat', :concat_basedir => '/tmp', :operatingsystemrelease => 6.4 } }
let(:facts) { {:operatingsystem => 'redhat', :concat_basedir => '/tmp', :operatingsystemrelease => '6.4' } }
it { should contain_class('nfs::server::redhat') }
end
context "operatingsysten => Amazon v3" do
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
it do
should compile
should contain_class('nfs::client')
should contain_mount('shared nfs.int.net:/srv/share by test.example.com /srv/test')
# should contain_mount('shared nfs.int.net:/srv/share by test.example.com /srv/test')
#should contain_mount('/srv/test')
end
end
Expand Down

0 comments on commit f8f2dec

Please sign in to comment.