Ask Your Question
1

Overriding class attributes via inheritance?

asked 2014-01-03 16:47:21 -0600

Matt Willsher gravatar image

I have the the following code:

class foo::bar {

  class { 'qux':
    a => 1
    b => [ 'somevalue' ]
  }

  file { '/etc/afile':
    require => Service['qux-somevalue']
  }
}

class foo::baz inherits foo::bar {

  Class ['qux'] {
    b => [ 'somevalue', 'anothervalue' ]
  }

  file { '/etc/bfile':
    require => Service['qux-anothervalue']
  }
}

node mynode {
  include foo::baz
}

What I was expecting is that qux would be declared as:

class { 'qux':
  a => 1
  b => [ 'somevalue', 'anothervalue' ]
}

but what I seem to be getting is the class define in foo::bar and the service I was expect isn't defined. If I set b => [ 'somevalue', 'anothervalue' ] in foo::bar the file lines can find their dependencies ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-03 17:08:30 -0600

Matt Willsher gravatar image

updated 2014-01-03 17:11:08 -0600

To answer my own question, override parameterised class parameters isn't supported. There is a (very) long discussion on the topic at http://projects.puppetlabs.com/issues/5517 , with the exported ticket in JIRA at https://tickets.puppetlabs.com/browse/PUP-1367

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-03 16:47:21 -0600

Seen: 140 times

Last updated: Jan 03 '14