diff --git a/.gitignore b/.gitignore index 68ed3cb..5846875 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,51 @@ -spec/fixtures/modules/* -spec/fixtures/manifests/* -*swp +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Beaker/Vagrant +.vagrant/ + +# Puppet Files +pkg +spec/fixtures +.rspec_system +.vagrant/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalisation: +/.bundle/ +/lib/bundler/man/ -.DS_Store Gemfile.lock +.ruby-version +.ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# idea +./idea + +# geppetto/eclipse +.project + +# others +*swp +.DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f59f6..a3e8617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 2015-10-16 - 1.7.0 (Feature/Bugfixe release) + +#### Features: + +- (cf2d4f5) #37 #41 add optinal parameter `exports` for class server +- (70ea022) #42 add the ability to manage the services. See `service_manage` +- (1117238) #43 speed up puppet parser validate tests + +#### Bugfixes: + +- (426ad8f) #27 #44 add special config for ubuntu to fix service name bug for idmapd +- (f84c342) #45 ensure order of client class dependencies + ## 2015-09-29 - 1.6.0 (Feature/Bugfixe release) #### Features: diff --git a/DEVELOP.md b/DEVELOP.md index 99d9fca..f4aec9f 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -22,7 +22,7 @@ Tests are written with [rspec-puppet](http://rspec-puppet.com/). CI is covered b To run all tests: - rake spec + bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--color --format documentation' Branching --------- diff --git a/README.md b/README.md index d53fa88..39604b9 100644 --- a/README.md +++ b/README.md @@ -333,6 +333,11 @@ Set up NFS server and exports. NFSv3 and NFSv4 supported. **Parameters within `nfs::server`:** +#####`service_manage` (true) + +Should this class manage the services behind nfs? Set this to false +if you are managing the service in another way (e.g. pacemaker). + #####`nfs_v4` (optional) NFSv4 support. Will set up automatic bind mounts to export root. @@ -347,6 +352,19 @@ Export root, where we bind mount shares, default /export Domain setting for idmapd, must be the same across server and clients. Default is to use $domain fact. +#####`exports` (optional) + +If set, this attribute will be used to +construct nfs::server::export resources. You can use you ENC or hiera to +provide the hash of nfs::server::export resources definitions: + +```hiera +nfs::server::exports: + /mnt/something: + ensure: mounted + clients: '*(fsid=0,ro,insecure,async,all_squash,no_subtree_check,mountpoint=/mnt/something)' +``` + #####Examples ```puppet diff --git a/Rakefile b/Rakefile index 125cbfc..c35cebb 100644 --- a/Rakefile +++ b/Rakefile @@ -13,9 +13,7 @@ PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] desc "Validate manifests, templates, and ruby files in lib." task :validate do - Dir['manifests/**/*.pp'].each do |manifest| - sh "puppet parser validate --noop #{manifest}" - end + sh "puppet parser validate --noop #{Dir['manifests/**/*.pp'].join(" ")}" Dir['lib/**/*.rb'].each do |lib_file| sh "ruby -c #{lib_file}" end diff --git a/manifests/client.pp b/manifests/client.pp index afc5c2f..7a8e3d0 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -34,6 +34,8 @@ $nfs_v4_idmap_domain = $::nfs::params::nfs_v4_idmap_domain ) inherits nfs::params { + validate_bool($nfs_v4) + # ensure dependencies for mount Class["::nfs::client::${::nfs::params::osfamily}::install"] -> diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 03c6203..a3c9a58 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -3,8 +3,12 @@ $nfs_v4_idmap_domain = undef ) { - include nfs::client::debian::install, - nfs::client::debian::configure, - nfs::client::debian::service + include ::nfs::client::debian::install + include ::nfs::client::debian::configure + include ::nfs::client::debian::service + + Class['::nfs::client::debian::install']-> + Class['::nfs::client::debian::configure']-> + Class['::nfs::client::debian::service'] } diff --git a/manifests/client/debian/configure.pp b/manifests/client/debian/configure.pp index 0db2868..50c59e6 100644 --- a/manifests/client/debian/configure.pp +++ b/manifests/client/debian/configure.pp @@ -1,7 +1,4 @@ class nfs::client::debian::configure { - Augeas{ - require => Class['nfs::client::debian::install'] - } if $nfs::client::debian::nfs_v4 { augeas { diff --git a/manifests/client/debian/install.pp b/manifests/client/debian/install.pp index 3ac6d78..775db36 100644 --- a/manifests/client/debian/install.pp +++ b/manifests/client/debian/install.pp @@ -4,9 +4,6 @@ ensure => installed, } - Package['rpcbind'] -> Service['rpcbind'] - - package { ['nfs-common', 'nfs4-acl-tools']: ensure => installed, } diff --git a/manifests/client/debian/service.pp b/manifests/client/debian/service.pp index 0d0537f..8178306 100644 --- a/manifests/client/debian/service.pp +++ b/manifests/client/debian/service.pp @@ -1,7 +1,4 @@ class nfs::client::debian::service { - Service { - require => Class['nfs::client::debian::configure'] - } service { 'rpcbind': ensure => running, diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 3d1a747..2b5c954 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -3,8 +3,13 @@ $nfs_v4_idmap_domain = undef ) { - include nfs::client::gentoo::install, - nfs::client::gentoo::configure, - nfs::client::gentoo::service + include ::nfs::client::gentoo::install + include ::nfs::client::gentoo::configure + include ::nfs::client::gentoo::service + + Class['::nfs::client::gentoo::install']-> + Class['::nfs::client::gentoo::configure']-> + Class['::nfs::client::gentoo::service'] + } diff --git a/manifests/client/redhat.pp b/manifests/client/redhat.pp index 22b3d52..09d20c1 100644 --- a/manifests/client/redhat.pp +++ b/manifests/client/redhat.pp @@ -1,13 +1,14 @@ -# Shamefully stolen from https://github.com/frimik/puppet-nfs -# refactored a bit - class nfs::client::redhat ( $nfs_v4 = false, $nfs_v4_idmap_domain = undef ) inherits nfs::client::redhat::params { - include nfs::client::redhat::install, - nfs::client::redhat::configure, - nfs::client::redhat::service + include ::nfs::client::redhat::install + include ::nfs::client::redhat::configure + include ::nfs::client::redhat::service + + Class['::nfs::client::redhat::install']-> + Class['::nfs::client::redhat::configure']-> + Class['::nfs::client::redhat::service'] } diff --git a/manifests/client/redhat/configure.pp b/manifests/client/redhat/configure.pp index 7b21dec..93a1f79 100644 --- a/manifests/client/redhat/configure.pp +++ b/manifests/client/redhat/configure.pp @@ -3,7 +3,6 @@ class nfs::client::redhat::configure { - if $nfs::client::redhat::nfs_v4 { augeas { '/etc/idmapd.conf': diff --git a/manifests/client/redhat/service.pp b/manifests/client/redhat/service.pp index 8d473a2..000230d 100644 --- a/manifests/client/redhat/service.pp +++ b/manifests/client/redhat/service.pp @@ -3,10 +3,6 @@ class nfs::client::redhat::service { - Service { - require => Class['nfs::client::redhat::configure'] - } - # lint:ignore:selector_inside_resource would not add much to readability service {'nfslock': @@ -37,7 +33,6 @@ } } - if $::nfs::client::redhat::params::osmajor == 6 or $::nfs::client::redhat::params::osmajor == 7 { service {'rpcbind': ensure => running, diff --git a/manifests/client/ubuntu.pp b/manifests/client/ubuntu.pp new file mode 100644 index 0000000..82afac9 --- /dev/null +++ b/manifests/client/ubuntu.pp @@ -0,0 +1,14 @@ +class nfs::client::ubuntu ( + $nfs_v4 = false, + $nfs_v4_idmap_domain = undef +) { + + include ::nfs::client::ubuntu::install + include ::nfs::client::ubuntu::configure + include ::nfs::client::ubuntu::service + + Class['::nfs::client::ubuntu::install']-> + Class['::nfs::client::ubuntu::configure']-> + Class['::nfs::client::ubuntu::service'] + +} diff --git a/manifests/client/ubuntu/configure.pp b/manifests/client/ubuntu/configure.pp new file mode 100644 index 0000000..e591d6c --- /dev/null +++ b/manifests/client/ubuntu/configure.pp @@ -0,0 +1,16 @@ +class nfs::client::ubuntu::configure { + + if $nfs::client::ubuntu::nfs_v4 { + augeas { + '/etc/default/nfs-common': + context => '/files/etc/default/nfs-common', + changes => [ 'set NEED_IDMAPD yes', ]; + '/etc/idmapd.conf': + context => '/files/etc/idmapd.conf/General', + lens => 'Puppet.lns', + incl => '/etc/idmapd.conf', + changes => ["set Domain ${nfs::client::ubuntu::nfs_v4_idmap_domain}"], + } + } + +} diff --git a/manifests/client/ubuntu/install.pp b/manifests/client/ubuntu/install.pp new file mode 100644 index 0000000..671db42 --- /dev/null +++ b/manifests/client/ubuntu/install.pp @@ -0,0 +1,11 @@ +class nfs::client::ubuntu::install { + + package { 'rpcbind': + ensure => installed, + } + + package { ['nfs-common', 'nfs4-acl-tools']: + ensure => installed, + } + +} diff --git a/manifests/client/ubuntu/service.pp b/manifests/client/ubuntu/service.pp new file mode 100644 index 0000000..e5fcc2f --- /dev/null +++ b/manifests/client/ubuntu/service.pp @@ -0,0 +1,17 @@ +class nfs::client::ubuntu::service { + + service { 'rpcbind': + ensure => running, + enable => true, + hasstatus => false, + } + + if $nfs::client::ubuntu::nfs_v4 { + service { 'idmapd': + ensure => running, + subscribe => Augeas['/etc/idmapd.conf', '/etc/default/nfs-common'], + } + } else { + service { 'idmapd': ensure => stopped, } + } +} diff --git a/manifests/params.pp b/manifests/params.pp index 9b1921c..3a23757 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -9,11 +9,11 @@ # Somehow the ::osfamily fact doesnt exist on some systems case $::operatingsystem { - 'centos', 'redhat', 'scientific', 'fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' } - 'debian', 'Ubuntu' : { $osfamily = 'debian' } - 'windows' : { fail('fail!11') } - 'darwin' : { $osfamily = 'darwin' } - 'gentoo' : { $osfamily = 'gentoo' } - default : { fail("OS: ${::operatingsystem} not supported") } + 'CentOS', 'RedHat', 'scientific', 'Fedora', 'SLC', 'OracleLinux', 'Amazon' : { $osfamily = 'redhat' } + 'Debian' : { $osfamily = 'debian' } + 'Ubuntu' : { $osfamily = 'ubuntu' } + 'darwin' : { $osfamily = 'darwin' } + 'gentoo' : { $osfamily = 'gentoo' } + default : { fail("OS: ${::operatingsystem} not supported") } } } diff --git a/manifests/server.pp b/manifests/server.pp index 0e5712c..748a12a 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -13,9 +13,13 @@ # Export root, where we bind mount shares, default /export # # [nfs_v4_idmap_domain] -# Domain setting for idmapd, must be the same across server -# and clients. -# Default is to use $domain fact. +# Domain setting for idmapd, must be the same across server +# and clients. +# Default is to use $domain fact. +# +# [service_manage] +# Should this class manage the services behind nfs? Set this to false +# if you are managing the service in another way (e.g. pacemaker). # # === Examples # @@ -29,11 +33,13 @@ # } class nfs::server ( - $nfs_v4 = $nfs::params::nfs_v4, + $nfs_v4 = $nfs::params::nfs_v4, $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, # + $service_manage = true, + # $nfs_v4_root_export_ensure = 'mounted', $nfs_v4_root_export_mount = undef, $nfs_v4_root_export_remounts = false, @@ -42,17 +48,29 @@ $nfs_v4_root_export_bindmount = undef, $nfs_v4_root_export_tag = undef, # - $mountd_port = undef, - $mountd_threads = 1 + $mountd_port = undef, + $mountd_threads = 1, + # + $exports = undef, ) inherits nfs::params { + validate_bool($nfs_v4) + validate_bool($service_manage) + validate_bool($nfs_v4_root_export_remounts) + validate_bool($nfs_v4_root_export_atboot) + 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, + service_manage => $service_manage, } include nfs::server::configure + if $exports { + create_resources(nfs::server::export, $exports) + } + } diff --git a/manifests/server/darwin.pp b/manifests/server/darwin.pp index f6181ae..73fedc5 100644 --- a/manifests/server/darwin.pp +++ b/manifests/server/darwin.pp @@ -2,7 +2,8 @@ $nfs_v4 = false, $nfs_v4_idmap_domain = undef, $mountd_port = undef, - $mountd_threads = 1 + $mountd_threads = 1, + $service_manage = true, ) { fail('NFS server is not supported on Darwin') } diff --git a/manifests/server/debian.pp b/manifests/server/debian.pp index bd5d32f..22671a0 100644 --- a/manifests/server/debian.pp +++ b/manifests/server/debian.pp @@ -3,7 +3,8 @@ $nfs_v4 = false, $nfs_v4_idmap_domain = undef, $mountd_port = undef, - $mountd_threads = 1 + $mountd_threads = 1, + $service_manage = true, ) { if !defined(Class['nfs::client::debian']) { @@ -19,7 +20,10 @@ target => '/etc/default/nfs-kernel-server', variable => 'RPCMOUNTDOPTS', value => "--manage-gids --port ${mountd_port} --num-threads ${mountd_threads}", - notify => Service['nfs-kernel-server'], + } + + if $service_manage { + Shellvar['rpc-mount-options'] ~> Service['nfs-kernel-server'] } } diff --git a/manifests/server/debian/service.pp b/manifests/server/debian/service.pp index 58fd101..b895181 100644 --- a/manifests/server/debian/service.pp +++ b/manifests/server/debian/service.pp @@ -1,22 +1,26 @@ class nfs::server::debian::service { - if $nfs::server::debian::nfs_v4 == true { - service {'nfs-kernel-server': - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['nfs-kernel-server'], - subscribe => [ Concat['/etc/exports'], Augeas['/etc/idmapd.conf','/etc/default/nfs-common'] ], - } - } else { - service {'nfs-kernel-server': - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['nfs-kernel-server'], - subscribe => Concat['/etc/exports'], + if $nfs::server::debian::service_manage { + if $nfs::server::debian::nfs_v4 == true { + service {'nfs-kernel-server': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-kernel-server'], + subscribe => [ Concat['/etc/exports'], Augeas['/etc/idmapd.conf','/etc/default/nfs-common'] ], + } + } else { + service {'nfs-kernel-server': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-kernel-server'], + subscribe => Concat['/etc/exports'], + } } + + Package['rpcbind'] -> Service['rpcbind'] } } diff --git a/manifests/server/gentoo.pp b/manifests/server/gentoo.pp index a74a501..2bc46b1 100644 --- a/manifests/server/gentoo.pp +++ b/manifests/server/gentoo.pp @@ -3,7 +3,8 @@ $nfs_v4 = false, $nfs_v4_idmap_domain = undef, $mountd_port = undef, - $mountd_threads = 1 + $mountd_threads = 1, + $service_manage = true, ) { if !defined(Class['nfs::client::gentoo']) { diff --git a/manifests/server/gentoo/service.pp b/manifests/server/gentoo/service.pp index 129c348..5119cb9 100644 --- a/manifests/server/gentoo/service.pp +++ b/manifests/server/gentoo/service.pp @@ -1,25 +1,27 @@ class nfs::server::gentoo::service { - if $::nfs::client::gentoo::nfs_v4 == true { - service { 'nfs': - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['net-fs/nfs-utils'], - subscribe => [ - Concat['/etc/exports'], - Augeas['/etc/idmapd.conf', '/etc/conf.d/nfs'] - ], - } - } else { - service { 'nfs': - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['net-fs/nfs-utils'], - subscribe => Concat['/etc/exports'], + if $nfs::server::gentoo::service_manage { + if $::nfs::client::gentoo::nfs_v4 == true { + service { 'nfs': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['net-fs/nfs-utils'], + subscribe => [ + Concat['/etc/exports'], + Augeas['/etc/idmapd.conf', '/etc/conf.d/nfs'] + ], + } + } else { + service { 'nfs': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['net-fs/nfs-utils'], + subscribe => Concat['/etc/exports'], + } } } } diff --git a/manifests/server/redhat.pp b/manifests/server/redhat.pp index cd04ee8..5baae87 100644 --- a/manifests/server/redhat.pp +++ b/manifests/server/redhat.pp @@ -2,9 +2,10 @@ $nfs_v4 = false, $nfs_v4_idmap_domain = undef, $mountd_port = undef, - $mountd_threads = 1 + $mountd_threads = 1, + $service_manage = true, ) { - if ($::operatingsystemmajrelease == defined) and ($::operatingsystemmajrelease =~ /^7/) { + if $::operatingsystemmajrelease and $::operatingsystemmajrelease =~ /^7/ { $service_name = 'nfs-server' } else { $service_name = 'nfs' @@ -23,7 +24,10 @@ target => '/etc/sysconfig/nfs', variable => 'MOUNTD_PORT', value => $mountd_port, - notify => Service[$service_name], + } + + if $service_manage { + Shellvar['rpc-mount-options'] ~> Service[$service_name] } } diff --git a/manifests/server/redhat/service.pp b/manifests/server/redhat/service.pp index 4ec08da..7cc52ad 100644 --- a/manifests/server/redhat/service.pp +++ b/manifests/server/redhat/service.pp @@ -1,27 +1,30 @@ class nfs::server::redhat::service { - if $::nfs::client::redhat::params::osmajor >= 7 { - $service_name = 'nfs-server' - } else { - $service_name = 'nfs' - } - if $nfs::server::redhat::nfs_v4 == true { - service {$service_name: - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['nfs-utils'], - subscribe => [ Concat['/etc/exports'], Augeas['/etc/idmapd.conf'] ], + if $nfs::server::redhat::service_manage { + if $::operatingsystemmajrelease and $::operatingsystemmajrelease =~ /^7/ { + $service_name = 'nfs-server' + } else { + $service_name = 'nfs' } - } else { - service {$service_name: - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package['nfs-utils'], - subscribe => Concat['/etc/exports'], + + if $nfs::server::redhat::nfs_v4 == true { + service {$service_name: + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-utils'], + subscribe => [ Concat['/etc/exports'], Augeas['/etc/idmapd.conf'] ], + } + } else { + service {$service_name: + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-utils'], + subscribe => Concat['/etc/exports'], + } } } } diff --git a/manifests/server/ubuntu.pp b/manifests/server/ubuntu.pp new file mode 100644 index 0000000..0f52df9 --- /dev/null +++ b/manifests/server/ubuntu.pp @@ -0,0 +1,31 @@ +# Debian specifix stuff +class nfs::server::ubuntu( + $nfs_v4 = false, + $nfs_v4_idmap_domain = undef, + $mountd_port = undef, + $mountd_threads = 1, + $service_manage = true, +) { + + if !defined(Class['nfs::client::ubuntu']) { + class{ 'nfs::client::ubuntu': + nfs_v4 => $nfs_v4, + nfs_v4_idmap_domain => $nfs_v4_idmap_domain, + } + } + + 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}", + } + + if $service_manage { + Shellvar['rpc-mount-options'] ~> Service['nfs-kernel-server'] + } + } + + include nfs::server::ubuntu::install, nfs::server::ubuntu::service +} diff --git a/manifests/server/ubuntu/install.pp b/manifests/server/ubuntu/install.pp new file mode 100644 index 0000000..83a7629 --- /dev/null +++ b/manifests/server/ubuntu/install.pp @@ -0,0 +1,7 @@ +class nfs::server::ubuntu::install { + + package { 'nfs-kernel-server': + ensure => installed + } + +} diff --git a/manifests/server/ubuntu/service.pp b/manifests/server/ubuntu/service.pp new file mode 100644 index 0000000..1079aa4 --- /dev/null +++ b/manifests/server/ubuntu/service.pp @@ -0,0 +1,26 @@ +class nfs::server::ubuntu::service { + + if $nfs::server::ubuntu::service_manage { + if $nfs::server::ubuntu::nfs_v4 == true { + service {'nfs-kernel-server': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-kernel-server'], + subscribe => [ Concat['/etc/exports'], Augeas['/etc/idmapd.conf','/etc/default/nfs-common'] ], + } + } else { + service {'nfs-kernel-server': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package['nfs-kernel-server'], + subscribe => Concat['/etc/exports'], + } + } + + Package['rpcbind'] -> Service['rpcbind'] + } +} diff --git a/metadata.json b/metadata.json index 043cbeb..9c8beaa 100644 --- a/metadata.json +++ b/metadata.json @@ -1,25 +1,58 @@ { "operatingsystem_support": [ { - "operatingsystem": "RedHat" + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] }, { - "operatingsystem": "CentOS" + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] }, { - "operatingsystem": "Scientific" + "operatingsystem": "Scientific", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] }, { - "operatingsystem": "Debian" + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "6", + "7", + "8" + ] }, { - "operatingsystem": "Ubuntu" + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "10.04", + "12.04", + "14.04" + ] + }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] } ], "requirements": [ { "name": "pe", - "version_requirement": "3.x" + "version_requirement": ">= 3.7.0" }, { "name": "puppet", @@ -27,7 +60,7 @@ } ], "name": "echocat-nfs", - "version": "1.6.0", + "version": "1.7.0", "source": "git clone https://github.com/echocat/puppet-nfs.git", "author": "echocat", "license": "Apache-2.0", @@ -35,8 +68,8 @@ "project_page": "https://github.com/echocat/puppet-nfs", "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 <2.0.0"}, + {"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"}, + {"name":"puppetlabs/concat","version_requirement":">= 1.1.1 < 2.0.0"}, {"name":"herculesteam/augeasproviders_shellvar","version_requirement":">= 2.1.0"} ] } diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index bd6edfc..37215c5 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -3,7 +3,7 @@ describe 'nfs::client' do context "operatingsysten => ubuntu" do let(:facts) { {:operatingsystem => 'ubuntu', } } - it { should contain_class('nfs::client::debian') } + it { should contain_class('nfs::client::ubuntu') } end context "operatingsysten => debian" do let(:facts) { {:operatingsystem => 'debian', } } diff --git a/spec/classes/client_ubuntu_spec.rb b/spec/classes/client_ubuntu_spec.rb new file mode 100644 index 0000000..0140614 --- /dev/null +++ b/spec/classes/client_ubuntu_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' +describe 'nfs::client::ubuntu' do + + it do + should contain_class('nfs::client::ubuntu::install') + should contain_class('nfs::client::ubuntu::configure') + should contain_class('nfs::client::ubuntu::service') + + should contain_service('rpcbind').with( + 'ensure' => 'running' + ) + + should contain_service('idmapd').with( + 'ensure' => 'stopped' + ) + should contain_package('nfs-common') + should contain_package('rpcbind') + + should contain_package('nfs4-acl-tools') + end + context ":nfs_v4 => true" do + let(:params) {{ :nfs_v4 => true }} + it do + should contain_augeas('/etc/idmapd.conf') + should contain_service('idmapd').with( + 'ensure' => 'running' + ) + end + end + +end diff --git a/spec/classes/server_redhat_spec.rb b/spec/classes/server_redhat_spec.rb index 914bcab..81a0da6 100644 --- a/spec/classes/server_redhat_spec.rb +++ b/spec/classes/server_redhat_spec.rb @@ -7,7 +7,7 @@ should contain_service('nfs').with( 'ensure' => 'running' ) end end - + context "operatingsystemrelease => 7.1" do let(:facts) { {:operatingsystemrelease => '7.1', :operatingsystemmajrelease => '7'} } it do diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 897f8a4..0a6717b 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -15,7 +15,7 @@ context "operatingsysten => ubuntu" do let(:facts) { {:operatingsystem => 'ubuntu', :concat_basedir => '/tmp', } } - it { should contain_class('nfs::server::debian') } + it { should contain_class('nfs::server::ubuntu') } end context "operatingsysten => ubuntu with params for mountd" do @@ -23,7 +23,7 @@ let(:params) {{ :mountd_port => '4711', :mountd_threads => '99' }} it do - should contain_class('nfs::server::debian').with( 'mountd_port' => '4711', 'mountd_threads' => '99' ) + should contain_class('nfs::server::ubuntu').with( 'mountd_port' => '4711', 'mountd_threads' => '99' ) end end diff --git a/spec/classes/server_ubuntu_spec.rb b/spec/classes/server_ubuntu_spec.rb new file mode 100644 index 0000000..731e0bd --- /dev/null +++ b/spec/classes/server_ubuntu_spec.rb @@ -0,0 +1,25 @@ + +require 'spec_helper' +describe 'nfs::server::ubuntu', :type => :class do + it do + should contain_class('nfs::client::ubuntu') + should contain_class('nfs::server::ubuntu::service') + should contain_package('nfs-kernel-server') + should contain_service('nfs-kernel-server').with( 'ensure' => 'running' ) + end + context ":nfs_v4 => true" do + let(:params) {{ :nfs_v4 => true }} + it do + should contain_service('idmapd').with( 'ensure' => 'running' ) + 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 +