Issue #11964 has been reported by Lewis Marshall.
----------------------------------------
Bug #11964: Access a double nested hash from custom function fails
https://projects.puppetlabs.com/issues/11964
Author: Lewis Marshall
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version: 2.7.3
Keywords: nested hash
Branch:
Trying to access a doubly nested hash returned from a custom function results
in the error:
`err: Could not retrieve catalog from remote server: Error 400 on SERVER:
bob_db_user is not an hash or array when accessing it with database at
/...cool_app/manifests/init.pp:11 on node xyz.somewhere.com`
Using the function:
`
module Puppet::Parser::Functions
newfunction(:get_app_data, :type => :rvalue) do |args|
bob_db_user = { "user_name" => "a_bobdb_user" }
users = { "bob_db" => bob_db_user }
database = { "users" => users }
app_data_hash = { "database" => users, "user" => "bob" }
return app_data_hash
end
end
`
>From a class:
`
# Class to realise the configuration for all cool_apps defined
class cool_app ( $appenv ) {
#Create all the applications required:
cool_app::app_settings { $appenv: }
}
define cool_app::app_settings ( $cool_app = $title ) {
$app_data = get_app_data( $cool_app )
$app_user = $app_data["user"]
$bob_db_user = $app_data["database"]["users"]["bob_db"]["user_name"]
notify {"App User:${app_user}, ${bob_db_user}":}
}`
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.