[Answering own question after getting around to prodding at the config for a while]
I've managed to track this down to one of the modules which I have written (of course), but it was due to a use of a variable which didn't work out how I expected.
What happened was:
$variable_dir = "/etc/puppet/bar"
class foo {
file { $variable_dir:
ensure => directory
}
}
define some-define() {
# Trimmed for brevity
exec { "some-$name":
# command, creates, timeout etc here
require => File[$variable_dir],
}
}
..which basically caused some confusion with the File[] using a variable. I've replaced these with the explicit value of the variable for now and it all works fine, but it was something of a surprise! I'm assuming that my understanding of scope and when variables can be defined/used is somewhat out of whack with Puppet, so I'm going to learn that a lot better...
It seems to have caused the same behaviour as using non-fully-qualified paths on file strings, by failing to find the variable or not obtaining the value? Quite odd, anyway.
Edit : It's quite possible that the variable wasn't found in scope, and so was empty and definitely not a fully-qualified path. Doesn't explain why this was not consistent, however...
Two things regarding your puppet code.
The define should be in it's own file (named add_user.pp, and located in the <modulename>/manifests/
folder) , rather than in the class file.
Set the define up (change $name to $username, as $name is a reserved variable), and then add the same set of parameters as the define uses to the class. (which in your example would be $modulepath/users/manifests/add.pp
to make it work with the autoloader)
If you change the class as follows:
class users::add( $u_name, $u_comment, $u_home, $u_shell, $u_uid, $u_gid, $u_password)
{
users::add_user{ $u_name:
$username => $u_name,
$comment => $u_comment,
$home => $u_home,
$shell => $u_shell,
$uid => $u_uid,
$gid => $u_gid,
$password => $u_password,
}
}
And change the site.pp to:
import "classes/*.pp"
node default{
class { 'add_user':
username => "saga",
comment => "Arun Sag",
gid => "100",
home => "/home/saga",
password => '$1$passwordhash/',
shell => "/bin/bash",
uid => "70960",
}
}
For the yaml, something like this will do it, please refer to the documentation for more details:
---
classes:
users::add:
parameters:
name: some_name
comment: some_comment
home: home_value
shell: /bin/sh
uid: 3990
gid: 3990
password: superstrongpassword
environment:
production
Best Answer
Puppet does not support inheritance with parameterized base classes, i.e. the base class must not be parameterized for inheritance to work. So what you are trying to do is currently not possible.
See here for details: http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html#inheritance