Fix service hasstatus for Solaris 9

This commit is contained in:
Mark Nalyanya 2014-02-28 16:06:18 +01:00 committed by Garrett Honeycutt
parent 965bc661d0
commit 0523bac29a
3 changed files with 30 additions and 8 deletions

View File

@ -346,9 +346,9 @@ Specify that the init script has a restart command. Valid values are 'true' and
service_hasstatus
-----------------
Declare whether the service's init script has a functional status command. Valid values are 'true' and 'false'
Boolean to declare whether the service's init script has a functional status command.
- *Default*: 'true'
- *Default*: 'USE_DEFAULTS'
ssh_key_ensure
--------------

View File

@ -52,7 +52,7 @@ class ssh (
$service_name = 'USE_DEFAULTS',
$service_enable = 'true',
$service_hasrestart = 'true',
$service_hasstatus = 'true',
$service_hasstatus = 'USE_DEFAULTS',
$ssh_key_ensure = 'present',
$ssh_key_type = 'ssh-rsa',
$keys = undef,
@ -78,7 +78,8 @@ class ssh (
$default_sshd_gssapikeyexchange = undef
$default_sshd_pamauthenticationviakbdint = undef
$default_sshd_gssapicleanupcredentials = 'yes'
$default_sshd_acceptenv = true
$default_sshd_acceptenv = true
$default_service_hasstatus = true
}
'Suse': {
$default_packages = 'openssh'
@ -96,6 +97,7 @@ class ssh (
$default_sshd_pamauthenticationviakbdint = undef
$default_sshd_gssapicleanupcredentials = 'yes'
$default_sshd_acceptenv = true
$default_service_hasstatus = true
case $::architecture {
'x86_64': {
$default_sshd_config_subsystem_sftp = '/usr/lib64/ssh/sftp-server'
@ -126,6 +128,7 @@ class ssh (
$default_sshd_pamauthenticationviakbdint = undef
$default_sshd_gssapicleanupcredentials = 'yes'
$default_sshd_acceptenv = true
$default_service_hasstatus = true
}
'Solaris': {
$default_packages = ['SUNWsshcu',
@ -149,10 +152,12 @@ class ssh (
$default_sshd_acceptenv = false
case $::kernelrelease {
'5.10','5.11': {
$default_service_name = 'ssh'
$default_service_name = 'ssh'
$default_service_hasstatus = true
}
'5.9' : {
$default_service_name = 'sshd'
$default_service_name = 'sshd'
$default_service_hasstatus = false
}
default: {
fail('ssh module supports Solaris kernel release 5.9, 5.10 and 5.11.')
@ -289,6 +294,23 @@ class ssh (
}
}
if $service_hasstatus == 'USE_DEFAULTS' {
$service_hasstatus_real = $default_service_hasstatus
} else {
case type($service_hasstatus) {
'string': {
validate_re($service_hasstatus, '^(true|false)$', "ssh::service_hasstatus may be either 'true' or 'false' and is set to <${service_hasstatus}>.")
$service_hasstatus_real = str2bool($service_hasstatus)
}
'boolean': {
$service_hasstatus_real = $service_hasstatus
}
default: {
fail('ssh::service_hasstatus type must be true or false.')
}
}
}
# validate params
if $ssh_config_hash_known_hosts_real != undef {
validate_re($ssh_config_hash_known_hosts_real, '^(yes|no)$', "ssh::ssh_config_hash_known_hosts may be either 'yes' or 'no' and is set to <${ssh_config_hash_known_hosts_real}>.")
@ -454,7 +476,7 @@ class ssh (
name => $service_name_real,
enable => $service_enable,
hasrestart => $service_hasrestart,
hasstatus => $service_hasstatus,
hasstatus => $service_hasstatus_real,
subscribe => File['sshd_config'],
}

View File

@ -367,7 +367,7 @@ describe 'ssh' do
'name' => 'sshd',
'enable' => 'true',
'hasrestart' => 'true',
'hasstatus' => 'true',
'hasstatus' => 'false',
'subscribe' => 'File[sshd_config]',
})
}