Skip to content

Commit

Permalink
Add the pattern parameter to the service resource.
Browse files Browse the repository at this point in the history
Fixes GH-1.
  • Loading branch information
razorsedge committed Apr 11, 2015
1 parent 32b25f1 commit 21cd8c1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.markdown
Expand Up @@ -119,6 +119,11 @@ Default: true
Service has status command. Only set this if your platform is not supported or you know what you are doing.
Default: auto-set, platform specific

####`service_pattern`

Pattern to look for in the process table to determine if the daemon is running. Only set this if your platform is not supported or you know what you are doing.
Default: vmtoolsd

##Limitations

###OS Support:
Expand Down
10 changes: 10 additions & 0 deletions manifests/init.pp
Expand Up @@ -48,6 +48,13 @@
# doing.
# Default: auto-set, platform specific
#
# [*service_pattern*]
# Pattern to look for in the process table to determine if the daemon is
# running.
# Only set this if your platform is not supported or you know what you are
# doing.
# Default: vmtoolsd
#
# === Sample Usage:
#
# class { 'openvmtools': }
Expand All @@ -70,11 +77,13 @@
$service_name = $openvmtools::params::service_name,
$service_enable = true,
$service_hasstatus = $openvmtools::params::service_hasstatus,
$service_pattern = 'vmtoolsd',
) inherits openvmtools::params {

$supported = $openvmtools::params::supported

# Validate our booleans
validate_bool($with_desktop)
validate_bool($autoupgrade)
validate_bool($service_enable)
validate_bool($supported)
Expand Down Expand Up @@ -118,6 +127,7 @@
ensure => $service_ensure_real,
enable => $service_enable,
hasstatus => $service_hasstatus,
pattern => $service_pattern,
require => Package[$package_name],
}
} else {
Expand Down
31 changes: 29 additions & 2 deletions spec/classes/openvmtools_init_spec.rb
Expand Up @@ -44,7 +44,7 @@
it { should_not contain_service('vmtoolsd') }
end

context 'on a supported osfamily, vmware platform, default parameters' do
context 'on a supported osfamily, vmware platform, default parameters, RedHat' do
let(:params) {{}}
let :facts do {
:virtual => 'vmware',
Expand All @@ -56,7 +56,34 @@
end
it { should contain_package('open-vm-tools') }
it { should_not contain_package('open-vm-tools-desktop') }
it { should contain_service('vmtoolsd') }
it { should contain_service('vmtoolsd').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:pattern => 'vmtoolsd',
:require => 'Package[open-vm-tools]'
)}
end

context 'on a supported osfamily, vmware platform, default parameters, Debian' do
let(:params) {{}}
let :facts do {
:virtual => 'vmware',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:operatingsystemmajrelease => '14.04'
}
end
it { should contain_package('open-vm-tools') }
it { should_not contain_package('open-vm-tools-desktop') }
it { should contain_service('open-vm-tools').with(
:ensure => 'running',
:enable => true,
:hasstatus => false,
:pattern => 'vmtoolsd',
:require => 'Package[open-vm-tools]'
)}
end

context 'on a supported operatingsystem, vmware platform, custom parameters' do
Expand Down

0 comments on commit 21cd8c1

Please sign in to comment.