You're passing a single array into postgresql_password() when it expects
two string arguments in your first example. Try removing the right angle
brackets that are fencing your two hiera calls.

 postgresql::server::role { [hiera(my::db::user)]:
    password_hash => postgresql_password(hiera(my::db::user),
hiera(my::db::pass)),
  }

-Alex

On Fri, Feb 13, 2015 at 11:13 AM, Begum Tuncer <raib...@gmail.com> wrote:

> Hello,
> I've a problem with hiera and functions.
>
> I'd like to manage a postgresql role like this:
>
>
> postgresql::server::role { 'marmot':  password_hash => 
> postgresql_password('marmot', 'mypasswd'),}
>
>
> In above, how can I use hiera in the function part?
>
> I tried:
>   postgresql::server::role { [hiera(my::db::user)]:
>     password_hash => postgresql_password([hiera(my::db::user),
> hiera(my::db::pass)]),
>   }
>
> where hiera variables:
> my::db::user: 'marmot'
> my::db::pass: 'mypasswd'
>
> The error was:
> Error 400 on SERVER: can't convert Array into String
>
> I also tried a merged hiera variable as array but it didnt work either:
>
>   postgresql::server::role { [hiera(my::db::user)]:
>     password_hash => postgresql_password([hiera(my::db::userpass)]),
>   }
>
> where i defined the hiera variable as array,
>   my::db::userpass:
>     - 'marmot'
>     - 'mypasswd'
>
> But got an error like this:
> Error 400 on SERVER: postgresql_password(): Wrong number of arguments
> given (1 for 2)
>
> I also tried hiera_array and hiera_hash but none of them helps.
>
> Any clues?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5e9a0388-6db9-4adb-9326-35623a39aafd%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/5e9a0388-6db9-4adb-9326-35623a39aafd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alex Elman

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAD-8G_qLw66qTxF_GwVL1jaEuX%3DMdvD2GV4AX34-CY6TYNYOqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to