Hiera array problem

108 views
Skip to first unread message

Begum Tuncer

unread,
Feb 13, 2015, 12:13:57 PM2/13/15
to puppet...@googlegroups.com
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?

Alex Elman

unread,
Feb 13, 2015, 1:24:59 PM2/13/15
to puppet...@googlegroups.com
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

--
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...@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.
For more options, visit https://groups.google.com/d/optout.



--
Alex Elman
Reply all
Reply to author
Forward
0 new messages