Provide ganeti user and group data in easy-to-parse form
authorKlaus Aehlig <aehlig@google.com>
Tue, 10 Sep 2013 16:00:23 +0000 (18:00 +0200)
committerKlaus Aehlig <aehlig@google.com>
Wed, 11 Sep 2013 16:11:39 +0000 (18:11 +0200)
Upon build time, also generate, in the directory doc/users, files
containing the groups, the users with their primary group, and the
additional groupmemberships to be added. In this way, packages can use
their own way of adding users to the system, instead of telling the
adiministrator to run tools/users-setup.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

.gitignore
Makefile.am
doc/users/groupmemberships.in [new file with mode: 0644]
doc/users/groups.in [new file with mode: 0644]
doc/users/users.in [new file with mode: 0644]

index be68d6f..eb953d3 100644 (file)
@@ -62,6 +62,9 @@
 /doc/hs-lint.html
 /doc/manpages-enabled.rst
 /doc/man-*.rst
+/doc/users/groupmemberships
+/doc/users/groups
+/doc/users/users
 
 # doc/examples
 /doc/examples/bash_completion
index 7aef305..902f06b 100644 (file)
@@ -100,6 +100,7 @@ DIRS = \
        doc/examples \
        doc/examples/gnt-debug \
        doc/examples/hooks \
+       doc/users \
        test/data/htools \
        test/data/htools/rapi \
        test/hs/shelltests \
@@ -189,6 +190,7 @@ CLEANFILES = \
        $(BUILT_EXAMPLES) \
        doc/examples/bash_completion \
        doc/examples/bash_completion-debug \
+       $(userspecs) \
        lib/_generated_rpc.py \
        $(man_MANS) \
        $(manhtml) \
@@ -743,12 +745,21 @@ else
        exit 1;
 endif
 
+doc/users/%: doc/users/%.in Makefile $(REPLACE_VARS_SED)
+       cat $< | sed -f $(REPLACE_VARS_SED) | LC_ALL=C sort | uniq | (grep -v '^root' || true) > $@
+
+userspecs = \
+       doc/users/users \
+       doc/users/groups \
+       doc/users/groupmemberships
+
 # Things to build but not to install (add it to EXTRA_DIST if it should be
 # distributed)
 noinst_DATA = \
        $(BUILT_EXAMPLES) \
        doc/examples/bash_completion \
        doc/examples/bash_completion-debug \
+       $(userspecs) \
        $(manhtml)
 
 if HAS_SPHINX
@@ -971,6 +982,9 @@ EXTRA_DIST = \
        doc/examples/gnt-debug/README \
        doc/examples/gnt-debug/delay0.json \
        doc/examples/gnt-debug/delay50.json \
+       doc/users/groupmemberships.in \
+       doc/users/groups.in \
+       doc/users/users.in \
        test/py/lockperf.py \
        test/py/testutils.py \
        test/py/mocks.py \
diff --git a/doc/users/groupmemberships.in b/doc/users/groupmemberships.in
new file mode 100644 (file)
index 0000000..07be505
--- /dev/null
@@ -0,0 +1,11 @@
+@GNTMASTERUSER@ @GNTDAEMONSGROUP@
+@GNTCONFDUSER@ @GNTDAEMONSGROUP@
+@GNTLUXIDUSER@ @GNTDAEMONSGROUP@
+@GNTRAPIUSER@ @GNTDAEMONSGROUP@
+@GNTMONDUSER@ @GNTDAEMONSGROUP@
+@GNTMASTERUSER@ @GNTADMINGROUP@
+@GNTRAPIUSER@ @GNTADMINGROUP@
+@GNTMASTERUSER@ @GNTCONFDGROUP@
+@GNTMONDUSER@ @GNTMASTERDGROUP@
+@GNTLUXIDUSER@ @GNTMASTERDGROUP@
+@GNTLUXIDUSER@ @GNTCONFDGROUP@
diff --git a/doc/users/groups.in b/doc/users/groups.in
new file mode 100644 (file)
index 0000000..09306b5
--- /dev/null
@@ -0,0 +1,7 @@
+@GNTDAEMONSGROUP@
+@GNTADMINGROUP@
+@GNTMASTERUSER@
+@GNTRAPIUSER@
+@GNTCONFDUSER@
+@GNTLUXIDUSER@
+@GNTMONDUSER@
diff --git a/doc/users/users.in b/doc/users/users.in
new file mode 100644 (file)
index 0000000..83b6d32
--- /dev/null
@@ -0,0 +1,6 @@
+@GNTMASTERUSER@ @GNTMASTERDGROUP@
+@GNTRAPIUSER@ @GNTRAPIGROUP@
+@GNTCONFDUSER@ @GNTCONFDGROUP@
+@GNTLUXIDUSER@ @GNTLUXIDGROUP@
+@GNTMONDUSER@ @GNTMONDGROUP@
+@GNTNODEDUSER@