Re: Overriding types?

David Lutterkort
Fri, 22 Dec 2006 00:54:45 -0000

On Thu, 2006-12-21 at 16:32 -0800, Charlie Schluting
wrote:
> Well I thought I had it figured out; this is driving me a bit crazy now :)
>
> Can you confirm that you cannot override things unless you actually
> inherit, as opposed to including?

That is correct.

> My real example looks something like this:
>
> node A inherits solaris {
>         include host_A
> }
> class host_A inherits solserver {
>         remotefile { "/etc/group":
>                 mode => 644, group => other,
>                 source => "solall/etc/group.A"
>         }
> }
> class solserver inherits server {
>         remotefile { "/etc/group":
>                 mode => 644, group => other,
>                 source => "solall/etc/group.server"
>         }
> }
> class server { } #Currently empty
>
> With that I get:
>  remotefile[/etc/group] is already defined in file
> /etc/puppet/manifests/server.pp

The problem is that your class host_A should read

        class host_A inherits solserver {
                Remotefile["/etc/group"] {
                        mode => 644, group => other,
                        source => "solall/etc/group.A"
                }
        }

Since (I think) puppet 0.20.0 overrides have a different syntax from new
definitions: new definitions use ''type { name: attr => value
}'' whereas
overrides use ''Type[name] { attr => value }''

> ... which is expected? I''m also trying to override something in
the
> solaris class, which is why I had my host_A class inherit solaris. But
> I can''t also inherit/override something in solserver, huh?

With the change above, thonly fly in the ointment is that I don''t think
that nodes can inherit from classes (unless that has changed recently)

David