]> git.decadent.org.uk Git - dak.git/blobdiff - dak/control_suite.py
Move sanity check to use database
[dak.git] / dak / control_suite.py
index 6dd79b8fd258f113b3bcb90a9cea53984001f0f5..3ba5acdced15ae8f5bc731f00ce754d86238d15e 100755 (executable)
@@ -396,7 +396,7 @@ def main ():
 
     try:
         file_list = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv);
-    except SystemError, e:
+    except SystemError as e:
         print "%s\n" % e
         usage(1)
     Options = cnf.SubTree("Control-Suite::Options")
@@ -421,15 +421,17 @@ def main ():
                     utils.fubar("Can only perform one action at a time.")
                 action = i
 
+                # Safety/Sanity check
+                if action == "set" and (not suite.allowcsset):
+                    if force:
+                        utils.warn("Would not normally allow setting suite %s (allowsetcs is FALSE), but --force used" % (suite_name))
+                    else:
+                        utils.fubar("Will not reset suite %s due to its database configuration (allowsetcs is FALSE)" % (suite_name))
+
     # Need an action...
     if action == None:
         utils.fubar("No action specified.")
 
-    # Safety/Sanity check
-    # XXX: This should be stored in the database
-    if action == "set" and suite_name not in ["testing", "squeeze-updates"]:
-        utils.fubar("Will not reset suite %s" % (suite_name))
-
     britney = False
     if action == "set" and cnf["Control-Suite::Options::Britney"]:
         britney = True