diff --git a/library/database/mysql_db b/library/database/mysql_db index 8eec1005893..1c67addd1ab 100644 --- a/library/database/mysql_db +++ b/library/database/mysql_db @@ -148,9 +148,9 @@ def db_import(module, host, user, password, db_name, target, port, socket=None): cmd += " --host=%s --port=%s" % (pipes.quote(host), pipes.quote(port)) cmd += " -D %s" % pipes.quote(db_name) if os.path.splitext(target)[-1] == '.gz': - cmd = 'gunzip < ' + pipes.quote(target) + ' | ' + cmd + cmd = 'test -e ' + pipes.quote(target) + ' && gunzip < ' + pipes.quote(target) + ' | ' + cmd elif os.path.splitext(target)[-1] == '.bz2': - cmd = 'bunzip2 < ' + pipes.quote(target) + ' | ' + cmd + cmd = 'test -e ' + pipes.quote(target) + ' && bunzip2 < ' + pipes.quote(target) + ' | ' + cmd else: cmd += " < %s" % pipes.quote(target) rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)