daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import json
  2. import pprint
  3. import subprocess
  4. clientcert = subprocess.check_output(['puppet', 'config', 'print', 'certname']).strip()
  5. catalog_file = '/opt/puppetlabs/puppet/cache/client_data/catalog/' + clientcert + '.json'
  6. with open(catalog_file) as f:
  7.     data = json.load(f)
  8. pp = pprint.PrettyPrinter(indent=4)
  9.  
  10. for res in data['resources']:
  11.     if res['type'] == 'Class':
  12.     print(res['title'])
  13.     print("================================================================================")
  14.    
  15.         if 'parameters' in res:
  16.         for param in res['parameters']:
  17.             print(param + " => " + str(res['parameters'][param]))
  18.         else:
  19.             print "_none_"
  20.         print "\n"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top