Skip to content

bradq/glowing-octo-ninja

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#glowing-octo-ninja

##About The Glowing Octo Ninja (GON) is designed to make debugging hiera related puppet issues easier.

This will get a list of all certnames that the puppet after knows about, then scan your modulepath and find all explicit hiera(), hiera_array(), and hiera_hash() calls and extract the key names. It will then do the same hiera type of hiera lookup for each certificate the master is aware of.

Since facts are often needed to be able to properly traverse the hiera hierarchy, it can use mcollective, yaml files or json files as the source of these facts when making the lookups.

##Usage ###Examples and Notes When called with no options, it will act the same as if you passed in -u peadmin

# ./glowing-octo-ninja
Looking up hiera() call values for pe-323-master.domain.tld.
bar is text
pe_puppetdb::pe::database::reserved_non_postgresql_memory_in_bytes is nil
Looking up hiera_array() call values for pe-323-master.domain.tld.
bat is ["array1", "array2"]
Looking up hiera_hash() call values for pe-323-master.domain.tld.
baz is {"key1"=>"value1", "key2"=>"value2"}
pe_puppetdb::pe::database::database_config_hash is nil
pe_puppetdb::pe::java_args is nil

When called with the --yaml or --json options, a file will need to be created for each certificate that holds key-value pairs for any variables used in your hierarchy.

###Options

  • -h or --help
    • Description: Outputs usage information
  • -u <username> or --user <username>
    • Default: peadmin for Puppet Enterprise
    • Default: puppet for Puppet Open Source
    • Description: The username to use when using mcollective as a fact source
  • -y or --yaml
    • Description: Use <clientcertname>.yaml as the fact source.
  • -j or --json
    • Description: Use <clientcertname>.json as the fact source.
  • -d or --debug
    • Description: Enable the --debug flag when calling hiera.
  • -f <path>' or --filebase `
    • Default: .
    • Description: The path to be prepended to <clientcertname>.[yaml|json] when doing filebased fact source.

##Installation Simply clone the repo, and copy glowing-octo-ninja into somewhere in your path or add the bin directory to your path.. If you have StupidBashTard installed, please change the source line to source that instead of my modified version. The path to sbt_libs.sh will also need to be updated if you do not add the bin folder to your path.

##To Do

  1. Fix the internal help
  2. Locate and lookup class parameters
  3. Add ability to specify as single variable to look up across all nodes
  4. Add ability to specify a plaintext key=value file per node as a fact source
  5. Add ability to look up all variables for a single node
  6. Add ability to specify a group of nodes via regex
  7. Unit and regression tests
  8. Add Directory Environment support
  9. Provide an option to tell you what variables are used by hiera.yaml
  10. Switch to using the full version of SBT
  11. ??????
  12. Profit
  13. Same thing we do every night - try to take over the world!

##License See LICENSE

##Getting Help If you need help, please look me up in #puppet on Freenode. I am FriedBob. Please also open an issue here on the GitHub repo.

##FAQ

  • "Why"
    • Why not? hiera can be tricky to debug, and there are notany solid, uncomplicated ways to debug it so far.
  • "Why 'glowing-octo-ninja'?
    • I suck at naming, and this was a suggested repo name, and ninjas make everything better.
  • "Why doesn't it...?"
    • This is an early release, more features are planned. Feature requests and PRs are welcome.

##Acknowledgements, Thanks And Shoutouts

  • Many thanks to Kyle "Mr. Bash" Harper for his assistance with writing this.
  • Thanks to Brad Quellhorst for bug fixes and improved library handling.

About

Hiera debugging, simplified.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%