Manually apply puppet class

First, a trick for verifying syntax if you don't already know:

puppet parser validate my_file.pp

Now, how you approach spot-testing a new class can vary based on your deployment but I can tell you how I do it, and perhaps it will make sense in your case. Or perhaps everyone on ServerFault will tell me how wrong I am.

In any given environment I have a set of node declarations using inheritance:

node base_production_environment {
  include ssh
  include ntp
  include whatever_else
}

node /prod-app\d+\.mycompany\.com/ inherits base_production_environment { }

Now, when I write a new class, I want to test it on a particular system first before rolling it out, so I add a more specific (by hostname) node declaration so that it will override the less specific (by regular expression) declaration, like so:

node 'prod-app7.mycompany.com' inherits base_production_environment {
  include my_new_class
}

I simplified this a lot to highlight using specific node declarations for spot-checking new classes. We also use environments to roll out changes to less critical environments prior to rolling them out to production, etc.


So I just re-read your question and it occurred to me that you may be using a pushed modules directory approach, rather than using a puppetmaster. If that's true, you can include a class for testing purposes with something like:

puppet apply --modulepath=C:\puppet-modules\ -e "include my_class"

I don't know if that's the correct directory syntax for puppet under Windows, though.