2

Im learning puppet, and Im trying to update bash (no prizes for guessing why).

This is in my site.pp

       file { "/etc/apt/sources.list.d/shellshock.list":
            source  => "puppet:///files/shellshock.list",
            owner   => "root",
            group   => "root",
            mode    => "0644", 
            ensure  => present,
    } 
    ->
exec { "instantRepoUpdate":
        command          => "/usr/bin/aptitude update",
        refreshonly  => true,
}
    ->
    package {"bash": ensure => latest, }

From what Im reading here https://docs.puppetlabs.com/puppet/latest/reference/lang_relationships.html That should translate to:

Install /etc/apt/sources.list.d/shellshock.list, then run aptitude update, then make sure bash is on the latest version

It does, but only over two runs of the agent. I want it to perform all three actions, in order, in one run.

UPDATE: I've tried adding "require => Exec[.., require => File[..." to the exec and package resources, I get the same result.

2
  • I think the first arrow needs to be a notification arrow (~>) since you've set refreshonly => true
    – faker
    Oct 1, 2014 at 11:13
  • @faker. Spot on! Thank you Sir! Add it as an answer and make sure it gets accepted.
    – GeoSword
    Oct 1, 2014 at 11:18

1 Answer 1

3

You set refreshonly => true and as such you need to use a notification arrow instead (~>).

4
  • Violently disagree with the final assertion. ensure => latest will take effect, notification received or no. It may be a noop if aptitude is not aware of the new version in time, but that is another matter. Oct 2, 2014 at 19:57
  • Hm are you sure? Even if there is a chaining arrow from the exec?
    – faker
    Oct 2, 2014 at 20:16
  • Yes, the package will be skipped if the file or exec fails, but an event from either of them is of no consequence. Oct 3, 2014 at 13:06
  • @FelixFrank You are right, thanks for pointing it out! Removed from the answer.
    – faker
    Oct 3, 2014 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.