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
1f91a703
Commit
1f91a703
authored
Oct 12, 2012
by
Aurélien Bondis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue with mysql authentication and states not dump or import
parent
dfaef806
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
library/mysql_db
+8
-5
No files found.
library/mysql_db
View file @
1f91a703
...
@@ -180,18 +180,21 @@ def main():
...
@@ -180,18 +180,21 @@ def main():
elif
login_password
is
None
or
login_user
is
None
:
elif
login_password
is
None
or
login_user
is
None
:
module
.
fail_json
(
msg
=
"when supplying login arguments, both login_user and login_password must be provided"
)
module
.
fail_json
(
msg
=
"when supplying login arguments, both login_user and login_password must be provided"
)
if
state
in
[
'dump'
,
'import'
]:
if
target
is
None
:
module
.
fail_json
(
msg
=
"with state={0} target is required"
.
format
(
state
))
connect_to_db
=
db
else
:
connect_to_db
=
'mysql'
try
:
try
:
if
module
.
params
[
"login_unix_socket"
]
!=
None
:
if
module
.
params
[
"login_unix_socket"
]
!=
None
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
unix_socket
=
module
.
params
[
"login_unix_socket"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
db
)
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
unix_socket
=
module
.
params
[
"login_unix_socket"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
connect_to_
db
)
else
:
else
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
db
)
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
connect_to_
db
)
cursor
=
db_connection
.
cursor
()
cursor
=
db_connection
.
cursor
()
except
Exception
as
e
:
except
Exception
as
e
:
module
.
fail_json
(
msg
=
"unable to connect, check login_user and login_password are correct, or alternatively check ~/.my.cnf contains credentials"
)
module
.
fail_json
(
msg
=
"unable to connect, check login_user and login_password are correct, or alternatively check ~/.my.cnf contains credentials"
)
if
(
state
in
[
'dump'
,
'import'
])
and
target
is
None
:
module
.
fail_json
(
msg
=
"with state={0} target is required"
.
format
(
state
))
changed
=
False
changed
=
False
if
db_exists
(
cursor
,
db
):
if
db_exists
(
cursor
,
db
):
if
state
==
"absent"
:
if
state
==
"absent"
:
...
...
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