riccardo capecchi
2014-Jul-08 11:42 UTC
[Puppet Users] vcsrepo module: Add option shared for GIT repository
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
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/014ef921-66f8-458b-bb69-0c80a45e07ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.