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
ac41a9d1
Commit
ac41a9d1
authored
Feb 23, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2175 from tyll/devel
mysql_db/user: Use password for my.cnf
parents
8b3ebf0d
cc8fbe34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
library/mysql_db
+1
-1
library/mysql_user
+8
-2
No files found.
library/mysql_db
View file @
ac41a9d1
...
...
@@ -131,7 +131,7 @@ def load_mycnf():
return
False
try
:
config
.
readfp
(
open
(
mycnf
))
creds
=
dict
(
user
=
config
.
get
(
'client'
,
'user'
),
passwd
=
config
.
get
(
'client'
,
'pass'
))
creds
=
dict
(
user
=
config
.
get
(
'client'
,
'user'
),
passwd
=
config
.
get
(
'client'
,
'pass
word
'
))
except
(
ConfigParser
.
NoOptionError
,
IOError
):
return
False
return
creds
...
...
library/mysql_user
View file @
ac41a9d1
...
...
@@ -213,7 +213,13 @@ def privileges_revoke(cursor, user,host,db_table):
query
=
"REVOKE ALL PRIVILEGES ON
%
s FROM '
%
s'@'
%
s'"
%
(
db_table
,
user
,
host
)
cursor
.
execute
(
query
)
query
=
"REVOKE GRANT OPTION ON
%
s FROM '
%
s'@'
%
s'"
%
(
db_table
,
user
,
host
)
cursor
.
execute
(
query
)
try
:
cursor
.
execute
(
query
)
except
MySQLdb
.
OperationalError
,
e
:
# 1141 -> There is no such grant defined for user ... on host ...
# If this exception is raised, there is no need to revoke the GRANT privilege
if
e
.
args
[
0
]
!=
1141
or
not
e
.
args
[
1
]
.
startswith
(
"There is no such grant defined for user"
):
raise
e
def
privileges_grant
(
cursor
,
user
,
host
,
db_table
,
priv
):
...
...
@@ -230,7 +236,7 @@ def load_mycnf():
return
False
try
:
config
.
readfp
(
open
(
mycnf
))
creds
=
dict
(
user
=
config
.
get
(
'client'
,
'user'
),
password
=
config
.
get
(
'client'
,
'pass'
))
creds
=
dict
(
user
=
config
.
get
(
'client'
,
'user'
),
password
=
config
.
get
(
'client'
,
'pass
word
'
))
except
(
ConfigParser
.
NoOptionError
,
IOError
):
return
False
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