]> git.decadent.org.uk Git - dak.git/commitdiff
Don't use Dinstall::BugServer unless it's configured
authorMark Hymers <mhy@debian.org>
Tue, 26 Jul 2011 13:42:41 +0000 (14:42 +0100)
committerMark Hymers <mhy@debian.org>
Tue, 26 Jul 2011 13:42:41 +0000 (14:42 +0100)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/override.py
dak/rm.py

index 410a3d3dee2ff6be4d81330664b7f4afce2bd460..e6d47db22b01b3c34f162356e5730fbc5ae40bf3 100755 (executable)
@@ -286,6 +286,11 @@ def main ():
     session.commit()
 
     if Options.has_key("Done"):
+        if not cnf.has_key("Dinstall::BugServer"):
+            utils.warn("Asked to send Done message but Dinstall::BugServer is not configured")
+            Logger.close()
+            return
+
         Subst = {}
         Subst["__OVERRIDE_ADDRESS__"] = cnf["Dinstall::MyEmailAddress"]
         Subst["__BUG_SERVER__"] = cnf["Dinstall::BugServer"]
index 2e023b7e0e0043c8c9bc342ad3c70806cb7c7f10..e8d2590046eb16838764d6c3531b72302c4d0866 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -335,7 +335,10 @@ def main ():
     carbon_copy = []
     for copy_to in utils.split_args(Options.get("Carbon-Copy")):
         if copy_to.isdigit():
-            carbon_copy.append(copy_to + "@" + cnf["Dinstall::BugServer"])
+            if cnf.has_key("Dinstall::BugServer"):
+                carbon_copy.append(copy_to + "@" + cnf["Dinstall::BugServer"])
+            else:
+                utils.fubar("Asked to send mail to #%s in BTS but Dinstall::BugServer is not configured" % copy_to)
         elif copy_to == 'package':
             for package in arguments:
                 if cnf.has_key("Dinstall::PackagesServer"):
@@ -586,6 +589,19 @@ def main ():
     session.commit()
     print "done."
 
+    # If we don't have a Bug server configured, we're done
+    if not cnf.has_key("Dinstall::BugServer"):
+        if Options["Done"] or Options["Do-Close"]:
+            print "Cannot send mail to BugServer as Dinstall::BugServer is not configured"
+
+        logfile.write("=========================================================================\n")
+        logfile.close()
+
+        logfile822.write("\n")
+        logfile822.close()
+
+        return
+
     # read common subst variables for all bug closure mails
     Subst_common = {}
     Subst_common["__RM_ADDRESS__"] = cnf["Dinstall::MyEmailAddress"]