Skip to content

Instantly share code, notes, and snippets.

@glarizza
Created January 27, 2016 18:41
Show Gist options
  • Save glarizza/e92a5e4ddd67b707f7b1 to your computer and use it in GitHub Desktop.
Save glarizza/e92a5e4ddd67b707f7b1 to your computer and use it in GitHub Desktop.
Puppet Issues

I'm seeing the following errors pop up:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: The value 'certdir' cannot be converted to Numeric. on node agent1.puppetlabs.vm
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This results from the following code:

  $sslpaths = {
    'certdir'       => 'certs',
    'privatedir'    => 'private',
    'privatekeydir' => 'private_keys',
    'publickeydir'  => 'public_keys',
    'requestdir'    => 'certificate_requests',
  }

  $sslpaths.each |String $setting, String $subdir| {
    #notify { "The output is: ${::puppet_sslpaths[$setting]['path_exists']}":}
    notify { "The output is: ${::puppet_sslpaths[$setting]}":}
    #if $::puppet_sslpaths[$setting]['path_exists'] {
    #  file { "${ssl_dir}/${subdir}":
    #    ensure  => directory,
    #    source  => $::puppet_sslpaths[$setting]['path'],
    #    backup  => false,
    #    recurse => true,
    #  }
    #}
  }
}

This code comes from the puppet_agent::prepare::ssl class in the puppet_agent module you can find here --> https://github.com/puppetlabs/puppetlabs-puppet_agent/blob/master/manifests/prepare/ssl.pp#L26-L35

What I'm THINKING is that it's having a hard time dereferencing the hash element based on a variable that was cast to a String (i.e. $setting). It's trying to cast that to a numeric value, and there's the error message, but I'm still trying to do some debugging...

@sepulworld
Copy link

Running into the same issue. Did you find a work around?

@glarizza
Copy link
Author

glarizza commented Jul 6, 2016

@sepulworld Yep, see the Readme on the puppet_agent module - you have to enable stringifyfacts in puppet.conf before proceeding, and I didn't do that

@hpcprofessional
Copy link

hpcprofessional commented Jul 6, 2016

By "enable" I think @glarizza means toggle (to off) https://forge.puppet.com/puppetlabs/puppet_agent#setup-requirements

I just ran into this same issue myself. (Puppet in 3.x defaults to stringify_facts = true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment