Skip to content

Commit

Permalink
Merge pull request haraldsk#3 from haw-hh-ai-lab/fix_debian_service_c…
Browse files Browse the repository at this point in the history
…ycle_squashed

Fix debian service cycle squashed
  • Loading branch information
dwerder committed Dec 12, 2014
2 parents d048f87 + 2ba3146 commit ff31139
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 57 deletions.
12 changes: 4 additions & 8 deletions manifests/client/debian/install.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
class nfs::client::debian::install {

case $::lsbdistcodename {
'lucid': {
package { 'portmap':
ensure => installed,
}
} default: {

package { 'rpcbind':
ensure => installed,
}
}
}

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


package { ['nfs-common', 'nfs4-acl-tools']:
ensure => installed,
Expand Down
26 changes: 10 additions & 16 deletions manifests/client/debian/service.pp
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
class nfs::client::debian::service {
Service {
require => Class['nfs::client::debian::configure'] }

Service{
require => Class['nfs::client::debian::configure']
service { "rpcbind":
ensure => running,
enable => true,
hasstatus => false,
}

service { "portmap":
ensure => running,
enable => true,
hasstatus => false,
}

if $nfs::client::debian::nfs_v4 {
service {
'idmapd':
ensure => running,
subscribe => Augeas['/etc/idmapd.conf', '/etc/default/nfs-common'],
service { 'idmapd':
ensure => running,
subscribe => Augeas['/etc/idmapd.conf', '/etc/default/nfs-common'],
}
} else {
service {
'idmapd':
ensure => stopped,
}
service { 'idmapd': ensure => stopped, }
}
}
21 changes: 1 addition & 20 deletions manifests/server/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,5 @@
nfs_v4_idmap_domain => $nfs_v4_idmap_domain,
}

package { 'nfs-kernel-server':
ensure => 'installed',
}

if $nfs_v4 == true {
service {
'nfs-kernel-server':
ensure => running,
subscribe => [
Concat['/etc/exports'],
Augeas['/etc/idmapd.conf', '/etc/default/nfs-common']
],
}
} else {
service {
'nfs-kernel-server':
ensure => running,
subscribe => Concat['/etc/exports'],
}
}
include nfs::server::debian::install, nfs::server::debian::service
}
7 changes: 7 additions & 0 deletions manifests/server/debian/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class nfs::server::debian::install {

package { 'nfs-kernel-server':
ensure => installed
}

}
22 changes: 22 additions & 0 deletions manifests/server/debian/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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'],
}
}
}
16 changes: 3 additions & 13 deletions spec/classes/client_debian_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
should contain_class('nfs::client::debian::configure')
should contain_class('nfs::client::debian::service')

should contain_service('portmap').with(
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 }}
Expand All @@ -27,15 +28,4 @@
end
end

context ":lsbcodedistname => lucid" do
let(:facts) { {:lsbdistcodename => 'lucid', } }
it do
should contain_package('portmap')
end
end
context "lsbcodedistname => undef" do
it do
should contain_package('rpcbind')
end
end
end

0 comments on commit ff31139

Please sign in to comment.