I have the following params in hiera:
base::users:
john@example.com:
ensure: present
user: john
sudo: true
type: ssh-rsa
key: AAAAB3NzaC1yc2EAAAABJ
in puppet i'm getting the following hash:
{john@example.com => {ensure => present, user => john, sudo => true, type => ssh-rsa, key => AAAAB3NzaC1yc2EAAAABJ}}
Then i'm calling create resources to create appropriate authorized_keys file:
create_resources('ssh_authorized_key', $users)
but it doesn't work because i have added new parameter 'sudo' and before calling create_resources I want to remove this key from hash and operate in another resource.
I've tried the next step to remove it:
$users_filtered = $users.each |$k, $v| { $v.delete['sudo'] }
i'm getting the next error:
Error while evaluating a Function Call, delete(): Wrong number of arguments given 1 for 2.
As I understand puppet tried to use 'delete' function from stdlib module. But i have also tried:
$users_filtered = $users.each |$k, $v| { delete($users, $v['sudo'] }
But it doesn't work. Appreciate any help