summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/syncdutils.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2015-03-03 17:22:30 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-05 18:26:57 -0800
commit2452d284b38061981d7fbd7e5a7bd15808d13c21 (patch)
tree1e173a1d67cbf6f14b5f3a7a0e4f6b3d78ca454a /geo-replication/syncdaemon/syncdutils.py
parentbc2e58a436002e1627a225663bc7b11dddc1172f (diff)
geo-rep: Handle ENOENT during cleanup
shutil.rmtree was failing to remove file if file was not exists. Added error handling function to ignore ENOENT if a file/dir not present. BUG: 1198101 Change-Id: I1796db2642f81d9e2b5e52c6be34b4ad6f1c9786 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/9792 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Prashanth Pai <ppai@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Saravanakumar Arumugam <sarumuga@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/syncdutils.py')
-rw-r--r--geo-replication/syncdaemon/syncdutils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
index 23db55e2e80..6af957ddb4a 100644
--- a/geo-replication/syncdaemon/syncdutils.py
+++ b/geo-replication/syncdaemon/syncdutils.py
@@ -203,7 +203,12 @@ def finalize(*a, **kw):
else:
raise
if gconf.ssh_ctl_dir and not gconf.cpid:
- shutil.rmtree(gconf.ssh_ctl_dir)
+ def handle_rm_error(func, path, exc_info):
+ if exc_info[1].errno == ENOENT:
+ return
+ raise exc_info[1]
+
+ shutil.rmtree(gconf.ssh_ctl_dir, onerror=handle_rm_error)
if getattr(gconf, 'state_socket', None):
try:
os.unlink(gconf.state_socket)