From 2452d284b38061981d7fbd7e5a7bd15808d13c21 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Tue, 3 Mar 2015 17:22:30 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/9792 Tested-by: Gluster Build System Reviewed-by: Prashanth Pai Reviewed-by: Venky Shankar Reviewed-by: Kotresh HR Reviewed-by: Saravanakumar Arumugam --- geo-replication/syncdaemon/syncdutils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'geo-replication/syncdaemon/syncdutils.py') 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) -- cgit