]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Escaping dotted notation for sshkey lookup
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 02:25:24 +0000 (00:25 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 02:25:24 +0000 (00:25 -0200)
manifests/user.pp

index eb303cb9b6d757bc0ba38d61d998eaecff632982..3ada103498831867086a88df7ae95f8565105a97 100644 (file)
@@ -1,14 +1,12 @@
 # Inspired by backupninja::sandbox
+#
+# Escaping dotted notation for sshkey lookup, see
+# https://puppet.com/docs/puppet/5.3/hiera_automatic.html#hiera-dotted-notation
 define backup::user(
   $ensure         = present,
   $hosting_domain = $::domain,
-  $sshkey         = '',
+  $sshkey         = hiera("'ssh_authorized_key::${name}.${hosting_domain}'"),
 ) {
-  $real_sshkey = $sshkey ? {
-    ''      => hiera("ssh_authorized_key::${name}.${hosting_domain}"),
-    default => $sshkey,
-  }
-
   user::manage { $name:
     ensure   => $ensure,
     password => '*',
@@ -16,6 +14,6 @@ define backup::user(
     gid      => 'backupninjas',
     shell    => '/bin/bash',
     homedir  => "${::backup::params::backupdir_remote}/${name}.${hosting_domain}",
-    sshkey   => $real_sshkey,
+    sshkey   => $sshkey,
   }
 }