Skip to content

Instantly share code, notes, and snippets.

@jeffmccune
Created April 15, 2011 00:16
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 jeffmccune/920881 to your computer and use it in GitHub Desktop.
Save jeffmccune/920881 to your computer and use it in GitHub Desktop.
require 'puppet/face'
Puppet::Face.define(:catalog, '0.0.1') do
action :compareyaml do
summary "This action takes a list of node identifier names as a flat text
file, then loads a catalog in directory A and directory B exactly matching the
name. It them compares the catalogs. This is intended to compare catalogs
generated on older versions of a Puppet Master with catalogs generated on a
newer version of Puppet Master."
option "--nodelist TEXTFILE"
option "--catalogs-old DIRECTORY"
option "--catalogs-new DIRECTORY"
# JJM 2011-04-14 (I _think_ *args is the naive way of doing things)
# when_invoked do |*args|
when_invoked do |options|
options
# JJM 2011-04-14 There needs to be a better way to do this. Look into
# Puppet::Interface::ActionBuilder#option
raise ArgumentError, "Usage: puppet catalog compareyaml node.lst dir_old/ dir_new/" unless args.length >= 3
nodelist = args[0]
# This will usually be the "old" master version, e.g 0.24.8
dir_old = args[1]
# This will usually be the "new" mater version, e.g 2.6.7
dir_new = args[2]
"Hi!"
end
end
end
775 yaml_dev:master! % rdebug puppet -- catalog compareyaml node.lst jeff ttys004
[-2, 4] in /Users/jeff/catalogs/puppet27/puppet/bin/puppet
1 #!/usr/bin/env ruby
2
=> 3 require 'puppet/util/command_line'
4 Puppet::Util::CommandLine.new.execute
/Users/jeff/catalogs/puppet27/puppet/bin/puppet:3
require 'puppet/util/command_line'
(rdb:1) break /Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb:19
Breakpoint 1 file /Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb, line 19
(rdb:1) c
/Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb:18: warning: multiple values for
a block parameter (2 for 1)
from /Users/jeff/catalogs/puppet27/puppet/lib/puppet/interface/action.rb+eval:90
Breakpoint 1 at /Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb:19
[14, 23] in /Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb
14
15 # JJM 2011-04-14 (I _think_ *args is the naive way of doing things)
16 # when_invoked do |*args|
17
18 when_invoked do |options|
=> 19 options
20 # JJM 2011-04-14 There needs to be a better way to do this. Look into
21 # Puppet::Interface::ActionBuilder#option
22 raise ArgumentError, "Usage: puppet catalog compareyaml node.lst dir_old/ dir_new/" unless args.length >= 3
23 nodelist = args[0]
/Users/jeff/catalogs/puppet27/faces/catalog_yaml/lib/puppet/face/catalog/compareyaml.rb:19
options
(rdb:1) options
["node.lst", {}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment