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
11b64314
Commit
11b64314
authored
Dec 05, 2012
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select all fields from the user, as some of them are version-dependent
parent
65413dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
library/postgresql_user
+3
-8
No files found.
library/postgresql_user
View file @
11b64314
...
...
@@ -146,14 +146,9 @@ def user_alter(cursor, user, password, role_attr_flags):
# Handle passwords.
if
password
is
not
None
or
role_attr_flags
is
not
None
:
# Define columns for select.
columns
=
'rolpassword,rolsuper,rolinherit,rolcreaterole,rolcreatedb,rolcanlogin,rolreplication'
# Select password and all flag-like columns in order to verify changes.
# rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcatupdate |
# rolcanlogin | rolreplication | rolconnlimit | rolpassword | rolvaliduntil
# Not sure how to interpolate properly in python yet...
select
=
"SELECT "
+
columns
+
" FROM pg_authid where rolname=
%(user)
s"
cursor
.
execute
(
select
,
{
"columns"
:
columns
,
"user"
:
user
})
select
=
"SELECT * FROM pg_authid where rolname=
%(user)
s"
cursor
.
execute
(
select
,
{
"user"
:
user
})
# Grab current role attributes.
current_role_attrs
=
cursor
.
fetchone
()
...
...
@@ -166,7 +161,7 @@ def user_alter(cursor, user, password, role_attr_flags):
alter
=
"ALTER USER
%(user)
s WITH
%(role_attr_flags)
s"
cursor
.
execute
(
alter
%
{
"user"
:
user
,
"role_attr_flags"
:
role_attr_flags
})
# Grab new role attributes.
cursor
.
execute
(
select
,
{
"
columns"
:
columns
,
"
user"
:
user
})
cursor
.
execute
(
select
,
{
"user"
:
user
})
new_role_attrs
=
cursor
.
fetchone
()
# Detect any differences between current_ and new_role_attrs.
...
...
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