Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
edx
configuration
Commits
7c19f04a
Commit
7c19f04a
authored
Jun 09, 2016
by
Kevin Falcone
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3102 from edx/jibsheet/mongo-replset-update-compare
This only worked by coincidence before
parents
ba013667
f1116b47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
playbooks/library/mongodb_replica_set
+7
-2
No files found.
playbooks/library/mongodb_replica_set
View file @
7c19f04a
...
...
@@ -93,6 +93,7 @@ else:
import
json
,
copy
from
urllib
import
quote_plus
from
operator
import
itemgetter
########### Mongo API calls ###########
def
get_replset
():
...
...
@@ -203,9 +204,13 @@ def is_member_subset(old_members,new_members):
extra information that is not reflected in old_members because we do not necesarily
track all of mongo's internal data in the config.
'''
for
member
in
old_members
:
# Mongo returns the member set in no particular order, and we were
# indexing into the list using _id before witout sorting which led to failure.
sorted_new_members
=
sorted
(
new_members
,
key
=
itemgetter
(
'_id'
))
for
member
in
sorted
(
old_members
,
key
=
itemgetter
(
'_id'
)):
for
k
in
member
:
if
member
[
k
]
!=
new_members
[
member
[
'_id'
]][
k
]:
return
False
if
member
[
k
]
!=
sorted_
new_members
[
member
[
'_id'
]][
k
]:
return
False
return
True
...
...
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