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>
This commit is contained in:
Aravinda VK 2015-03-03 17:22:30 +05:30 committed by Vijay Bellur
parent bc2e58a436
commit 2452d284b3

View File

@ -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)