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
a2aa30f4
Commit
a2aa30f4
authored
Aug 03, 2012
by
Ingo Gottwald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added login_unix_socket option to mysql_db module
parent
7e9e2901
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
library/mysql_db
+5
-1
No files found.
library/mysql_db
View file @
a2aa30f4
...
...
@@ -71,6 +71,7 @@ def main():
login_user
=
dict
(
default
=
None
),
login_password
=
dict
(
default
=
None
),
login_host
=
dict
(
default
=
"localhost"
),
login_unix_socket
=
dict
(
default
=
None
),
db
=
dict
(
required
=
True
,
aliases
=
[
'name'
]),
encoding
=
dict
(
default
=
""
),
collation
=
dict
(
default
=
""
),
...
...
@@ -103,7 +104,10 @@ def main():
module
.
fail_json
(
msg
=
"when supplying login arguments, both login_user and login_password must be provided"
)
try
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
"mysql"
)
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
=
"mysql"
)
else
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"login_host"
],
user
=
login_user
,
passwd
=
login_password
,
db
=
"mysql"
)
cursor
=
db_connection
.
cursor
()
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"
)
...
...
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