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 #35 from rnelson0/redhat_mountd
Browse files Browse the repository at this point in the history
Enable mountd_port parameter for Red Hat.
  • Loading branch information
dwerder committed Sep 22, 2015
2 parents 061a0db + 80bb90e commit d8a0517
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
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

0 comments on commit d8a0517

Please sign in to comment.