diff options
author | Peter Souter <p.morsou@gmail.com> | 2014-06-02 23:03:19 +0100 |
---|---|---|
committer | Peter Souter <p.morsou@gmail.com> | 2014-06-02 23:03:19 +0100 |
commit | 17c91e7ab8f89453c926b432e5ff82335d280e90 (patch) | |
tree | 1cb1dd444e16adf4f7c4a2f5a80c78a64773578a /lib | |
parent | 8f71d47786e7d7465d5597705c6dab4331371ad6 (diff) |
(MODULES-1014) Adding noop mode option
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/vcsrepo.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb index 3dd7bc6..0e4450b 100644 --- a/lib/puppet/type/vcsrepo.rb +++ b/lib/puppet/type/vcsrepo.rb @@ -98,10 +98,15 @@ Puppet::Type.newtype(:vcsrepo) do if prov if prov.working_copy_exists? if @resource.value(:force) - notice "Deleting current repository before recloning" - prov.destroy - notice "Create repository from latest" - prov.create + if noop? + notice "Noop Mode - Would have deleted repository" + notice "Noop Mode - Would have created repository from latest" + else + notice "Deleting current repository before recloning" + prov.destroy + notice "Create repository from latest" + prov.create + end end (@should.include?(:latest) && prov.latest?) ? :latest : :present elsif prov.class.feature?(:bare_repositories) and prov.bare_exists? @@ -208,4 +213,12 @@ Puppet::Type.newtype(:vcsrepo) do ['git', 'git-core'] end + def noop? + if defined?(@noop) + @noop + else + Puppet[:noop] + end + end + end |