Ask Your Question
0

Why doesn't inheritance modify a file?

asked 2013-09-24 14:20:04 -0600

spuder gravatar image

If you go through the puppetlabs training on inheritance, you are given zsh and instructed to create zhs::developer

Spoiler Alert

This is what you are given

#/etc/puppetlabs/puppet/module/zsh/manifests/init.pp 

class zsh {
     package { 'zsh':
        ensure => present,
        before => File[ '/etc/zshrc'],
     }
     file { '/etc/zshrc':
        ensure => file,
        owner  => 'root',
        group  => 'root',
        source => 'puppet:///modules/zsh/zshrc',
     }
}

This is what you are expected to create

#/etc/puppetlabs/puppet/modules/zsh/manifests/developer.pp

class zsh::developer inherits zsh {
    File ['/etc/zshrc'] {
          source => 'puppet:///modules/zsh/zhsrc.dev',
    }
}

#/etc/puppetlabs/puppet/modules/zsh/tests/init.pp
include zsh

#/etc ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-09-24 16:37:40 -0600

GregLarkin gravatar image

This works fine on my system, but I did notice that you have some spelling mistakes in the filenames above. Could it be that you didn't see an error emitted by Puppet when it could not change the contents of /etc/zshrc? Please check for error messages, and you should find the solution quickly.

edit flag offensive delete link more

Comments

Ah yes, you are correct. I had a misspelling in zshrc.dev. Ran the test again, and /etc/zshrc is now 80 characters.

spuder gravatar imagespuder ( 2013-09-24 16:48:35 -0600 )edit

Great - cheers!

GregLarkin gravatar imageGregLarkin ( 2013-09-24 16:59:03 -0600 )edit

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: 2013-09-24 14:20:04 -0600

Seen: 146 times

Last updated: Sep 24 '13