Skip to content

Commit

Permalink
Support for Raet 0.6.0 with enums
Browse files Browse the repository at this point in the history
  • Loading branch information
SmithSamuelM committed Feb 12, 2015
1 parent 26c3c14 commit 19acf45
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions requirements/raet.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r base.txt

libnacl
ioflo
raet
libnacl >= 1.0.0
ioflo >= 1.1.7
raet >= 0.6.0
2 changes: 1 addition & 1 deletion salt/cli/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _setup_caller_stack(self, opts):
lanename=lanename,
sockdirpath=sockdirpath)

stack.Pk = raeting.packKinds.pack
stack.Pk = raeting.PackKind.pack.value
stack.addRemote(RemoteYard(stack=stack,
name='manor',
lanename=lanename,
Expand Down
2 changes: 1 addition & 1 deletion salt/client/raet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def pub(self,
name=name,
lanename=lanename,
sockdirpath=sockdirpath)
stack.Pk = raeting.packKinds.pack
stack.Pk = raeting.PackKind.pack.value
manor_yard = RemoteYard(
stack=stack,
lanename=lanename,
Expand Down
8 changes: 4 additions & 4 deletions salt/daemons/flo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _prepare(self):
'''
Assign class defaults
'''
RoadStack.Bk = raeting.bodyKinds.msgpack
RoadStack.Bk = raeting.BodyKind.msgpack.value
RoadStack.JoinentTimeout = 0.0

def action(self):
Expand Down Expand Up @@ -440,7 +440,7 @@ def action(self, **kwa):
rejected = False
if stack and isinstance(stack, RoadStack):
if stack.remotes:
rejected = all([remote.acceptance == raeting.acceptances.rejected
rejected = all([remote.acceptance == raeting.Acceptance.rejected.value
for remote in stack.remotes.values()
if remote.kind == kinds.applKinds.master])
else: # no remotes so assume rejected
Expand Down Expand Up @@ -818,7 +818,7 @@ def action(self):
name=name,
lanename=lanename,
sockdirpath=self.opts.value['sock_dir'])
self.stack.value.Pk = raeting.packKinds.pack
self.stack.value.Pk = raeting.PackKind.pack.value
self.event_yards.value = set()
self.local_cmd.value = deque()
self.remote_cmd.value = deque()
Expand Down Expand Up @@ -1851,7 +1851,7 @@ def _setup_jobber_stack(self):
lanename=lanename,
sockdirpath=sockdirpath)

stack.Pk = raeting.packKinds.pack
stack.Pk = raeting.PackKind.pack.value
# add remote for the manor yard
stack.addRemote(RemoteYard(stack=stack,
name='manor',
Expand Down
2 changes: 1 addition & 1 deletion salt/daemons/flo/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def action(self):
name=name,
lanename=lanename,
sockdirpath=sockdirpath)
self.stack.value.Pk = raeting.packKinds.pack
self.stack.value.Pk = raeting.PackKind.pack.value
manor_yard = RemoteYard(
stack=self.stack.value,
name='manor',
Expand Down
22 changes: 11 additions & 11 deletions salt/daemons/salting.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SaltKeep(Keep):
'role', 'acceptance', 'verhex', 'pubhex']
RemoteDumpFields = ['name', 'uid', 'fuid', 'ha', 'iha', 'natted', 'fqdn', 'dyned',
'sid', 'main', 'kind', 'joined', 'role']
Auto = raeting.autoModes.never #auto accept
Auto = raeting.AutoMode.never.value #auto accept

def __init__(self, opts, prefix='estate', basedirpath='', auto=None, **kwa):
'''
Expand All @@ -56,9 +56,9 @@ def __init__(self, opts, prefix='estate', basedirpath='', auto=None, **kwa):
basedirpath = basedirpath or os.path.join(opts['cache_dir'], 'raet')
super(SaltKeep, self).__init__(prefix=prefix, basedirpath=basedirpath, **kwa)
self.auto = (auto if auto is not None else
(raeting.autoModes.always if opts['open_mode'] else
(raeting.autoModes.once if opts['auto_accept'] else
raeting.autoModes.never)))
(raeting.AutoMode.always.value if opts['open_mode'] else
(raeting.AutoMode.once.value if opts['auto_accept'] else
raeting.AutoMode.never.value)))
self.saltRaetKey = RaetKey(opts)

def clearAllDir(self):
Expand Down Expand Up @@ -118,7 +118,7 @@ def loadRemoteData(self, name):
return None

mid = data['role']
for status in raeting.ACCEPTANCES:
for status in [acceptance.name for acceptance in Acceptance]:
keydata = self.saltRaetKey.read_remote(mid, status)
if keydata:
break
Expand All @@ -128,7 +128,7 @@ def loadRemoteData(self, name):
('verhex', None),
('pubhex', None)])
else:
data.update(acceptance=raeting.ACCEPTANCES[status],
data.update(acceptance=raeting.Acceptance[status].value,
verhex=keydata['verify'],
pubhex=keydata['pub'])

Expand All @@ -151,7 +151,7 @@ def loadAllRemoteData(self):
for name, data in keeps.items():
if data['role'] == mid:
keeps[name].update(
[('acceptance', raeting.ACCEPTANCES[status]),
[('acceptance', raeting.Acceptance[status].value),
('verhex', keydata['verify']),
('pubhex', keydata['pub'])])
return keeps
Expand Down Expand Up @@ -250,9 +250,9 @@ def statusRole(self, role, verhex, pubhex, dump=True):
Where status is acceptance status of role and keys
and has value from raeting.acceptances
'''
status = raeting.ACCEPTANCES[self.saltRaetKey.status(role,
status = raeting.Acceptance[self.saltRaetKey.status(role,
pubhex,
verhex)]
verhex)].value

return status

Expand All @@ -262,7 +262,7 @@ def rejectRemote(self, remote):
'''
mid = remote.role
self.saltRaetKey.reject(match=mid, include_accepted=True)
remote.acceptance = raeting.acceptances.rejected
remote.acceptance = raeting.Acceptance.rejected.value

def pendRemote(self, remote):
'''
Expand All @@ -276,4 +276,4 @@ def acceptRemote(self, remote):
'''
mid = remote.role
self.saltRaetKey.accept(match=mid, include_rejected=True)
remote.acceptance = raeting.acceptances.accepted
remote.acceptance = raeting.Acceptance.accepted.value
4 changes: 2 additions & 2 deletions salt/daemons/test/plan/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,8 @@ def action(self):
minionStack.addRemote(minionRemoteMaster)

# Make life easier
masterStack.keep.auto = raeting.autoModes.always
minionStack.keep.auto = raeting.autoModes.always
masterStack.keep.auto = raeting.AutoMode.always.value
minionStack.keep.auto = raeting.AutoMode.always.value

minionStack.join(minionRemoteMaster.uid)
serviceRoads([minionStack, masterStack])
Expand Down
Loading

0 comments on commit 19acf45

Please sign in to comment.