puppet random notification confusion

23 views
Skip to first unread message

Muhammad Yousuf Khan

unread,
Feb 10, 2014, 3:19:22 AM2/10/14
to puppet...@googlegroups.com
i am being through a exercise on docs.puppetlabs.com
and i am confuse with the notification output. as it shows last message first and first message at last.
i just need to know why the output notifications are random

here is my .pp file.

@puppet:/etc/puppetlabs/puppet# cat  text.pp

file {'/tmp/test1':
      ensure  => file,
      content => "Hi.\n",
    }
notify {"this is 1":}

   file {'/tmp/test2':
      ensure => directory,
      mode   => 0644,
    }

    file {'/tmp/test3':
      ensure => link,
      target => '/tmp/test1',
    }

    file {'/tmp/test2/insidedir':
      ensure => file,
      content => 'infor put by me',
    }

    user {'katie':
      ensure => absent,
    }

notify {"I'm notifying you.":}
notify {"this is 2":}
notify {"So am I!":}
notify {"this is 3":}

---------------------------------------
here is the output

Notice: Compiled catalog for puppet.mycompany.com in environment production in 0.55 seconds
Notice: this is 2
Notice: /Stage[main]//Notify[this is 2]/message: defined 'message' as 'this is 2'
Notice: this is 3
Notice: /Stage[main]//Notify[this is 3]/message: defined 'message' as 'this is 3'
Notice: So am I!
Notice: /Stage[main]//Notify[So am I!]/message: defined 'message' as 'So am I!'
Notice: I'm notifying you.
Notice: /Stage[main]//Notify[I'm notifying you.]/message: defined 'message' as 'I'm notifying you.'
Notice: this is 1
Notice: /Stage[main]//Notify[this is 1]/message: defined 'message' as 'this is 1'
Notice: Finished catalog run in 0.49 seconds


so the question is why the notification outputs are so random.

Thanks,

MYK

Denmat

unread,
Feb 10, 2014, 5:00:12 AM2/10/14
to puppet...@googlegroups.com
Hi,

Puppet doesn't run in any specific order unless you tell it to.

Look at http://docs.puppetlabs.com/learning/ordering.html for the learning series.

Basically you can use 'require' declarations to get order:
file {'/tmp/thing':
  require => File['/tmp/that']
  ...
}

This says, the 'thing' file needs 'that' file to be done first.

HTH
Den
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAGWVfMmp6tN_qHd1bRmrqp%2BoMi7QXARqDZf6KEWxnpGGLqUShQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jason Antman

unread,
Feb 10, 2014, 12:59:23 PM2/10/14
to puppet...@googlegroups.com
I seem to be pointing someone to this every week. You may want to refer to John Bollinger's 2014-01-03 reply to the "wondering if I want to[sic] much now" thread, which gives some excellent descriptions on 'how not to Puppet':
https://groups.google.com/d/msg/puppet-users/IGqjPpVCrKA/VcUKiV3xfPkJ

As Denmat said, "that's not how Puppet works." Puppet is not a bash script, it's a declarative language to describe the desired configuration of something. On resources that absolutely must have an order dependency, you can use explicit ordering (->) or even better, the require parameter. Aside from variable resolution, manifests aren't executed in a defined order (you should really spend some time reading through docs.puppetlabs.com, especially w/r/t catalog compilation and evaluation).

-Jason
Reply all
Reply to author
Forward
0 new messages