diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-05-21 10:29:03 -0400 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-05-21 10:29:03 -0400 |
commit | f3c0115743cab9d4e6c08b654b67631566572d41 (patch) | |
tree | cae768774a764ef0bd9cb3cc53b6196d782b71f1 /manifests/ssh_authorized_key.pp | |
parent | 4c87f6bd1e2b4cc4ed2d605386983623230c53af (diff) | |
download | puppet-sshd-f3c0115743cab9d4e6c08b654b67631566572d41.tar.gz puppet-sshd-f3c0115743cab9d4e6c08b654b67631566572d41.tar.bz2 |
Simplify ssh_authorized_key
Diffstat (limited to 'manifests/ssh_authorized_key.pp')
-rw-r--r-- | manifests/ssh_authorized_key.pp | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/manifests/ssh_authorized_key.pp b/manifests/ssh_authorized_key.pp index f942d62..7702914 100644 --- a/manifests/ssh_authorized_key.pp +++ b/manifests/ssh_authorized_key.pp @@ -48,45 +48,32 @@ define sshd::ssh_authorized_key( # nothing a user can't already do by writing their own file resources, # we still depend on the filesystem permissions to keep things safe. if $override_builtin { - case $options { - 'absent': { - info("not setting any option for ssh_authorized_key: ${name}") - $header = "# HEADER: This file is managed by Puppet.\n" - file { $real_target: - ensure => $ensure, - content => "${header}${type} ${key}", - owner => $real_user, - mode => '0600'; - } - } - default: { - file { $real_target: - ensure => $ensure, - content => "${header}${options} ${type} ${key}", - owner => $real_user, - mode => '0600'; - } - } + $header = '# HEADER: This file is managed by Puppet.' + + file { $real_target: + ensure => $ensure, + owner => $real_user, + mode => '0600', + content => $options ? { + 'absent' => "${header}\n${type} ${key}", + default => "${header}\n${options} ${type} ${key}", + }, } + } else { + ssh_authorized_key{$name: - ensure => $ensure, - type => $type, - key => $key, - user => $real_user, - target => $real_target, + ensure => $ensure, + type => $type, + key => $key, + user => $real_user, + target => $real_target, + options => $options ? { + 'absent' => undef, + default => $options, + }, } - case $options { - 'absent': { - info("not setting any option for ssh_authorized_key: ${name}") - } - default: { - Ssh_authorized_key[$name]{ - options => $options, - } - } - } } } |