projects
/
invirt/packages/invirt-dev.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add remctl-server as a dependency for invirt-dev, for the build
[invirt/packages/invirt-dev.git]
/
invirt-build-conf
diff --git
a/invirt-build-conf
b/invirt-build-conf
index
f74b05d
..
b5a8d3d
100755
(executable)
--- a/
invirt-build-conf
+++ b/
invirt-build-conf
@@
-14,25
+14,38
@@
from invirt.authz import mech as authz
from invirt.config import structs as config
from invirt.config import structs as config
+def userToPrinc(user):
+ """Convert an AFS principal to a Kerberos v5 principal."""
+ if '@' in user:
+ (princ, realm) = user.split('@')
+ else:
+ princ = user
+ realm = config.kerberos.realm
+
+ return princ.replace('.', '/') + '@' + realm
+
+
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.
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)
+ conf_fd, conf_name = tempfile.mkstemp()
+ conf = os.fdopen(conf_fd, 'r+')
build_handler = '/usr/sbin/invirt-submit-build'
for pocket in config.git.pockets:
acl = authz.expandAdmin(getattr(config.git.pockets, pocket).acl, None)
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_fd, acl_name = tempfile.mkstemp()
+ acl_fd = os.fdopen(acl_fd, 'r+')
+ print >>acl_fd, '\n'.join(userToPrinc(a) for a in acl)
acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket)
acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket)
- os.rename(acl_fd.name, acl_path)
+ os.rename(acl_name, acl_path)
print >>conf, 'build %s %s %s' % (pocket, build_handler, acl_path)
print >>conf, 'build %s %s %s' % (pocket, build_handler, acl_path)
- os.rename(conf, '/etc/remctl/conf.d/build')
+ os.rename(conf_name, '/etc/remctl/conf.d/build')
if __name__ == '__main__':
if __name__ == '__main__':