mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Attempt to fix race condition
This commit is contained in:
parent
d2f82c8bba
commit
1066d9d618
@ -181,6 +181,8 @@ class SaltRaetRoadStackJoined(ioflo.base.deeding.Deed):
|
||||
stack='stack',
|
||||
status=odict(ipath='status', ival=odict(joined=False,
|
||||
allowed=False,
|
||||
alived=False,
|
||||
rejected=False,
|
||||
idle=False, )))
|
||||
|
||||
def action(self, **kwa):
|
||||
@ -195,6 +197,39 @@ class SaltRaetRoadStackJoined(ioflo.base.deeding.Deed):
|
||||
self.status.update(joined=joined)
|
||||
|
||||
|
||||
class SaltRaetRoadStackRejected(ioflo.base.deeding.Deed):
|
||||
'''
|
||||
Updates status with rejected of .acceptance of zeroth remote estate (master)
|
||||
FloScript:
|
||||
|
||||
do salt raet road stack rejected
|
||||
go next if rejected in .raet.udp.stack.status
|
||||
|
||||
'''
|
||||
Ioinits = odict(
|
||||
inode=".raet.udp.stack.",
|
||||
stack='stack',
|
||||
status=odict(ipath='status', ival=odict(joined=False,
|
||||
allowed=False,
|
||||
alived=False,
|
||||
rejected=False,
|
||||
idle=False, )))
|
||||
|
||||
def action(self, **kwa):
|
||||
'''
|
||||
Update .status share
|
||||
'''
|
||||
stack = self.stack.value
|
||||
rejected = False
|
||||
if stack and isinstance(stack, RoadStack):
|
||||
if stack.remotes:
|
||||
rejected = (stack.remotes.values()[0].acceptance
|
||||
== raeting.acceptances.rejected)
|
||||
else: #no remotes so assume rejected
|
||||
rejected = True
|
||||
self.status.update(rejected=rejected)
|
||||
|
||||
|
||||
class SaltRaetRoadStackAllower(ioflo.base.deeding.Deed):
|
||||
'''
|
||||
Initiates allow (CurveCP handshake) transaction with master
|
||||
@ -214,7 +249,7 @@ class SaltRaetRoadStackAllower(ioflo.base.deeding.Deed):
|
||||
'''
|
||||
stack = self.stack.value
|
||||
if stack and isinstance(stack, RoadStack):
|
||||
stack.allow()
|
||||
stack.allow(timeout=0.0)
|
||||
return None
|
||||
|
||||
|
||||
@ -232,6 +267,8 @@ class SaltRaetRoadStackAllowed(ioflo.base.deeding.Deed):
|
||||
stack='stack',
|
||||
status=odict(ipath='status', ival=odict(joined=False,
|
||||
allowed=False,
|
||||
alived=False,
|
||||
rejected=False,
|
||||
idle=False, )))
|
||||
|
||||
def action(self, **kwa):
|
||||
|
@ -32,8 +32,10 @@ framer bootstrap be active first join
|
||||
do salt raet road stack joiner per inode ".raet.udp.stack."
|
||||
recur
|
||||
do salt raet road stack joined per inode ".raet.udp.stack."
|
||||
do salt raet road stack rejected per inode ".raet.udp.stack."
|
||||
|
||||
go next if joined in .raet.udp.stack.status
|
||||
#go abort if rejected in .raet.udp.stack.status
|
||||
#go abort if elapsed >= 10
|
||||
|
||||
frame joined
|
||||
@ -48,7 +50,7 @@ framer bootstrap be active first join
|
||||
do salt raet road stack allowed per inode ".raet.udp.stack."
|
||||
|
||||
go next if allowed in .raet.udp.stack.status
|
||||
go abort if elapsed >= 5
|
||||
#go abort if elapsed >= 5
|
||||
|
||||
frame allowed
|
||||
print Allowed
|
||||
|
@ -271,13 +271,13 @@ class BasicTestCase(unittest.TestCase):
|
||||
'name': 'remote1',
|
||||
'ha': ['127.0.0.1', 7532],
|
||||
'sid': 0,
|
||||
'rsid': 0},
|
||||
'joined': None,},
|
||||
'4':
|
||||
{'uid': 4,
|
||||
'name': 'remote2',
|
||||
'ha': ['127.0.0.1', 7533],
|
||||
'sid': 0,
|
||||
'rsid': 0}})
|
||||
'joined': None,}})
|
||||
|
||||
# now recreate with saved data
|
||||
main.server.close()
|
||||
@ -355,13 +355,13 @@ class BasicTestCase(unittest.TestCase):
|
||||
'name': 'remote3',
|
||||
'ha': ['127.0.0.1', 7534],
|
||||
'sid': 0,
|
||||
'rsid': 0},
|
||||
'joined': None,},
|
||||
'4':
|
||||
{'uid': 4,
|
||||
'name': 'remote4',
|
||||
'ha': ['127.0.0.1', 7535],
|
||||
'sid': 0,
|
||||
'rsid': 0}})
|
||||
'joined': None,}})
|
||||
|
||||
main.server.close()
|
||||
other.server.close()
|
||||
|
Loading…
Reference in New Issue
Block a user