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
888ac86d
Commit
888ac86d
authored
Jul 26, 2012
by
Mark Theunissen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Woops, missed the rest of them
parent
ac23c69b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
library/mysql_db
+5
-5
library/mysql_user
+5
-5
No files found.
library/mysql_db
View file @
888ac86d
...
...
@@ -78,20 +78,20 @@ def main():
# Either the caller passes both a username and password with which to connect to
# mysql, or they pass neither and allow this module to read the credentials from
# ~/.my.cnf.
loginpass
=
module
.
params
[
"loginpass
"
]
loginpass
wd
=
module
.
params
[
"loginpasswd
"
]
loginuser
=
module
.
params
[
"loginuser"
]
if
loginuser
is
None
and
loginpass
is
None
:
if
loginuser
is
None
and
loginpass
wd
is
None
:
mycnf_creds
=
load_mycnf
()
if
mycnf_creds
is
False
:
module
.
fail_json
(
msg
=
"incomplete login arguments passed and can't find them in ~/.my.cnf"
)
else
:
loginuser
=
mycnf_creds
[
"user"
]
loginpass
=
mycnf_creds
[
"passwd"
]
elif
loginpass
is
None
or
loginuser
is
None
:
loginpass
wd
=
mycnf_creds
[
"passwd"
]
elif
loginpass
wd
is
None
or
loginuser
is
None
:
module
.
fail_json
(
msg
=
"when supplying login arguments, both user and pass must be provided"
)
try
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"loginhost"
],
user
=
loginuser
,
passwd
=
loginpass
,
db
=
"mysql"
)
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"loginhost"
],
user
=
loginuser
,
passwd
=
loginpass
wd
,
db
=
"mysql"
)
cursor
=
db_connection
.
cursor
()
except
Exception
as
e
:
module
.
fail_json
(
msg
=
"unable to connect to database"
)
...
...
library/mysql_user
View file @
888ac86d
...
...
@@ -187,20 +187,20 @@ def main():
# Either the caller passes both a username and password with which to connect to
# mysql, or they pass neither and allow this module to read the credentials from
# ~/.my.cnf.
loginpass
=
module
.
params
[
"loginpass
"
]
loginpass
wd
=
module
.
params
[
"loginpasswd
"
]
loginuser
=
module
.
params
[
"loginuser"
]
if
loginuser
is
None
and
loginpass
is
None
:
if
loginuser
is
None
and
loginpass
wd
is
None
:
mycnf_creds
=
load_mycnf
()
if
mycnf_creds
is
False
:
module
.
fail_json
(
msg
=
"incomplete login arguments passed and can't find them in ~/.my.cnf"
)
else
:
loginuser
=
mycnf_creds
[
"user"
]
loginpass
=
mycnf_creds
[
"passwd"
]
elif
loginpass
is
None
or
loginuser
is
None
:
loginpass
wd
=
mycnf_creds
[
"passwd"
]
elif
loginpass
wd
is
None
or
loginuser
is
None
:
module
.
fail_json
(
msg
=
"when supplying login arguments, both user and pass must be provided"
)
try
:
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"loginhost"
],
user
=
loginuser
,
passwd
=
loginpass
,
db
=
"mysql"
)
db_connection
=
MySQLdb
.
connect
(
host
=
module
.
params
[
"loginhost"
],
user
=
loginuser
,
passwd
=
loginpass
wd
,
db
=
"mysql"
)
cursor
=
db_connection
.
cursor
()
except
Exception
as
e
:
module
.
fail_json
(
msg
=
"unable to connect to database"
)
...
...
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