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

Enable mountd_port parameter for Red Hat. #35

Merged
merged 3 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ spec/fixtures/modules/*
spec/fixtures/manifests/*
*swp

.DS_Store
.DS_Store
Gemfile.lock
14 changes: 12 additions & 2 deletions manifests/server/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
$mountd_port = undef,
$mountd_threads = 1
) {
if ($::operatingsystemmajrelease == defined) and ($::operatingsystemmajrelease =~ /^7/) {
$service_name = 'nfs-server'
} else {
$service_name = 'nfs'
}

if !defined(Class['nfs::client::redhat']) {
class{ 'nfs::client::redhat':
Expand All @@ -13,10 +18,15 @@
}

if ($mountd_port != undef){
fail('Setting mountd port currently not supported on RedHat')
shellvar { 'rpc-mount-options':
ensure => present,
target => '/etc/sysconfig/nfs',
variable => 'MOUNTD_PORT',
value => $mountd_port,
notify => Service[$service_name],
}
}

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


}
12 changes: 5 additions & 7 deletions spec/classes/server_redhat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require 'spec_helper'
describe 'nfs::server::redhat' do
context "operatingsystemrelease => 6.4" do
let(:facts) { {:operatingsystemrelease => '6.4'} }
let(:facts) { {:operatingsystemrelease => '6.4', :operatingsystemmajrelease => '6'} }
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', :operatingsystemmajrelease => '7'} }
it do
should contain_class('nfs::client::redhat')
should contain_class('nfs::server::redhat::service')
Expand All @@ -23,12 +23,10 @@
end
end

context "setting mountd port" do
let(:params) {{ :mountd_port => 4711 }}
context "mountd params set" 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/)
should contain_shellvar('rpc-mount-options') #.with( 'ensure' => 'present' )
end
end
end
Expand Down