Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active December 29, 2015 00:29
Show Gist options
  • Save binford2k/7586795 to your computer and use it in GitHub Desktop.
Save binford2k/7586795 to your computer and use it in GitHub Desktop.
#! /opt/puppet/bin/ruby
require 'json'
raise "Run this script with a node name that has had a catalog compiled on this master" unless ARGV.size == 1
catalog = JSON.parse(File.read("/var/opt/lib/pe-puppet/client_data/catalog/#{ARGV[0]}.json"))
puts " Class count: #{catalog['data']['resources'].select { |r| r['type'] == 'Class' }.size}"
puts "Resource count: #{catalog['data']['resources'].reject { |r| r['type'] == 'Class' }.size}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment