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
6b566cfc
Commit
6b566cfc
authored
Mar 17, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2404 from lorin/mysql-mycnf-user
.my.cnf: default to login when no user specified
parents
79efc04b
6fd5770d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
library/mysql_user
+15
-2
No files found.
library/mysql_user
View file @
6b566cfc
...
...
@@ -98,7 +98,17 @@ requirements: [ "ConfigParser", "MySQLdb" ]
author: Mark Theunissen
'''
EXAMPLES
=
"""
# Example .my.cnf file for setting the root password
# Note: don't use quotes around the password, because the mysql_user module
# will include them in the password but the mysql client will not
[client]
user=root
password=n<_665{vS43y
"""
import
ConfigParser
import
getpass
try
:
import
MySQLdb
except
ImportError
:
...
...
@@ -260,10 +270,13 @@ def load_mycnf():
passwd
=
config
.
get
(
'client'
,
'pass'
)
except
(
ConfigParser
.
NoOptionError
):
return
False
# If .my.cnf doesn't specify a user, default to user login name
try
:
creds
=
dict
(
user
=
config
.
get
(
'client'
,
'user'
),
passwd
=
passwd
)
user
=
config
.
get
(
'client'
,
'user'
)
except
(
ConfigParser
.
NoOptionError
):
return
False
user
=
getpass
.
getuser
()
creds
=
dict
(
user
=
user
,
passwd
=
passwd
)
return
creds
# ===========================================
...
...
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