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.
You can name your classes as you want, but you need to use the right name for resources. In this case, the resource you want to use is user
.
There is a very simple way to know how a resource should look:
$ puppet resource user dawud
user { 'dawud':
ensure => 'present',
comment => 'David Sastre Medina,,,',
gid => '1001',
groups => ['sudo', 'audio', 'src', 'video', 'libvirt'],
home => '/home/dawud',
shell => '/bin/bash',
uid => '1001',
}
That code, inside a class would look:
class foo {
user { 'dawud':
ensure => 'present',
comment => 'David Sastre Medina,,,',
gid => '1001',
groups => ['sudo', 'audio', 'src', 'video', 'libvirt'],
home => '/home/dawud',
shell => '/bin/bash',
uid => '1001',
}
}
Puppetlabs have a very good documentation on the resource abstraction layer, RAL for short.
Best Answer
Yes. Do you have the pluginsync=true in the right section in your puppet.conf (either [main] or [puppetd]) and do you have removed any old puppetd.conf?