Fix bug in ensure => absent
authorNate Butler <nathan.butler@gmail.com>
Thu, 1 Sep 2016 19:47:27 +0000 (15:47 -0400)
committerNate Butler <nathan.butler@gmail.com>
Thu, 1 Sep 2016 19:54:31 +0000 (15:54 -0400)
commit5e46486d3ea2d15984edfb28875471436f466a65
treefd321e2b314f0c52849b220e64cffb7a55a0af5d
parent54e3af8b1bb4aa141264bb5cd8b0ffb447361f16
Fix bug in ensure => absent

The insync? method wasn't accounting for a condition where the state was
absent and the desired state was absent. This manifest itself in puppet
runs that would constantly output the following after setting
ensure => absent.

2016-09-01T16:39:27.314283+00:00 vcstest puppet-agent[1161]: (/Stage[main]/Main/Node[vcstest]/Vcsrepo[/home/vagrant/test]/ensure) created
2016-09-01T16:40:22.583125+00:00 vcstest puppet-agent[1727]: (/Stage[main]/Main/Node[vcstest]/Vcsrepo[/home/vagrant/test]/ensure) created
2016-09-01T16:41:04.031750+00:00 vcstest puppet-agent[2267]: (/Stage[main]/Main/Node[vcstest]/Vcsrepo[/home/vagrant/test]/ensure) created
2016-09-01T16:42:51.779816+00:00 vcstest puppet-agent[2911]: (/Stage[main]/Main/Node[vcstest]/Vcsrepo[/home/vagrant/test]/ensure) created
2016-09-01T16:43:42.189035+00:00 vcstest puppet-agent[3466]: (/Stage[main]/Main/Node[vcstest]/Vcsrepo[/home/vagrant/test]/ensure) created

I added unit tests for the vcsrepo type and then fixed the code.
lib/puppet/type/vcsrepo.rb
spec/unit/puppet/type/vcsrepo_spec.rb [new file with mode: 0755]