Overriding types?

Charlie Schluting
Thu, 21 Dec 2006 20:51:06 -0000

"Service and class definitions are scoped just as variable assignments
are."

But what about types?

Here''s an example:
class solserver inherits server {
    remotefile { "/etc/shadow":
        mode => 400, group => staff,
        source => "solall/etc/shadow.server"
    }

Is it possible to just override the "/etc/shadow" definition for some
nodes? It certainly doesn''t work to just redefine the
remotefile["/etc/shadow"].

This is complicated to explain, but in the end, these special nodes do
inherit solserver, and then include their own class (where I''d like to
override the file "/etc/shadow" and some other things).
What''s the
best way to do this?

There are only 5 one-offs in this case, so maybe I should just use a
selector for "source" to check $hostname within the solserver class?
If so, can I use multiple hostnames as a selector, like this:
remotefile  { "/etc/shadow":
    source = $hostname ? {
         myhost1, myhost2, myhost3 => "path/a",
         default => "path/b"
    }
}

In short, is there a way to override "types" without putting them in
seperate classes? There are times where I want to override, but still
want to include a class that defines the same thing. Being able to
override things like this would dramatically reduce complexity, in
that I won''t have to include a big list of classes if I can just
include a common parent. Holy crap this doesn''t make any sense.. I
hope someone can parse what I''m *trying* to say :)

 -Charlie