hi, I have a manifest with :- class fs::virtual { define addNFSentry($volume) { @mount { "$name": require => File["$name"], atboot => true, device => "$volume", ensure => "mounted", fstype => "nfs" } @file { "$name": ensure => "directory" } } addNFSentry {"/dir": volume => "nfshost:/path/to" } } in another ... class fs::host inherits fs::virtual { Mount["/dir"] { options => "ro" } realise (Mount["/dir"], File["/dir"]) } This fails with Only subclasses can override parameters at I want to use definitions to remove the repetitive typing and more importantly reading of 100s of f/s but override the option for readonly or rw --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
sam wrote:> This fails with Only subclasses can override parameters at > I want to use definitions to remove the repetitive typing and more > importantly reading of 100s of f/s > but override the option for readonly or rw >why are you not simply using a define to create a mount point using certain flags? define nfsmount($dir, $blah1, $blah2, $opts = "rw") { mount { $dir: ...stuff here, options => $opts } } then: class whatever { mount { "/dir": opts => "ro", } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 15, 2:33 pm, scott <sc...@lackluster.net> wrote:> sam wrote: > > This fails with Only subclasses can override parameters at > > I want to use definitions to remove the repetitive typing and more > > importantly reading of 100s of f/s > > but override the option for readonly or rw > > why are you not simply using a define to create a mount point using > certain flags? > > define nfsmount($dir, $blah1, $blah2, $opts = "rw") { > mount { $dir: > ...stuff here, > options => $opts > } > > } > > then: > > class whatever { > mount { "/dir": > opts => "ro", > } > > } > >There are plenty of filesystems, some are mounted readonly to some hosts and others are rw, thought rather than redefine the mount each time, I''d use the abstract way. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Jeroen van Meeuwen (GMail)
2008-Aug-15 06:50 UTC
[Puppet Users] Re: overriding definitions parameters
sam wrote:> hi, > I have a manifest with :- > class fs::virtual { > define addNFSentry($volume) { > @mount { "$name": > require => File["$name"], > atboot => true, > device => "$volume", > ensure => "mounted", > fstype => "nfs" > } > @file { "$name": > ensure => "directory" > } > } > > addNFSentry {"/dir": > volume => "nfshost:/path/to" > } > } > > in another ... > class fs::host inherits fs::virtual { > Mount["/dir"] { options => "ro" } > realise (Mount["/dir"], File["/dir"]) > } > > This fails with Only subclasses can override parameters at > I want to use definitions to remove the repetitive typing and more > importantly reading of 100s of f/s > but override the option for readonly or rw >How about: class fs { class virtual { (...snip...) } class host inherits virtual { (...snip...) } } would that work? Kind regards, Jeroen van Meeuwen -kanarip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 15, 4:50 pm, "Jeroen van Meeuwen (GMail)" <kana...@gmail.com> wrote:> sam wrote: > > hi, > > I have a manifest with :- > > class fs::virtual { > > define addNFSentry($volume) { > > @mount { "$name": > > require => File["$name"], > > atboot => true, > > device => "$volume", > > ensure => "mounted", > > fstype => "nfs" > > } > > @file { "$name": > > ensure => "directory" > > } > > } > > > addNFSentry {"/dir": > > volume => "nfshost:/path/to" > > } > > } > > > in another ... > > class fs::host inherits fs::virtual { > > Mount["/dir"] { options => "ro" } > > realise (Mount["/dir"], File["/dir"]) > > } > > > This fails with Only subclasses can override parameters at > > I want to use definitions to remove the repetitive typing and more > > importantly reading of 100s of f/s > > but override the option for readonly or rw > > How about: > > class fs { > class virtual { > (...snip...) > } > class host inherits virtual { > (...snip...) > } > > } > > would that work? > > Kind regards, > > Jeroen van Meeuwen > -kanaripyeah, that would work, which is what I''ve been using. I''m curious as to why the error msg "Only subclasses can override parameters" the overiding is in a subclass --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---