The Foreman is providing you an opportunity to define a default for the class parameter
for its own purposes. This default applies when you assign a class to a node directly via The Foreman, but it is external to Puppet. It does not apply when one class assigns another to the node.
You have three main options:
- In class B, use resource-like declaration of class A, in which you explicitly specify a value for class A's parameter.
- Rely on automated data binding (i.e. Hiera) to specify a value for class A's parameter.
- Specify your default value for the parameter in class A's definition.
In fact, those options are non-exclusive: you can use any combination. They are listed in priority order; the first one that provides a parameter value wins. For classes assigned directly via The Foreman, any parameter assignments via The Foreman are roughly equivalent to option (1). Parameter value binding is evaluated on a per-parameter basis, so different parameters' values can be assigned via different options.
HOWEVER, if you have any classes that may be declared more than once then option (1) is largely off the table. That option can be exercised at most once for any given class, and that must occur in the first-evaluated declaration of the class for a given catalog. It can be difficult to control the order in which declarations are evaluated, so exercising option (1) safely can be tricky.
Inasmuch as you can have only one default value per parameter built into a class definition, and inasmuch as one prefers to avoid modifying third-party modules, option (3) has somewhat limited utility. You cannot rely on it (exclusively) where you want a parameter to take different values in different cases, and if you do not like the value you get this way then your only means to change it is to modify the class definition.
That leaves option (2) as the only truly general-purpose approach. Automated data binding was one of the greatest advances in Puppet 3 -- learn it, live it, love it.
John