From 2c88a50f720f45b06c7040abca34ccf77b474c5d Mon Sep 17 00:00:00 2001
From: Wouter Klijn <klijn@astron.nl>
Date: Mon, 25 Jun 2012 15:01:10 +0000
Subject: [PATCH] Task #3375: change order create dir

---
 CEP/Pipeline/recipes/sip/nodes/copier.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/CEP/Pipeline/recipes/sip/nodes/copier.py b/CEP/Pipeline/recipes/sip/nodes/copier.py
index a2c7fec679d..a34dca48192 100644
--- a/CEP/Pipeline/recipes/sip/nodes/copier.py
+++ b/CEP/Pipeline/recipes/sip/nodes/copier.py
@@ -65,16 +65,16 @@ class copier(LOFARnodeTCP):
 
     def _copy_single_file_using_rsync(self, source_node, source_path,
                                       target_path):
+        # assure that target dir exists (rsync creates it but..
+        # an error in the python code will throw a nicer error
+        create_directory(os.path.dirname(target_path))
+
         #check if the targat_path is writable for the current proc
         if not os.access(os.path.dirname(target_path), os.W_OK):
-            message = "No write acces to target path: {0}".format(target_path)
+            message = "No write acces to target path: {0}".format(os.path.dirname(target_path))
             self.logger.error(message)
             raise IOError(message)
 
-        # assure that target dir exists (rsync creates it but..
-        # an error in the python code will throw a nicer error
-        create_directory(os.path.dirname(target_path))
-
         # construct copy command
         command = ["rsync", "-r", "{0}:{1}".format(source_node, source_path) ,
                                "{0}".format(target_path)]
-- 
GitLab