Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
5ad7dcf4
Commit
5ad7dcf4
authored
Jun 23, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6766 from Jmainguy/mysql_db_bug
mysql_db module now correctly fails on import if bz2 or gz fails.
parents
2bfdad1e
8928a5ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
library/database/mysql_db
+33
-3
No files found.
library/database/mysql_db
View file @
5ad7dcf4
...
...
@@ -151,12 +151,42 @@ 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
gunzip_path
=
module
.
get_bin_path
(
'gunzip'
)
if
gunzip_path
:
rc
,
stdout
,
stderr
=
module
.
run_command
(
'
%
s
%
s'
%
(
gunzip_path
,
target
))
if
rc
!=
0
:
return
rc
,
stdout
,
stderr
cmd
+=
" <
%
s"
%
pipes
.
quote
(
os
.
path
.
splitext
(
target
)[
0
])
rc
,
stdout
,
stderr
=
module
.
run_command
(
cmd
,
use_unsafe_shell
=
True
)
if
rc
!=
0
:
return
rc
,
stdout
,
stderr
gzip_path
=
module
.
get_bin_path
(
'gzip'
)
if
gzip_path
:
rc
,
stdout
,
stderr
=
module
.
run_command
(
'
%
s
%
s'
%
(
gzip_path
,
os
.
path
.
splitext
(
target
)[
0
]))
else
:
module
.
fail_json
(
msg
=
"gzip command not found"
)
else
:
module
.
fail_json
(
msg
=
"gunzip command not found"
)
elif
os
.
path
.
splitext
(
target
)[
-
1
]
==
'.bz2'
:
cmd
=
'bunzip2 < '
+
pipes
.
quote
(
target
)
+
' | '
+
cmd
bunzip2_path
=
module
.
get_bin_path
(
'bunzip2'
)
if
bunzip2_path
:
rc
,
stdout
,
stderr
=
module
.
run_command
(
'
%
s
%
s'
%
(
bunzip2_path
,
target
))
if
rc
!=
0
:
return
rc
,
stdout
,
stderr
cmd
+=
" <
%
s"
%
pipes
.
quote
(
os
.
path
.
splitext
(
target
)[
0
])
rc
,
stdout
,
stderr
=
module
.
run_command
(
cmd
,
use_unsafe_shell
=
True
)
if
rc
!=
0
:
return
rc
,
stdout
,
stderr
bzip2_path
=
module
.
get_bin_path
(
'bzip2'
)
if
bzip2_path
:
rc
,
stdout
,
stderr
=
module
.
run_command
(
'
%
s
%
s'
%
(
bzip2_path
,
os
.
path
.
splitext
(
target
)[
0
]))
else
:
module
.
fail_json
(
msg
=
"bzip2 command not found"
)
else
:
module
.
fail_json
(
msg
=
"bunzip2 command not found"
)
else
:
cmd
+=
" <
%
s"
%
pipes
.
quote
(
target
)
rc
,
stdout
,
stderr
=
module
.
run_command
(
cmd
,
use_unsafe_shell
=
True
)
rc
,
stdout
,
stderr
=
module
.
run_command
(
cmd
,
use_unsafe_shell
=
True
)
return
rc
,
stdout
,
stderr
def
db_create
(
cursor
,
db
,
encoding
,
collation
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment