Skip to content

Instantly share code, notes, and snippets.

@justinhennessy
Last active December 26, 2015 07:29
Show Gist options
  • Save justinhennessy/7115696 to your computer and use it in GitHub Desktop.
Save justinhennessy/7115696 to your computer and use it in GitHub Desktop.
A Hiera issue

heira.yaml

---
:backends:
  - yaml

:yaml:
  :datadir: '/etc/puppet/hieradata'

:hierarchy:
  - "%{::domain}/supporter_url_redirects"
  - "edhusers"

hieradata/edhusers.yaml

---
everydayhero:
  justinh:
    ensure:   'present'
    comment:  'Justin Hennessy'
    uid:      '2003'
    gid:      'www-data'
    groups:   ['sudo', 'edhdev', 'ssh', 'www-data', 'edh']
    env:      ['prod', 'staging', 'sandbox']
    ssh_name: 'justinh@macbook22.edh.local'
    ssh_key:  'AAAAB3NzaC1yc2EAAAADAQABAAABAQDGDFzaHmHfYBY4z7/kmXTwMf/8tFEzktjA0aRxSrWLsVJ6sSABBngJhsODEzBiHAEFJKsFopo6iZHIjTi3PQ24zsfgCNuek8GDbBuwcYA1YKZtWt8VIyzRIKOWCIYoPxq6W1F8OT4x8UVzytnTDH40Ufa5Pcd/b89OcYhX7P+ZfukB13QmgoGdqlFqidXUQQb3BPEU7HrCmlXXsf9Ao1Pr5n/8sLy4ZD8y+QRySBrW6KtvVmV9wpwJDORJ4Z5Edue6y+UcHtqO4mrtOvpnawvtrwAgAIolAqPnFbrZOZxGLgiVyl81YGqijALZ/dce5N/QjxxCIEDCSb2GTa+ovthr'

This is how I am referencing them

$edh_users = hiera('everydayhero') # this is line 73 of init.pp
$vendor_users = hiera('vendors')

notify { "${edh_users}": }
notify { "${vendor_users}": }

I run

sudo puppet agent -t --noop

on the agent and get this error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item everydayhero in any Hiera data file and no default supplied at /etc/puppet/modules/users/manifests/init.pp:73 on node vm6.edheroy.com

When I run a debug on the server

hiera everydayhero -d

I get this

DEBUG: Wed Oct 23 19:55:09 +1000 2013: Hiera YAML backend starting
DEBUG: Wed Oct 23 19:55:09 +1000 2013: Looking up everydayhero in YAML backend
DEBUG: Wed Oct 23 19:55:09 +1000 2013: Looking for data source edhusers
DEBUG: Wed Oct 23 19:55:09 +1000 2013: Found everydayhero in edhusers
{"justinh"=>{"uid"=>"2003", "ssh_key"=>"AAAAB3NzaC1yc2EAAAADAQABAAABAQDGDFzaHmHfYBY4z7/kmXTwMf/8tFEzktjA0aRxSrWLsVJ6sSABBngJhsODEzBiHAEFJKsFopo6iZHIjTi3PQ24zsfgCNuek8GDbBuwcYA1YKZtWt8VIyzRIKOWCIYoPxq6W1F8OT4x8UVzytnTDH40Ufa5Pcd/b89OcYhX7P+ZfukB13QmgoGdqlFqidXUQQb3BPEU7HrCmlXXsf9Ao1Pr5n/8sLy4ZD8y+QRySBrW6KtvVmV9wpwJDORJ4Z5Edue6y+UcHtqO4mrtOvpnawvtrwAgAIolAqPnFbrZOZxGLgiVyl81YGqijALZ/dce5N/QjxxCIEDCSb2GTa+ovthr", "ensure"=>"present", "ssh_name"=>"justinh@macbook22.edh.local", "comment"=>"Justin Hennessy", "gid"=>"www-data", "groups"=>["sudo", "edhdev", "ssh", "www-data", "edh"], "env"=>["prod", "staging", "sandbox"]}}

Which looks completely successful! What the!

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