puppetlabs/puppetlabs-corosync — pull request #47 by kbon (2013-07-05 08:55:14+00:00)
Title: Reworked cs_shadow (fixes #15)

Removed need for cs_commit. Shadow CIB is automatically generated from the live cluster when Pacemaker configuration changes are needed. The actual commit to the cluster occurs by notifying the cs_shadow resource on the CIB-able cs_* Puppet resources.

Simple example on how to use this:
$mycib = 'cibshadow'
cs_shadow {
$mycib: ;
}
Cs_colocation {
cib => $mycib,
notify => Cs_shadow[$mycib]
}
Cs_group {
cib => $mycib,
notify => Cs_shadow[$mycib]
}
Cs_order {
cib => $mycib,
notify => Cs_shadow[$mycib]
}
Cs_primitive {
cib => $mycib,
notify => Cs_shadow[$mycib]
}

And for the rest you declare your cs_* resources as you would normally. Now, when you do a Puppet run, the cs_* providers will call the shared function setupShadow in their flush, causing the shadow CIB to be created/updated from the live CIB config. Then, the notify triggers the cs_shadow to actually commit the shadow to the live cluster. Because both the creation/update of the shadow CIB and the commit only happen when any of the cs_* resources have to be updated, this effectively fixes issue #15.