From e8f6c03c237c57f401cd2810d9ad5e6d578f454e Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Thu, 17 Apr 2008 23:23:08 +0200 Subject: [PATCH] Check if temppath exists --- ChangeLog | 1 + dak/transitions.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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: -- 2.39.5