Merge pull request #7814 from scottbrown/bugfix-7811-mysql_import_does_not_perform_dump_existence_check

BUGFIX for Issue 7811: Adding file existence check when performing mysql import on...
This commit is contained in:
James Cammarata 2014-06-17 16:51:14 -05:00
commit 5349b2b06d

View file

@ -140,6 +140,9 @@ def db_dump(module, host, user, password, db_name, target, port, socket=None):
return rc, stdout, stderr return rc, stdout, stderr
def db_import(module, host, user, password, db_name, target, port, socket=None): def db_import(module, host, user, password, db_name, target, port, socket=None):
if not os.path.exists(target):
return module.fail_json(msg="target %s does not exist on the host" % target)
cmd = module.get_bin_path('mysql', True) cmd = module.get_bin_path('mysql', True)
cmd += " --user=%s --password=%s" % (pipes.quote(user), pipes.quote(password)) cmd += " --user=%s --password=%s" % (pipes.quote(user), pipes.quote(password))
if socket is not None: if socket is not None: