diff options
author | dduvnjak <dario.duvnjak@gmail.com> | 2015-01-18 10:49:03 +0100 |
---|---|---|
committer | dduvnjak <dario.duvnjak@gmail.com> | 2015-01-18 10:49:03 +0100 |
commit | dfe5f9cc316a43793da2cb1c4adbc66503907460 (patch) | |
tree | 565917e2313fce74b643ea8f1b4f69977de14f6b /lib | |
parent | 4a9c69cb9d1242cdb53d1e758c07bdf79a8556cb (diff) | |
download | puppet-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.rb | 4 | ||||
-rw-r--r-- | lib/puppet/type/vcsrepo.rb | 9 |
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 |