aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mars-attacks.org>2013-09-22 01:01:25 +0200
committerNicolas Vigier <boklm@mars-attacks.org>2013-09-22 01:01:25 +0200
commitf1b90f46724539d5384bcd8c2be92aafc650bc85 (patch)
tree4a8fee29fd526b6166184b7a2e560f697ac53a5a
parent6d0a8bd712b664769b18a5deae743f97bafc141f (diff)
downloadmgagit-f1b90f46724539d5384bcd8c2be92aafc650bc85.tar
mgagit-f1b90f46724539d5384bcd8c2be92aafc650bc85.tar.gz
mgagit-f1b90f46724539d5384bcd8c2be92aafc650bc85.tar.bz2
mgagit-f1b90f46724539d5384bcd8c2be92aafc650bc85.tar.xz
mgagit-f1b90f46724539d5384bcd8c2be92aafc650bc85.zip
Allow non-ldap group definitions
-rw-r--r--NEWS1
-rw-r--r--README17
-rw-r--r--lib/MGA/Git.pm13
3 files changed, 25 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 58bcbe6..2d0d3ec 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
- soft_repo.gl: Put maintainer nick in square brackets
+- allow non-ldap group definitions
Version 0.10
diff --git a/README b/README
index ed9060c..13c0368 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ How it works
mgagit takes :
- an ldap directory containing groups, and users with ssh keys
- - repositories definitions
+ - repositories and non-ldap groups definitions
And generate the corresponding gitolite configuration and keys directory.
@@ -77,12 +77,21 @@ The following configuration options are available :
directory containing repos definitions (see repos_config)
repos_config:
- list of repos definition directories. Use something like
- this to include a directory containing repos definitions :
+ list of repos and / or group definition directories. Use
+ something like this to include a directory containing repos or
+ groups definitions :
prefix:
- prefix in the repos tree
+ prefix in the repos tree. In case of git_url or include_dir,
+ this is also used to indicate that the included directory
+ defines repos (*.repo files).
+ group_prefix:
+ This value is prefixed to the defined group names. This is also
+ used to indicate that the included directory can contain groups
+ definitions (*.group files). If you don't want to have a prefix,
+ but still want to define groups, set an empty string.
+
git_url:
url of a git repository containing definitions, that will be
cloned and pulled, in 'repodef_dir'
diff --git a/lib/MGA/Git.pm b/lib/MGA/Git.pm
index c46dc4e..f87e9af 100644
--- a/lib/MGA/Git.pm
+++ b/lib/MGA/Git.pm
@@ -35,15 +35,24 @@ sub load_gitrepos_dir {
if (-d "$infos->{include_dir}/$file") {
next if $file =~ m/^\./;
my %i = %$infos;
- $i{prefix} .= '/' . $file;
+ $i{prefix} .= '/' . $file if $i{prefix};
$i{include_dir} .= '/' . $file;
load_gitrepos_dir($r, \%i);
- } elsif ($file =~ m/(.+)\.repo$/) {
+ } elsif ($file =~ m/(.+)\.repo$/ && $infos->{prefix}) {
my $bname = $1;
my $name = "$infos->{prefix}/$bname";
$r->{repos}{$name} = LoadFile("$infos->{include_dir}/$file");
$r->{repos}{$name}{name} = $bname;
@{$r->{repos}{$name}}{keys %$infos} = values %$infos;
+ } elsif ($file =~ m/(.+)\.group$/ && exists $infos->{group_prefix}) {
+ my $bname = $1;
+ my $name = $infos->{group_prefix} . $bname;
+ if (exists $r->{groups}{$name}) {
+ print STDERR "Warning: Redifinition of $name group.\n";
+ next;
+ }
+ $r->{groups}{$name} = [ read_file("$infos->{include_dir}/$file") ];
+ chomp @{$r->{groups}{$name}};
}
}
closedir $dh;