From: Joerg Jaspert Date: Thu, 17 Apr 2008 21:23:08 +0000 (+0200) Subject: Check if temppath exists X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8f6c03c237c57f401cd2810d9ad5e6d578f454e;p=dak Check if temppath exists --- diff --git a/ChangeLog b/ChangeLog index b0239f51..f09a1b02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * dak/transitions.py (temp_transitions_file): Use the TempPath (write_transitions_from_file): Check if the file we should get our transitions from is in our TempPath, error out if it isnt + (main): Check for TempPath existance 2008-04-12 James Troup diff --git a/dak/transitions.py b/dak/transitions.py index 43c2ae6e..530ef0c8 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -232,7 +232,7 @@ def temp_transitions_file(transitions): # We need the chmod, as the file is (most possibly) copied from a # sudo-ed script and would be unreadable if it has default mkstemp mode - (fd, path) = tempfile.mkstemp("","transitions",Cnf["Transitions::TempPath"]) + (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Transitions::TempPath"]) os.chmod(path, 0644) f = open(path, "w") syck.dump(transitions, f) @@ -419,6 +419,15 @@ def main(): daklib.utils.warn("ReleaseTransitions file, %s, not found." % (Cnf["Dinstall::Reject::ReleaseTransitions"])) sys.exit(1) + # Also check if our temp directory is defined and existant + temppath = Cnf.get("Transitions::TempPath", "") + if temppath == "": + daklib.utils.warn("Transitions::TempPath not defined") + sys.exit(1) + if not os.path.exists(temppath): + daklib.utils.warn("Temporary path %s not found." % + (Cnf["Transitions::TempPath"])) + sys.exit(1) if Options["import"]: try: