From: Evan Broder Date: Thu, 26 Nov 2009 04:43:21 +0000 (-0500) Subject: Until we switch to storing krb5 principals in the database, we need to X-Git-Tag: 0.1.5~66 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-dev.git/commitdiff_plain/f8aea528d7813a1e6ea648510483ca6d371f75ba?ds=sidebyside Until we switch to storing krb5 principals in the database, we need to convert the AFS-style principals in the database to krb5 principals. Hopefully this code can be torn out one of these days in the not-so-distant future. svn path=/trunk/packages/invirt-dev/; revision=2566 --- diff --git a/invirt-build-conf b/invirt-build-conf index f74b05d..4c5039f 100755 --- a/invirt-build-conf +++ b/invirt-build-conf @@ -14,6 +14,17 @@ from invirt.authz import mech as authz 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 @@ -25,7 +36,7 @@ def main(): acl = authz.expandAdmin(getattr(config.git.pockets, pocket).acl, None) acl_fd = tempfile.NamedTemporaryFile(delete=False) - print >>acl_fd, '\n'.join(acl) + print >>acl_fd, '\n'.join(user(a) for a in acl) acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket)