Skip to content

Instantly share code, notes, and snippets.

@ffrank
Last active January 2, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ffrank/8327298 to your computer and use it in GitHub Desktop.
Save ffrank/8327298 to your computer and use it in GitHub Desktop.
puppet ssh_authorized_keys behavior is potentially confusing
Consider the current ssh_authrized_keys state and puppet manifest below.
Puppet will sync the key options away, although the manifest doesn't mention them at all.
That's because the 'options' property defaults to 'absent'.
This strikes me as unsound. There's two more sane ways I can imagine:
1. Forgo default values for all properties
2. Make default values special, so that properties use them only
when creating a new managed entity on the system
(i.e. the resource is changed from absent to a present state).
The former alternative is not practical of course,
because values are usually needed
when changing resources from absent to present.
puppet apply -e 'ssh_authorized_key { "ffrank@geras": user => "ffrank }'
Notice: Compiled catalog for geras.localdomain in environment production in 0.19 seconds
Notice: /Stage[main]//Ssh_authorized_key[ffrank@geras]/options: current_value command="logger -- ssh opened with cmd $SSH_ORIGINAL_COMMAND", should be absent (noop)
Notice: Class[Main]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 events
Notice: Finished catalog run in 0.39 seconds
command="logger -- ssh opened with cmd $SSH_ORIGINAL_COMMAND" ssh-rsa <actual-key-here> ffrank@geras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment