|
|
@ -153,13 +153,13 @@ def db_import(module, host, user, password, db_name, target, port, socket=None):
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (gunzip_path, target))
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (gunzip_path, target))
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
return rc, stdout, stderr
|
|
|
|
return rc, stdout, stderr
|
|
|
|
cmd += " < %s" % pipes.quote(target[0:-3])
|
|
|
|
cmd += " < %s" % pipes.quote(os.path.splitext(target)[0])
|
|
|
|
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)
|
|
|
|
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
return rc, stdout, stderr
|
|
|
|
return rc, stdout, stderr
|
|
|
|
gzip_path = module.get_bin_path('gzip')
|
|
|
|
gzip_path = module.get_bin_path('gzip')
|
|
|
|
if gzip_path:
|
|
|
|
if gzip_path:
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (gzip_path, target[0:-3]))
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (gzip_path, os.path.splitext(target)[0]))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.fail_json(msg="gzip command not found")
|
|
|
|
module.fail_json(msg="gzip command not found")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -170,13 +170,13 @@ def db_import(module, host, user, password, db_name, target, port, socket=None):
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (bunzip2_path, target))
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (bunzip2_path, target))
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
return rc, stdout, stderr
|
|
|
|
return rc, stdout, stderr
|
|
|
|
cmd += " < %s" % pipes.quote(target[0:-4])
|
|
|
|
cmd += " < %s" % pipes.quote(os.path.splitext(target)[0])
|
|
|
|
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)
|
|
|
|
rc, stdout, stderr = module.run_command(cmd, use_unsafe_shell=True)
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
return rc, stdout, stderr
|
|
|
|
return rc, stdout, stderr
|
|
|
|
bzip2_path = module.get_bin_path('bzip2')
|
|
|
|
bzip2_path = module.get_bin_path('bzip2')
|
|
|
|
if bzip2_path:
|
|
|
|
if bzip2_path:
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (bzip2_path, target[0:-4]))
|
|
|
|
rc, stdout, stderr = module.run_command('%s %s' % (bzip2_path, os.path.splitext(target)[0]))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.fail_json(msg="bzip2 command not found")
|
|
|
|
module.fail_json(msg="bzip2 command not found")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|