Hello all,
I'd like to use the vcsrepo to manage multiple git repository on our "git server", but while looking at the documentation (and code) of the vcsrepo module I noticed that it doesn't manage the initialization of a repository with the option --shared , an option that usually we set to be able to easily work as group on a repository.
I'd like to define on my manifest something like this:
vcsrepo { "/shared/myrepo":
ensure => bare,
provider => git,
shared => true,
owner => 'myuser',
group => 'sharedgroup',
}
To achieve this I've done a small change on the code (at the end of the mail), it works but I wonder if there are better way to get my goal or if you think that this could be useful to someone else and so I should send a PR.
Thanks for the feedbacks.
---
Riccardo
diff --git a/common/vcsrepo/lib/puppet/provider/vcsrepo/git.rb b/common/vcsrepo/lib/puppet/provider/vcsrepo/git.rb
index 5c878ed..bf30f57 100644
--- a/common/vcsrepo/lib/puppet/provider/vcsrepo/git.rb
+++ b/common/vcsrepo/lib/puppet/provider/vcsrepo/git.rb
@@ -181,6 +181,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
if @resource.value(:ensure) == :bare
args << '--bare'
end
+ if @resource.value(:shared)
+ args << '--shared'
+ end
at_path do
git_with_identity(*args)
end
diff --git a/common/vcsrepo/lib/puppet/type/vcsrepo.rb b/common/vcsrepo/lib/puppet/type/vcsrepo.rb
index 3dd7bc6..a0ee991 100644
--- a/common/vcsrepo/lib/puppet/type/vcsrepo.rb
+++ b/common/vcsrepo/lib/puppet/type/vcsrepo.rb
@@ -204,6 +204,10 @@ Puppet::Type.newtype(:vcsrepo) do
desc "The value to be used to do a shallow clone."
end
+ newparam :shared do
+ desc "Define if the repository is shared (git) "
+ end
+
autorequire(:package) do
['git', 'git-core']
end