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
7182486f
Commit
7182486f
authored
Dec 16, 2013
by
jctanner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5099 from tartansandal/postgresql_db_check_mode
postgres_db CHECKMODE changed status
parents
15b89b45
ab14ec84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
+23
-1
library/database/postgresql_db
+23
-1
No files found.
library/database/postgresql_db
View file @
7182486f
...
@@ -192,6 +192,23 @@ def db_create(cursor, db, owner, template, encoding, lc_collate, lc_ctype):
...
@@ -192,6 +192,23 @@ def db_create(cursor, db, owner, template, encoding, lc_collate, lc_ctype):
else
:
else
:
return
False
return
False
def
db_matches
(
cursor
,
db
,
owner
,
template
,
encoding
,
lc_collate
,
lc_ctype
):
if
not
db_exists
(
cursor
,
db
):
return
False
else
:
db_info
=
get_db_info
(
cursor
,
db
)
if
(
encoding
and
get_encoding_id
(
cursor
,
encoding
)
!=
db_info
[
'encoding_id'
]):
return
False
elif
lc_collate
and
lc_collate
!=
db_info
[
'lc_collate'
]:
return
False
elif
lc_ctype
and
lc_ctype
!=
db_info
[
'lc_ctype'
]:
return
False
elif
owner
and
owner
!=
db_info
[
'owner'
]:
return
False
else
:
return
True
# ===========================================
# ===========================================
# Module execution.
# Module execution.
#
#
...
@@ -254,7 +271,12 @@ def main():
...
@@ -254,7 +271,12 @@ def main():
try
:
try
:
if
module
.
check_mode
:
if
module
.
check_mode
:
module
.
exit_json
(
changed
=
True
,
db
=
db
)
if
state
==
"absent"
:
changed
=
not
db_exists
(
cursor
,
db
)
elif
state
==
"present"
:
changed
=
not
db_matches
(
cursor
,
db
,
owner
,
template
,
encoding
,
lc_collate
,
lc_ctype
)
module
.
exit_json
(
changed
=
changed
,
db
=
db
)
if
state
==
"absent"
:
if
state
==
"absent"
:
changed
=
db_delete
(
cursor
,
db
)
changed
=
db_delete
(
cursor
,
db
)
...
...
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