From c81a9160bc47b724cba617285da6fec429734a21 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Wed, 25 Nov 2009 23:43:18 -0500 Subject: [PATCH] Add a script for generating the remctl configuration to trigger the Invirtibuilder. svn path=/trunk/packages/invirt-dev/; revision=2565 --- debian/invirt-dev.init | 1 + invirt-build-conf | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 invirt-build-conf diff --git a/debian/invirt-dev.init b/debian/invirt-dev.init index 60ceebd..160aabd 100755 --- a/debian/invirt-dev.init +++ b/debian/invirt-dev.init @@ -23,6 +23,7 @@ case "$1" in log_begin_msg "Reloading config for $PACKAGE" gen_files reprepro-env export + invirt-build-conf log_end_msg $? ;; stop) diff --git a/invirt-build-conf b/invirt-build-conf new file mode 100755 index 0000000..f74b05d --- /dev/null +++ b/invirt-build-conf @@ -0,0 +1,39 @@ +#!/usr/bin/python + +"""Re-generate the remctl configuration for build submissions. + +This script generates the remctl ACL and configuration for each build +pocket defined in the configuration. +""" + + +import os +import tempfile + +from invirt.authz import mech as authz +from invirt.config import structs as config + + +def main(): + # Python could really use a file-like object that gets written to + # a temporary path and moved to its final resting place on + # .close(). Oh well. + conf = tempfile.NamedTemporaryFile(delete=False) + build_handler = '/usr/sbin/invirt-submit-build' + + for pocket in config.git.pockets: + acl = authz.expandAdmin(getattr(config.git.pockets, pocket).acl, None) + + acl_fd = tempfile.NamedTemporaryFile(delete=False) + print >>acl_fd, '\n'.join(acl) + + acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket) + + os.rename(acl_fd.name, acl_path) + print >>conf, 'build %s %s %s' % (pocket, build_handler, acl_path) + + os.rename(conf, '/etc/remctl/conf.d/build') + + +if __name__ == '__main__': + main() -- 1.7.9.5