A lesson I learnt today is: use promisees in cfengine promises, and you won’t regret it. In fact, I had a proof today that specifying a promisee is a very useful thing.
Let’s take a step back: a promisee is introduced by a -> sign, and according to the documentation the promisee is the abstract object to whom the promise is made. When CFEngine made its way in our trouble ticket, I started including a ticket number as a promisee every time a promise was created to address a reported issue.
Today I found out that, every time I deployed a change that caused firewall rules to be reloaded, ntpd was also restarted. I couldn’t understand why, so I checked the policies and found this:
"/etc/init.d/ntp" -> "CLO-2313" args => "restart", ifvarclass => "ntp", comment => "Restart ntpd when the firewall is restarted" ;
CLO-2313 was a resolved ticket, and there I found out why I made such a decision more than one month ago, and why it was a good thing.
So… use promisees!
You might also find meta attributes useful 🙂 https://cfengine.com/manuals/cf3-Reference#meta-in-_002a
Yeah, too bad I didn’t have time to look at newer features in 3.4 so far (meta and defaults among all). I must do that, and do it soon!
Thanks for sharing.