From 45defa5aa5b49effaf4c1df3b2d85db4b07bd3a8 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mar 20 2014 14:38:16 +0000 Subject: test_integration.tasks: Do not fail cleanup if backup directory does not exist If the test backup directory was never created (for example if there was an early failure, or install was never run), we don't want the test to fail. Do not restore if the backup dir is not there. Reviewed-By: Martin Kosek --- diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index 0982f93..4cc1488 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -133,7 +133,8 @@ def restore_files(host): "/sbin/restorecon -v" % (backupname, sed_remove_backupdir)) # Prepare command for actual restoring of the backed up files - copyfiles_command = 'cp -arvf %s/* /' % ipautil.shell_quote(backupname) + copyfiles_command = 'if [ -d %(dir)s/ ]; then cp -arvf %(dir)s/* /; fi' % { + 'dir': ipautil.shell_quote(backupname)} # Run both commands in one session. For more information, see: # https://fedorahosted.org/freeipa/ticket/4133