Merge pull request #81 from ghoneycutt/use_hiera_array_for_deep_merge

Use hiera array for deep merge
This commit is contained in:
Garrett Honeycutt 2014-08-09 11:41:56 -04:00
commit 7dc420ef12
2 changed files with 33 additions and 20 deletions

View File

@ -366,22 +366,6 @@ class ssh (
validate_array($sshd_config_macs)
}
if $sshd_config_denyusers != undef {
validate_array($sshd_config_denyusers)
}
if $sshd_config_denygroups != undef {
validate_array($sshd_config_denygroups)
}
if $sshd_config_allowusers != undef {
validate_array($sshd_config_allowusers)
}
if $sshd_config_allowgroups != undef {
validate_array($sshd_config_allowgroups)
}
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}>.")
}
@ -499,6 +483,35 @@ class ssh (
$supported_loglevel_vals=['QUIET', 'FATAL', 'ERROR', 'INFO', 'VERBOSE']
validate_re($sshd_config_loglevel, $supported_loglevel_vals)
#enable hiera merging for allow groups and allow users
if $hiera_merge_real == true {
$sshd_config_denygroups_real = hiera_array('ssh::sshd_config_denygroups', undef)
$sshd_config_denyusers_real = hiera_array('ssh::sshd_config_denyusers', undef)
$sshd_config_allowgroups_real = hiera_array('ssh::sshd_config_allowgroups', undef)
$sshd_config_allowusers_real = hiera_array('ssh::sshd_config_allowusers', undef)
} else {
$sshd_config_denygroups_real = $sshd_config_denygroups
$sshd_config_denyusers_real = $sshd_config_denyusers
$sshd_config_allowgroups_real = $sshd_config_allowgroups
$sshd_config_allowusers_real = $sshd_config_allowusers
}
if $real_sshd_config_denyusers != undef {
validate_array($real_sshd_config_denyusers)
}
if $real_sshd_config_denygroups != undef {
validate_array($real_sshd_config_denygroups)
}
if $real_sshd_config_allowusers != undef {
validate_array($real_sshd_config_allowusers)
}
if $real_sshd_config_allowgroups != undef {
validate_array($real_sshd_config_allowgroups)
}
package { $packages_real:
ensure => installed,
source => $ssh_package_source_real,

View File

@ -167,14 +167,14 @@ Ciphers <%= @sshd_config_ciphers.join(',') %>
MACs <%= @sshd_config_macs.join(',') %>
<% end -%>
<% if @sshd_config_denyusers -%>
DenyUsers <%= @sshd_config_denyusers.join(' ') %>
DenyUsers <%= @sshd_config_denyusers_real.join(' ') %>
<% end -%>
<% if @sshd_config_denygroups -%>
DenyGroups <%= @sshd_config_denygroups.join(' ') %>
DenyGroups <%= @sshd_config_denygroups_real.join(' ') %>
<% end -%>
<% if @sshd_config_allowusers -%>
AllowUsers <%= @sshd_config_allowusers.join(' ') %>
AllowUsers <%= @sshd_config_allowusers_real.join(' ') %>
<% end -%>
<% if @sshd_config_allowgroups -%>
AllowGroups <%= @sshd_config_allowgroups.join(' ') %>
AllowGroups <%= @sshd_config_allowgroups_real.join(' ') %>
<% end -%>