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:
commit
5349b2b06d
1 changed files with 3 additions and 0 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue