Error 400 on SERVER: Scope variable name is a Symbol

image_pdfimage_print

Get this error when running a manifest with an undefined has value:


Error 400 on SERVER: Scope variable name is a Symbol

Update to the latest version of puppet (3.2.3 at the time of the writing) and a more helpful error is sent:


Error: Could not retrieve catalog from remote server: Error 400 on SERVER: $hash[$env] is :undef, not a hash or array at /etc/puppet/environments/production/modules/hybris/manifests/config.pp:28 on node foo.local

Solution
I had initialized my hash as empty in the parameterized class:


class hybris::config( $hybris_home="/opt/hybris", $hash = {} ) {

Later in the code, I check for a value in the hash, but since I did not define the hash in hiera, it comes back as undefined and throw the 400 error. The workaround was to check if the hash is defined before checking the hash values:


# Only push out local.properties if manage = "yes"
if $hash[$env] != undef {
$managed = $hash[$env][$context]['managed']
notify{"Local properties managed: $managed": }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Spam Blocker