X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fadmin.py;h=1dc7e7bc3a449512245db15a684287800df8e4f3;hb=3f76f67b9d9bf590e2b3d0aac5d015b8d52a6149;hp=808fb88785edb626b99d46881da114a58f276ee5;hpb=6842b400e155d35f88a3d1208d8b22b37cc27036;p=dak.git diff --git a/dak/admin.py b/dak/admin.py index 808fb887..1dc7e7bc 100755 --- a/dak/admin.py +++ b/dak/admin.py @@ -59,6 +59,12 @@ Perform administrative work on the dak database. config / c: c db show db config c db-shell show db config in a usable form for psql + c NAME show option NAME as set in configuration table + + keyring / k: + k list-all list all keyrings + k list-binary list all keyrings with a NULL source acl + k list-source list all keyrings with a non NULL source acl architecture / a: a list show a list of architectures @@ -456,13 +462,47 @@ def show_config(command): e.append('PGPORT') print "export " + " ".join(e) else: - die("E: config command unknown") + session = DBConn().session() + try: + o = session.query(DBConfig).filter_by(name = mode).one() + print o.value + except NoResultFound: + print "W: option '%s' not set" % mode dispatch['config'] = show_config dispatch['c'] = show_config ################################################################################ +def show_keyring(command): + args = [str(x) for x in command] + cnf = utils.get_conf() + + die_arglen(args, 2, "E: keyring needs at least a command") + + mode = args[1].lower() + + d = DBConn() + + q = d.session().query(Keyring).filter(Keyring.active == True) + + if mode == 'list-all': + pass + elif mode == 'list-binary': + q = q.filter(Keyring.default_source_acl_id == None) + elif mode == 'list-source': + q = q.filter(Keyring.default_source_acl_id != None) + else: + die("E: keyring command unknown") + + for k in q.all(): + print k.keyring_name + +dispatch['keyring'] = show_keyring +dispatch['k'] = show_keyring + +################################################################################ + def main(): """Perform administrative work on the dak database""" global dryrun