source: trunk/packages/invirt-dev/invirt-build-conf @ 2565

Last change on this file since 2565 was 2565, checked in by broder, 14 years ago

Add a script for generating the remctl configuration to trigger the
Invirtibuilder.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/python
2
3"""Re-generate the remctl configuration for build submissions.
4
5This script generates the remctl ACL and configuration for each build
6pocket defined in the configuration.
7"""
8
9
10import os
11import tempfile
12
13from invirt.authz import mech as authz
14from invirt.config import structs as config
15
16
17def main():
18    # Python could really use a file-like object that gets written to
19    # a temporary path and moved to its final resting place on
20    # .close(). Oh well.
21    conf = tempfile.NamedTemporaryFile(delete=False)
22    build_handler = '/usr/sbin/invirt-submit-build'
23
24    for pocket in config.git.pockets:
25        acl = authz.expandAdmin(getattr(config.git.pockets, pocket).acl, None)
26
27        acl_fd = tempfile.NamedTemporaryFile(delete=False)
28        print >>acl_fd, '\n'.join(acl)
29
30        acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket)
31
32        os.rename(acl_fd.name, acl_path)
33        print >>conf, 'build %s %s %s' % (pocket, build_handler, acl_path)
34
35    os.rename(conf, '/etc/remctl/conf.d/build')
36
37
38if __name__ == '__main__':
39    main()
Note: See TracBrowser for help on using the repository browser.