]> git.decadent.org.uk Git - dak.git/blobdiff - dak/admin.py
%Y works so much nicer than here
[dak.git] / dak / admin.py
index c77e93f32845b464922fbeca55ffd4a1fa22934a..0de7cd69751ea92336fcb780b6b3dec00f8b37ea 100755 (executable)
@@ -103,6 +103,7 @@ Perform administrative work on the dak database.
                             primary mirror MIRROR.
      archive rm NAME        remove archive NAME (will only work if there are
                             no files and no suites in the archive)
                             primary mirror MIRROR.
      archive rm NAME        remove archive NAME (will only work if there are
                             no files and no suites in the archive)
+     archive rename OLD NEW rename archive OLD to NEW
 
   version-check / v-c:
      v-c list                        show version checks for all suites
 
   version-check / v-c:
      v-c list                        show version checks for all suites
@@ -429,10 +430,23 @@ def archive_rm(name):
     else:
         session.commit()
 
     else:
         session.commit()
 
+def archive_rename(oldname, newname):
+    session = DBConn().session()
+    archive = get_archive(oldname, session)
+    archive.archive_name = newname
+    session.flush()
+
+    if dryrun:
+        session.rollback()
+    else:
+        session.commit()
+
 def archive(command):
     mode = command[1]
     if mode == 'list':
         archive_list()
 def archive(command):
     mode = command[1]
     if mode == 'list':
         archive_list()
+    elif mode == 'rename':
+        archive_rename(command[2], command[3])
     elif mode == 'add':
         archive_add(command[2:])
     elif mode == 'rm':
     elif mode == 'add':
         archive_add(command[2:])
     elif mode == 'rm':
@@ -556,6 +570,8 @@ def show_config(command):
             print "PGPORT=%s" % cnf["DB::Port"]
             e.append('PGPORT')
         print "export " + " ".join(e)
             print "PGPORT=%s" % cnf["DB::Port"]
             e.append('PGPORT')
         print "export " + " ".join(e)
+    elif mode == 'get':
+        print cnf.get(args[2])
     else:
         session = DBConn().session()
         try:
     else:
         session = DBConn().session()
         try:
@@ -584,9 +600,9 @@ def show_keyring(command):
     if mode == 'list-all':
         pass
     elif mode == 'list-binary':
     if mode == 'list-all':
         pass
     elif mode == 'list-binary':
-        q = q.filter(Keyring.default_source_acl_id == None)
+        q = q.join(Keyring.acl).filter(ACL.allow_source == False)
     elif mode == 'list-source':
     elif mode == 'list-source':
-        q = q.filter(Keyring.default_source_acl_id != None)
+        q = q.join(Keyring.acl).filter(ACL.allow_source == True)
     else:
         die("E: keyring command unknown")
 
     else:
         die("E: keyring command unknown")