diff options
author | Aaron Stone <aaron@serendipity.cx> | 2015-01-18 21:43:27 -0800 |
---|---|---|
committer | Aaron Stone <aaron@serendipity.cx> | 2015-01-18 21:43:27 -0800 |
commit | d08d16bd71e10f439dfa3ff92626aeb38aa95303 (patch) | |
tree | 1ac586b7e4561c85590266c7e6ff052dc2e2a6b2 | |
parent | de7bf159c721a1461b7d8a61e98fd024344c7eb5 (diff) | |
parent | dfe5f9cc316a43793da2cb1c4adbc66503907460 (diff) | |
download | puppet-vcsrepo-d08d16bd71e10f439dfa3ff92626aeb38aa95303.tar.gz puppet-vcsrepo-d08d16bd71e10f439dfa3ff92626aeb38aa95303.tar.bz2 |
Merge pull request #218 from dduvnjak/master
Add submodules feature to git provider
-rw-r--r-- | README.markdown | 14 | ||||
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 4 | ||||
-rw-r--r-- | lib/puppet/type/vcsrepo.rb | 9 |
3 files changed, 23 insertions, 4 deletions
diff --git a/README.markdown b/README.markdown index cefa50b..6c6f0a5 100644 --- a/README.markdown +++ b/README.markdown @@ -145,6 +145,15 @@ To keep the repository at the latest revision (**WARNING:** this will always ove revision => 'master', } +To clone the repository but skip initialiazing submodules, + + vcsrepo { "/path/to/repo": + ensure => latest, + provider => git, + source => 'git://example.com/repo.git', + submodules => false, + } + #####Sources that use SSH When your source uses SSH, such as 'username@server:…', you can manage your SSH keys with Puppet using the [require](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter in `vcsrepo` to ensure they are present. @@ -483,6 +492,7 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers * `ssh_identity` - The provider supports a configurable SSH identity file. (Available with `git` and `hg`.) * `user` - The provider can run as a different user. (Available with `git`, `hg` and `cvs`.) * `p4config` - The provider support setting the P4CONFIG environment. (Available with `p4`.) +* `submodules` - The provider supports repository submodules which can be optionally initialized. (Available with `git`.) ####Parameters @@ -511,9 +521,9 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers ####Features and Parameters by Provider #####`git` -**Features**: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user` +**Features**: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `user`, `submodules` -**Parameters**: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user` +**Parameters**: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user`, `submodules` #####`bzr` **Features**: `reference_tracking` diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index b1e556d..13e0793 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 b8836d4..3bf4029 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 @@ -205,6 +208,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 |