summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordduvnjak <dario.duvnjak@gmail.com>2015-01-18 10:49:03 +0100
committerdduvnjak <dario.duvnjak@gmail.com>2015-01-18 10:49:03 +0100
commitdfe5f9cc316a43793da2cb1c4adbc66503907460 (patch)
tree565917e2313fce74b643ea8f1b4f69977de14f6b /lib
parent4a9c69cb9d1242cdb53d1e758c07bdf79a8556cb (diff)
downloadpuppet-vcsrepo-dfe5f9cc316a43793da2cb1c4adbc66503907460.tar.gz
puppet-vcsrepo-dfe5f9cc316a43793da2cb1c4adbc66503907460.tar.bz2
Add submodules feature to git provider
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb4
-rw-r--r--lib/puppet/type/vcsrepo.rb9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 1c6588c..9e1903c 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -5,7 +5,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
commands :git => 'git'
- has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth
+ has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth, :submodules
def create
if @resource.value(:revision) and @resource.value(:ensure) == :bare
@@ -18,7 +18,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
if @resource.value(:revision)
checkout
end
- if @resource.value(:ensure) != :bare
+ if @resource.value(:ensure) != :bare && @resource.value(:submodules) == :true
update_submodules
end
end
diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb
index f678389..3f34c57 100644
--- a/lib/puppet/type/vcsrepo.rb
+++ b/lib/puppet/type/vcsrepo.rb
@@ -43,6 +43,9 @@ Puppet::Type.newtype(:vcsrepo) do
feature :p4config,
"The provider understands Perforce Configuration"
+ feature :submodules,
+ "The repository contains submodules which can be optionally initialized"
+
ensurable do
attr_accessor :latest
@@ -215,6 +218,12 @@ Puppet::Type.newtype(:vcsrepo) do
desc "The Perforce P4CONFIG environment."
end
+ newparam :submodules, :required_features => [:submodules] do
+ desc "Initialize and update each submodule in the repository."
+ newvalues(:true, :false)
+ defaultto true
+ end
+
autorequire(:package) do
['git', 'git-core']
end