mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge branch 'SmithSamuelM-2014.7_sam3' into 2014.7
This commit is contained in:
commit
d35e38907f
@ -283,8 +283,8 @@ class RAETCaller(ZeroMQCaller):
|
|||||||
'''
|
'''
|
||||||
mid = opts['id']
|
mid = opts['id']
|
||||||
sockdirpath = opts['sock_dir']
|
sockdirpath = opts['sock_dir']
|
||||||
yid = nacling.uuid(size=18)
|
uid = nacling.uuid(size=18)
|
||||||
name = 'caller' + yid
|
name = 'caller' + uid
|
||||||
stack = LaneStack(name=name,
|
stack = LaneStack(name=name,
|
||||||
lanename=mid,
|
lanename=mid,
|
||||||
sockdirpath=sockdirpath)
|
sockdirpath=sockdirpath)
|
||||||
|
@ -51,17 +51,17 @@ class LocalClient(salt.client.LocalClient):
|
|||||||
jid=jid,
|
jid=jid,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
yid = nacling.uuid(size=18)
|
uid = nacling.uuid(size=18)
|
||||||
stack = LaneStack(
|
stack = LaneStack(
|
||||||
name=('client' + yid),
|
name=('client' + uid),
|
||||||
yid=yid,
|
uid=uid,
|
||||||
lanename='master',
|
lanename='master',
|
||||||
sockdirpath=self.opts['sock_dir'])
|
sockdirpath=self.opts['sock_dir'])
|
||||||
stack.Pk = raeting.packKinds.pack
|
stack.Pk = raeting.packKinds.pack
|
||||||
router_yard = RemoteYard(
|
router_yard = RemoteYard(
|
||||||
stack=stack,
|
stack=stack,
|
||||||
lanename='master',
|
lanename='master',
|
||||||
yid=0,
|
uid=0,
|
||||||
name='manor',
|
name='manor',
|
||||||
dirpath=self.opts['sock_dir'])
|
dirpath=self.opts['sock_dir'])
|
||||||
stack.addRemote(router_yard)
|
stack.addRemote(router_yard)
|
||||||
|
@ -243,7 +243,13 @@ VALID_OPTS = {
|
|||||||
'ssh_sudo': bool,
|
'ssh_sudo': bool,
|
||||||
'ssh_timeout': float,
|
'ssh_timeout': float,
|
||||||
'ssh_user': str,
|
'ssh_user': str,
|
||||||
|
'ioflo_verbose': int,
|
||||||
|
'ioflo_period': float,
|
||||||
|
'ioflo_realtime': bool,
|
||||||
|
'ioflo_console_logdir': str,
|
||||||
'raet_port': int,
|
'raet_port': int,
|
||||||
|
'raet_mutable': bool,
|
||||||
|
'raet_main': bool,
|
||||||
'sqlite_queue_dir': str,
|
'sqlite_queue_dir': str,
|
||||||
'queue_dirs': list,
|
'queue_dirs': list,
|
||||||
'restart_on_error': bool,
|
'restart_on_error': bool,
|
||||||
@ -371,7 +377,10 @@ DEFAULT_MINION_OPTS = {
|
|||||||
'ioflo_verbose': 0,
|
'ioflo_verbose': 0,
|
||||||
'ioflo_period': 0.1,
|
'ioflo_period': 0.1,
|
||||||
'ioflo_realtime': True,
|
'ioflo_realtime': True,
|
||||||
|
'ioflo_console_logdir': '',
|
||||||
'raet_port': 4510,
|
'raet_port': 4510,
|
||||||
|
'raet_mutable': False,
|
||||||
|
'raet_main': False,
|
||||||
'restart_on_error': False,
|
'restart_on_error': False,
|
||||||
'ping_interval': 0,
|
'ping_interval': 0,
|
||||||
'username': None,
|
'username': None,
|
||||||
@ -531,7 +540,10 @@ DEFAULT_MASTER_OPTS = {
|
|||||||
'ioflo_verbose': 0,
|
'ioflo_verbose': 0,
|
||||||
'ioflo_period': 0.01,
|
'ioflo_period': 0.01,
|
||||||
'ioflo_realtime': True,
|
'ioflo_realtime': True,
|
||||||
|
'ioflo_console_logdir': '',
|
||||||
'raet_port': 4506,
|
'raet_port': 4506,
|
||||||
|
'raet_mutable': False,
|
||||||
|
'raet_main': True,
|
||||||
'sqlite_queue_dir': os.path.join(salt.syspaths.CACHE_DIR, 'master', 'queues'),
|
'sqlite_queue_dir': os.path.join(salt.syspaths.CACHE_DIR, 'master', 'queues'),
|
||||||
'queue_dirs': [],
|
'queue_dirs': [],
|
||||||
'cli_summary': False,
|
'cli_summary': False,
|
||||||
|
@ -21,7 +21,7 @@ import salt.utils.args
|
|||||||
import salt.transport
|
import salt.transport
|
||||||
from raet import raeting, nacling
|
from raet import raeting, nacling
|
||||||
from raet.road.stacking import RoadStack
|
from raet.road.stacking import RoadStack
|
||||||
from raet.road.estating import LocalEstate
|
from raet.road.estating import RemoteEstate
|
||||||
from raet.lane.stacking import LaneStack
|
from raet.lane.stacking import LaneStack
|
||||||
from raet.lane.yarding import RemoteYard
|
from raet.lane.yarding import RemoteYard
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ class SaltRaetRoadStackSetup(ioflo.base.deeding.Deed):
|
|||||||
'local': {'ipath': 'local',
|
'local': {'ipath': 'local',
|
||||||
'ival': {'name': 'master',
|
'ival': {'name': 'master',
|
||||||
'main': False,
|
'main': False,
|
||||||
'auto': None,
|
'mutable': False,
|
||||||
'eid': 0,
|
'uid': None,
|
||||||
'sigkey': None,
|
'sigkey': None,
|
||||||
'prikey': None}},
|
'prikey': None}},
|
||||||
}
|
}
|
||||||
@ -134,35 +134,32 @@ class SaltRaetRoadStackSetup(ioflo.base.deeding.Deed):
|
|||||||
name = self.opts.value.get('id', self.local.data.name)
|
name = self.opts.value.get('id', self.local.data.name)
|
||||||
sigkey = self.local.data.sigkey
|
sigkey = self.local.data.sigkey
|
||||||
prikey = self.local.data.prikey
|
prikey = self.local.data.prikey
|
||||||
auto = self.local.data.auto
|
main = self.opts.value.get('raet_main', self.local.data.main)
|
||||||
main = self.local.data.main
|
mutable = self.opts.value.get('raet_mutable', self.local.data.mutable)
|
||||||
eid = self.local.data.eid
|
always = self.opts.value.get('open_mode', False)
|
||||||
|
mutable = mutable or always # open_made when True takes precedence
|
||||||
|
uid = self.local.data.uid
|
||||||
|
|
||||||
ha = (self.opts.value['interface'], self.opts.value['raet_port'])
|
ha = (self.opts.value['interface'], self.opts.value['raet_port'])
|
||||||
|
|
||||||
basedirpath = os.path.abspath(os.path.join(self.opts.value['cachedir'], 'raet'))
|
basedirpath = os.path.abspath(os.path.join(self.opts.value['cachedir'], 'raet'))
|
||||||
|
|
||||||
local = LocalEstate(
|
|
||||||
eid=eid,
|
|
||||||
name=name,
|
|
||||||
main=main,
|
|
||||||
ha=ha,
|
|
||||||
sigkey=sigkey,
|
|
||||||
prikey=prikey)
|
|
||||||
txMsgs = self.txmsgs.value
|
txMsgs = self.txmsgs.value
|
||||||
rxMsgs = self.rxmsgs.value
|
rxMsgs = self.rxmsgs.value
|
||||||
|
|
||||||
keep = salting.SaltKeep(opts=self.opts.value,
|
keep = salting.SaltKeep(opts=self.opts.value,
|
||||||
basedirpath=basedirpath,
|
basedirpath=basedirpath,
|
||||||
stackname=name,
|
stackname=name)
|
||||||
auto=auto)
|
|
||||||
|
|
||||||
self.stack.value = RoadStack(
|
self.stack.value = RoadStack(store=self.store,
|
||||||
local=local,
|
|
||||||
store=self.store,
|
|
||||||
name=name,
|
|
||||||
main=main,
|
|
||||||
keep=keep,
|
keep=keep,
|
||||||
|
name=name,
|
||||||
|
uid=uid,
|
||||||
|
ha=ha,
|
||||||
|
sigkey=sigkey,
|
||||||
|
prikey=prikey,
|
||||||
|
main=main,
|
||||||
|
mutable=mutable,
|
||||||
txMsgs=txMsgs,
|
txMsgs=txMsgs,
|
||||||
rxMsgs=rxMsgs,
|
rxMsgs=rxMsgs,
|
||||||
period=3.0,
|
period=3.0,
|
||||||
@ -213,7 +210,12 @@ class SaltRaetRoadStackJoiner(ioflo.base.deeding.Deed):
|
|||||||
'''
|
'''
|
||||||
stack = self.stack.value
|
stack = self.stack.value
|
||||||
if stack and isinstance(stack, RoadStack):
|
if stack and isinstance(stack, RoadStack):
|
||||||
stack.join(ha=self.mha, timeout=0.0)
|
if not stack.remotes:
|
||||||
|
stack.addRemote(RemoteEstate(stack=stack,
|
||||||
|
fuid=0, # vacuous join
|
||||||
|
sid=0, # always 0 for join
|
||||||
|
ha=self.mha))
|
||||||
|
stack.join(uid=stack.remotes.values()[0].uid, timeout=0.0)
|
||||||
|
|
||||||
|
|
||||||
class SaltRaetRoadStackJoined(ioflo.base.deeding.Deed):
|
class SaltRaetRoadStackJoined(ioflo.base.deeding.Deed):
|
||||||
@ -580,11 +582,11 @@ class SaltManorLaneSetup(ioflo.base.deeding.Deed):
|
|||||||
#name = "{0}{1}".format(self.opts.value.get('id', self.local.data.name), 'lane')
|
#name = "{0}{1}".format(self.opts.value.get('id', self.local.data.name), 'lane')
|
||||||
name = 'manor'
|
name = 'manor'
|
||||||
lanename = self.opts.value.get('id', self.local.data.lanename)
|
lanename = self.opts.value.get('id', self.local.data.lanename)
|
||||||
yid = self.local.data.yid
|
#yid = self.local.data.yid
|
||||||
self.stack.value = LaneStack(
|
self.stack.value = LaneStack(
|
||||||
name=name,
|
name=name,
|
||||||
lanename=lanename,
|
lanename=lanename,
|
||||||
yid=0,
|
uid=0,
|
||||||
sockdirpath=self.opts.value['sock_dir'])
|
sockdirpath=self.opts.value['sock_dir'])
|
||||||
self.stack.value.Pk = raeting.packKinds.pack
|
self.stack.value.Pk = raeting.packKinds.pack
|
||||||
self.event_yards.value = set()
|
self.event_yards.value = set()
|
||||||
@ -745,7 +747,8 @@ class Router(ioflo.base.deeding.Deed):
|
|||||||
elif d_share == 'remote_cmd':
|
elif d_share == 'remote_cmd':
|
||||||
# Send it to a remote worker
|
# Send it to a remote worker
|
||||||
if 'load' in msg:
|
if 'load' in msg:
|
||||||
msg['load']['id'] = sender
|
role = self.udp_stack.value.nameRemotes[sender].role
|
||||||
|
msg['load']['id'] = role # sender # should this be role XXXX
|
||||||
self.uxd_stack.value.transmit(msg,
|
self.uxd_stack.value.transmit(msg,
|
||||||
self.uxd_stack.value.fetchUidByName(next(self.workers.value)))
|
self.uxd_stack.value.fetchUidByName(next(self.workers.value)))
|
||||||
elif d_share == 'fun':
|
elif d_share == 'fun':
|
||||||
@ -770,8 +773,8 @@ class Router(ioflo.base.deeding.Deed):
|
|||||||
pass
|
pass
|
||||||
elif d_estate != self.udp_stack.value.local:
|
elif d_estate != self.udp_stack.value.local:
|
||||||
# Forward to the correct estate
|
# Forward to the correct estate
|
||||||
eid = self.udp_stack.value.fetchUidByName(d_estate)
|
uid = self.udp_stack.value.fetchUidByName(d_estate)
|
||||||
self.udp_stack.value.message(msg, eid)
|
self.udp_stack.value.message(msg, uid)
|
||||||
return
|
return
|
||||||
if d_share == 'pub_ret':
|
if d_share == 'pub_ret':
|
||||||
if msg.get('__worker_verify') == self.worker_verify.value:
|
if msg.get('__worker_verify') == self.worker_verify.value:
|
||||||
@ -891,13 +894,13 @@ class SaltPublisher(ioflo.base.deeding.Deed):
|
|||||||
# only publish to available minions by intersecting sets
|
# only publish to available minions by intersecting sets
|
||||||
minions = self.availables.value & set(self.stack.value.nameRemotes.keys())
|
minions = self.availables.value & set(self.stack.value.nameRemotes.keys())
|
||||||
for minion in minions:
|
for minion in minions:
|
||||||
eid = self.stack.value.fetchUidByName(minion)
|
uid = self.stack.value.fetchUidByName(minion)
|
||||||
if eid:
|
if uid:
|
||||||
route = {
|
route = {
|
||||||
'dst': (minion, None, 'fun'),
|
'dst': (minion, None, 'fun'),
|
||||||
'src': (self.stack.value.local.name, None, None)}
|
'src': (self.stack.value.local.name, None, None)}
|
||||||
msg = {'route': route, 'pub': pub_data['pub']}
|
msg = {'route': route, 'pub': pub_data['pub']}
|
||||||
self.stack.value.message(msg, eid)
|
self.stack.value.message(msg, uid)
|
||||||
|
|
||||||
def action(self):
|
def action(self):
|
||||||
'''
|
'''
|
||||||
@ -943,8 +946,8 @@ class NixExecutor(ioflo.base.deeding.Deed):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
mid = self.opts['id']
|
mid = self.opts['id']
|
||||||
yid = nacling.uuid(size=18)
|
uid = nacling.uuid(size=18)
|
||||||
name = 'jobber' + yid
|
name = 'jobber' + uid
|
||||||
stack = LaneStack(
|
stack = LaneStack(
|
||||||
name=name,
|
name=name,
|
||||||
lanename=mid,
|
lanename=mid,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
house master
|
house master
|
||||||
|
|
||||||
init .raet.udp.stack.local to eid 1 main true name "master"
|
init .raet.udp.stack.local to main true name "master"
|
||||||
|
|
||||||
init .salt.uxd.stack.local to yid 0 name "master" lanename "master"
|
init .salt.uxd.stack.local to yid 0 name "master" lanename "master"
|
||||||
|
|
||||||
|
@ -118,12 +118,12 @@ class WorkerSetup(ioflo.base.deeding.Deed):
|
|||||||
self.stack.value = LaneStack(
|
self.stack.value = LaneStack(
|
||||||
name=name,
|
name=name,
|
||||||
lanename=lanename,
|
lanename=lanename,
|
||||||
yid=self.yid.value,
|
uid=self.yid.value,
|
||||||
sockdirpath=self.opts.value['sock_dir'])
|
sockdirpath=self.opts.value['sock_dir'])
|
||||||
self.stack.value.Pk = raeting.packKinds.pack
|
self.stack.value.Pk = raeting.packKinds.pack
|
||||||
manor_yard = RemoteYard(
|
manor_yard = RemoteYard(
|
||||||
stack=self.stack.value,
|
stack=self.stack.value,
|
||||||
yid=0,
|
uid=0,
|
||||||
name='manor',
|
name='manor',
|
||||||
lanename=lanename,
|
lanename=lanename,
|
||||||
dirpath=self.opts.value['sock_dir'])
|
dirpath=self.opts.value['sock_dir'])
|
||||||
|
@ -35,12 +35,16 @@ class SaltKeep(Keep):
|
|||||||
estate.name.ext
|
estate.name.ext
|
||||||
estate.name.ext
|
estate.name.ext
|
||||||
'''
|
'''
|
||||||
LocalFields = ['uid', 'name', 'ha', 'main', 'sid', 'neid', 'sighex', 'prihex', 'auto', 'role']
|
LocalFields = ['name', 'uid', 'ha', 'iha', 'natted', 'fqdn', 'dyned', 'sid',
|
||||||
LocalDumpFields = ['uid', 'name', 'ha', 'main', 'sid', 'neid', 'role']
|
'puid', 'aha', 'role', 'sighex','prihex']
|
||||||
RemoteFields = ['uid', 'name', 'ha', 'sid', 'joined', 'acceptance', 'verhex', 'pubhex', 'role']
|
LocalDumpFields = ['name', 'uid', 'ha', 'iha', 'natted', 'fqdn', 'dyned', 'sid',
|
||||||
RemoteDumpFields = ['uid', 'name', 'ha', 'sid', 'joined', 'role']
|
'puid', 'aha', 'role']
|
||||||
|
RemoteFields = ['name', 'uid', 'fuid', 'ha', 'iha', 'natted', 'fqdn', 'dyned',
|
||||||
Auto = False #auto accept
|
'sid', 'main', 'application', 'joined',
|
||||||
|
'role', 'acceptance', 'verhex', 'pubhex']
|
||||||
|
RemoteDumpFields = ['name', 'uid', 'fuid', 'ha', 'iha', 'natted', 'fqdn', 'dyned',
|
||||||
|
'sid', 'main', 'application', 'joined', 'role']
|
||||||
|
Auto = raeting.autoModes.never #auto accept
|
||||||
|
|
||||||
def __init__(self, opts, prefix='estate', basedirpath='', auto=None, **kwa):
|
def __init__(self, opts, prefix='estate', basedirpath='', auto=None, **kwa):
|
||||||
'''
|
'''
|
||||||
@ -48,23 +52,51 @@ class SaltKeep(Keep):
|
|||||||
'''
|
'''
|
||||||
basedirpath = basedirpath or os.path.join(opts['cache_dir'], 'raet')
|
basedirpath = basedirpath or os.path.join(opts['cache_dir'], 'raet')
|
||||||
super(SaltKeep, self).__init__(prefix=prefix, basedirpath=basedirpath, **kwa)
|
super(SaltKeep, self).__init__(prefix=prefix, basedirpath=basedirpath, **kwa)
|
||||||
self.auto = auto if auto is not None else opts['auto_accept']
|
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)))
|
||||||
self.saltRaetKey = RaetKey(opts)
|
self.saltRaetKey = RaetKey(opts)
|
||||||
|
|
||||||
|
def clearAllDir(self):
|
||||||
|
'''
|
||||||
|
Clear all keep directories
|
||||||
|
'''
|
||||||
|
super(SaltKeep, self).clearAllDir()
|
||||||
|
self.clearRoleDir()
|
||||||
|
|
||||||
|
def clearRoleDir(self):
|
||||||
|
'''
|
||||||
|
Clear the Role directory
|
||||||
|
'''
|
||||||
|
self.saltRaetKey.delete_pki_dir()
|
||||||
|
|
||||||
def loadLocalData(self):
|
def loadLocalData(self):
|
||||||
'''
|
'''
|
||||||
Load and Return the data from the local estate
|
Load and Return the data from the local estate
|
||||||
'''
|
'''
|
||||||
|
|
||||||
data = super(SaltKeep, self).loadLocalData()
|
data = super(SaltKeep, self).loadLocalData()
|
||||||
if not data:
|
if not data:
|
||||||
return None
|
return None
|
||||||
srkdata = self.saltRaetKey.read_local()
|
srkdata = self.saltRaetKey.read_local()
|
||||||
if not srkdata:
|
if not srkdata:
|
||||||
srkdata = dict(sign=None, priv=None)
|
srkdata = dict(sign=None, priv=None)
|
||||||
data.update(sighex=srkdata['sign'], prihex=srkdata['priv'], auto=self.auto)
|
data.update([('sighex', srkdata['sign']),
|
||||||
|
('prihex', srkdata['priv'])])
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def clearLocalRoleData(self):
|
||||||
|
'''
|
||||||
|
Clear the local file
|
||||||
|
'''
|
||||||
|
self.saltRaetKey.delete_local()
|
||||||
|
|
||||||
|
def clearLocalRoleDir(self):
|
||||||
|
'''
|
||||||
|
Clear the Local Role directory
|
||||||
|
'''
|
||||||
|
self.saltRaetKey.delete_pki_dir()
|
||||||
|
|
||||||
def loadRemoteData(self, name):
|
def loadRemoteData(self, name):
|
||||||
'''
|
'''
|
||||||
Load and Return the data from the remote file
|
Load and Return the data from the remote file
|
||||||
@ -81,8 +113,10 @@ class SaltKeep(Keep):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if not keydata:
|
if not keydata:
|
||||||
return None
|
data.update([('acceptance', None),
|
||||||
|
('verhex', None),
|
||||||
|
('pubhex', None)])
|
||||||
|
else:
|
||||||
data.update(acceptance=raeting.ACCEPTANCES[status],
|
data.update(acceptance=raeting.ACCEPTANCES[status],
|
||||||
verhex=keydata['verify'],
|
verhex=keydata['verify'],
|
||||||
pubhex=keydata['pub'])
|
pubhex=keydata['pub'])
|
||||||
@ -94,6 +128,10 @@ class SaltKeep(Keep):
|
|||||||
Load and Return the data from the all the remote estate files
|
Load and Return the data from the all the remote estate files
|
||||||
'''
|
'''
|
||||||
keeps = super(SaltKeep, self).loadAllRemoteData()
|
keeps = super(SaltKeep, self).loadAllRemoteData()
|
||||||
|
for name, data in keeps.items():
|
||||||
|
keeps[name].update([('acceptance', None),
|
||||||
|
('verhex', None),
|
||||||
|
('pubhex', None)])
|
||||||
|
|
||||||
for status, mids in self.saltRaetKey.list_keys().items():
|
for status, mids in self.saltRaetKey.list_keys().items():
|
||||||
for mid in mids:
|
for mid in mids:
|
||||||
@ -101,29 +139,45 @@ class SaltKeep(Keep):
|
|||||||
if keydata:
|
if keydata:
|
||||||
for name, data in keeps.items():
|
for name, data in keeps.items():
|
||||||
if data['role'] == mid:
|
if data['role'] == mid:
|
||||||
keeps[name].update(acceptance=raeting.ACCEPTANCES[status],
|
keeps[name].update(
|
||||||
verhex=keydata['verify'],
|
[('acceptance', raeting.ACCEPTANCES[status]),
|
||||||
pubhex=keydata['pub'])
|
('verhex', keydata['verify']),
|
||||||
|
('pubhex', keydata['pub'])])
|
||||||
return keeps
|
return keeps
|
||||||
|
|
||||||
def clearAllRemoteData(self):
|
def clearRemoteRoleData(self, role):
|
||||||
'''
|
'''
|
||||||
Remove all the remote estate files
|
Clear data from the role data file
|
||||||
|
'''
|
||||||
|
self.saltRaetKey.delete_key(role) #now delete role key file
|
||||||
|
|
||||||
|
def clearAllRemoteRoleData(self):
|
||||||
|
'''
|
||||||
|
Remove all the role data files
|
||||||
'''
|
'''
|
||||||
super(SaltKeep, self).clearAllRemoteData()
|
|
||||||
self.saltRaetKey.delete_all()
|
self.saltRaetKey.delete_all()
|
||||||
|
|
||||||
|
def clearRemoteRoleDir(self):
|
||||||
|
'''
|
||||||
|
Clear the Remote Role directory
|
||||||
|
'''
|
||||||
|
self.saltRaetKey.delete_pki_dir()
|
||||||
|
|
||||||
def dumpLocal(self, local):
|
def dumpLocal(self, local):
|
||||||
'''
|
'''
|
||||||
Dump local estate
|
Dump local estate
|
||||||
'''
|
'''
|
||||||
data = odict([
|
data = odict([
|
||||||
('uid', local.uid),
|
|
||||||
('name', local.name),
|
('name', local.name),
|
||||||
|
('uid', local.uid),
|
||||||
('ha', local.ha),
|
('ha', local.ha),
|
||||||
('main', local.main),
|
('iha', local.iha),
|
||||||
|
('natted', local.natted),
|
||||||
|
('fqdn', local.fqdn),
|
||||||
|
('dyned', local.dyned),
|
||||||
('sid', local.sid),
|
('sid', local.sid),
|
||||||
('neid', local.neid),
|
('puid', local.stack.puid),
|
||||||
|
('aha', local.stack.aha),
|
||||||
('role', local.role),
|
('role', local.role),
|
||||||
])
|
])
|
||||||
if self.verifyLocalData(data, localFields =self.LocalDumpFields):
|
if self.verifyLocalData(data, localFields =self.LocalDumpFields):
|
||||||
@ -136,53 +190,59 @@ class SaltKeep(Keep):
|
|||||||
Dump remote estate
|
Dump remote estate
|
||||||
'''
|
'''
|
||||||
data = odict([
|
data = odict([
|
||||||
('uid', remote.uid),
|
|
||||||
('name', remote.name),
|
('name', remote.name),
|
||||||
|
('uid', remote.uid),
|
||||||
|
('fuid', remote.fuid),
|
||||||
('ha', remote.ha),
|
('ha', remote.ha),
|
||||||
|
('iha', remote.iha),
|
||||||
|
('natted', remote.natted),
|
||||||
|
('fqdn', remote.fqdn),
|
||||||
|
('dyned', remote.dyned),
|
||||||
('sid', remote.sid),
|
('sid', remote.sid),
|
||||||
|
('main', remote.main),
|
||||||
|
('application', remote.application),
|
||||||
('joined', remote.joined),
|
('joined', remote.joined),
|
||||||
('role', remote.role),
|
('role', remote.role),
|
||||||
])
|
])
|
||||||
if self.verifyRemoteData(data, remoteFields=self.RemoteDumpFields):
|
if self.verifyRemoteData(data, remoteFields=self.RemoteDumpFields):
|
||||||
self.dumpRemoteData(data, remote.name)
|
self.dumpRemoteData(data, remote.name)
|
||||||
|
|
||||||
|
if remote.pubber.keyhex and remote.verfer.keyhex:
|
||||||
|
# kludge to persist the keys since no way to write
|
||||||
self.saltRaetKey.status(remote.role,
|
self.saltRaetKey.status(remote.role,
|
||||||
remote.pubber.keyhex,
|
remote.pubber.keyhex,
|
||||||
remote.verfer.keyhex)
|
remote.verfer.keyhex)
|
||||||
|
|
||||||
|
def statusRemote(self, remote, dump=True):
|
||||||
|
'''
|
||||||
|
Calls .statusRole on remote role and keys and updates remote.acceptance
|
||||||
|
dump indicates if statusRole should update persisted values when
|
||||||
|
appropriate.
|
||||||
|
|
||||||
def replaceRemoteRole(self, remote, old):
|
Returns status
|
||||||
|
Where status is acceptance status of role and keys
|
||||||
|
and has value from raeting.acceptances
|
||||||
'''
|
'''
|
||||||
Replace the Salt RaetKey record at old role when remote.role has changed
|
status = self.statusRole(role=remote.role,
|
||||||
'''
|
verhex=remote.verfer.keyhex,
|
||||||
new = remote.role
|
pubhex=remote.pubber.keyhex,
|
||||||
if new != old:
|
dump=dump)
|
||||||
#self.dumpRemote(remote)
|
|
||||||
# manually fix up acceptance if not pending
|
|
||||||
# will be pending by default unless autoaccept
|
|
||||||
if remote.acceptance == raeting.acceptances.accepted:
|
|
||||||
self.acceptRemote(remote)
|
|
||||||
elif remote.acceptance == raeting.acceptances.rejected:
|
|
||||||
self.rejectRemote(remote)
|
|
||||||
|
|
||||||
self.saltRaetKey.delete_key(old) #now delete old key file
|
remote.acceptance = status
|
||||||
|
|
||||||
def statusRemote(self, remote, verhex, pubhex, main=True, dump=True):
|
return status
|
||||||
|
|
||||||
|
def statusRole(self, role, verhex, pubhex, dump=True):
|
||||||
'''
|
'''
|
||||||
Evaluate acceptance status of remote estate per its keys
|
Returns status
|
||||||
persist key data differentially based on status
|
|
||||||
|
Where status is acceptance status of role and keys
|
||||||
|
and has value from raeting.acceptances
|
||||||
'''
|
'''
|
||||||
status = raeting.ACCEPTANCES[self.saltRaetKey.status(remote.role,
|
status = raeting.ACCEPTANCES[self.saltRaetKey.status(role,
|
||||||
pubhex,
|
pubhex,
|
||||||
verhex)]
|
verhex)]
|
||||||
|
|
||||||
if status != raeting.acceptances.rejected:
|
|
||||||
if (verhex and verhex != remote.verfer.keyhex):
|
|
||||||
remote.verfer = nacling.Verifier(verhex)
|
|
||||||
if (pubhex and pubhex != remote.pubber.keyhex):
|
|
||||||
remote.pubber = nacling.Publican(pubhex)
|
|
||||||
remote.acceptance = status
|
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def rejectRemote(self, remote):
|
def rejectRemote(self, remote):
|
||||||
@ -206,12 +266,3 @@ class SaltKeep(Keep):
|
|||||||
mid = remote.role
|
mid = remote.role
|
||||||
self.saltRaetKey.accept(match=mid, include_rejected=True)
|
self.saltRaetKey.accept(match=mid, include_rejected=True)
|
||||||
remote.acceptance = raeting.acceptances.accepted
|
remote.acceptance = raeting.acceptances.accepted
|
||||||
|
|
||||||
def clearAllKeep(dirpath):
|
|
||||||
'''
|
|
||||||
Convenience function to clear all road keep data in dirpath
|
|
||||||
'''
|
|
||||||
road = RoadKeep(dirpath=dirpath)
|
|
||||||
road.clearLocalData()
|
|
||||||
road.clearAllRemoteData()
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
house master
|
house master
|
||||||
|
|
||||||
init .raet.udp.stack.local to eid 1 name "master" host "" port 7530 main true
|
init .raet.udp.stack.local to name "master" host "" port 7530 main true
|
||||||
#init port in .raet.udp.stack.local from value in .salt.etc.raet_port
|
#init port in .raet.udp.stack.local from value in .salt.etc.raet_port
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
house minion
|
house minion
|
||||||
|
|
||||||
init .raet.udp.stack.local to eid 0 name "minion" host "" port 7531 main false
|
init .raet.udp.stack.local to name "minion" host "" port 7531 main false
|
||||||
#init port in .raet.udp.stack.local from value in .salt.etc.raet_port
|
#init port in .raet.udp.stack.local from value in .salt.etc.raet_port
|
||||||
|
|
||||||
#init .salt.etc.master to "127.0.0.1"
|
#init .salt.etc.master to "127.0.0.1"
|
||||||
@ -12,7 +12,8 @@ init .raet.udp.stack.local to eid 0 name "minion" host "" port 7531 main false
|
|||||||
|
|
||||||
framer minionudpstack be active first start
|
framer minionudpstack be active first start
|
||||||
frame start
|
frame start
|
||||||
do salt raet road stack per inode ".raet.udp.stack"
|
enter
|
||||||
|
do salt raet road stack setup per inode ".raet.udp.stack"
|
||||||
exit
|
exit
|
||||||
do salt raet road stack closer per inode ".raet.udp.stack."
|
do salt raet road stack closer per inode ".raet.udp.stack."
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
17
salt/key.py
17
salt/key.py
@ -1231,3 +1231,20 @@ class RaetKey(Key):
|
|||||||
fp_.write(self.serial.dumps(keydata))
|
fp_.write(self.serial.dumps(keydata))
|
||||||
os.chmod(path, stat.S_IRUSR)
|
os.chmod(path, stat.S_IRUSR)
|
||||||
os.umask(c_umask)
|
os.umask(c_umask)
|
||||||
|
|
||||||
|
def delete_local(self):
|
||||||
|
'''
|
||||||
|
Delete the local private key file
|
||||||
|
'''
|
||||||
|
path = os.path.join(self.opts['pki_dir'], 'local.key')
|
||||||
|
if os.path.isfile(path):
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
def delete_pki_dir(self):
|
||||||
|
'''
|
||||||
|
Delete the private key directory
|
||||||
|
'''
|
||||||
|
path = self.opts['pki_dir']
|
||||||
|
if os.path.exists(path):
|
||||||
|
#os.rmdir(path)
|
||||||
|
shutil.rmtree(path)
|
||||||
|
@ -72,8 +72,8 @@ class RAETChannel(Channel):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
mid = self.opts.get('id', 'master')
|
mid = self.opts.get('id', 'master')
|
||||||
yid = nacling.uuid(size=18)
|
uid = nacling.uuid(size=18)
|
||||||
name = 'channel' + yid
|
name = 'channel' + uid
|
||||||
stack = LaneStack(name=name,
|
stack = LaneStack(name=name,
|
||||||
lanename=mid,
|
lanename=mid,
|
||||||
sockdirpath=self.opts['sock_dir'])
|
sockdirpath=self.opts['sock_dir'])
|
||||||
@ -96,7 +96,7 @@ class RAETChannel(Channel):
|
|||||||
self.stack = jobber_stack
|
self.stack = jobber_stack
|
||||||
else:
|
else:
|
||||||
self.stack = jobber_stack = self._setup_stack()
|
self.stack = jobber_stack = self._setup_stack()
|
||||||
log.debug("Using Jobber Stack at = {0}\n".format(self.stack.local.ha))
|
log.debug("Using Jobber Stack at = {0}\n".format(self.stack.ha))
|
||||||
|
|
||||||
def crypted_transfer_decode_dictentry(self, load, dictkey=None, tries=3, timeout=60):
|
def crypted_transfer_decode_dictentry(self, load, dictkey=None, tries=3, timeout=60):
|
||||||
'''
|
'''
|
||||||
|
@ -47,14 +47,14 @@ class SaltEvent(object):
|
|||||||
self.connected = False
|
self.connected = False
|
||||||
self.stack = LaneStack(
|
self.stack = LaneStack(
|
||||||
name=name,
|
name=name,
|
||||||
yid=self.yid,
|
uid=self.yid,
|
||||||
lanename=self.node,
|
lanename=self.node,
|
||||||
sockdirpath=self.sock_dir)
|
sockdirpath=self.sock_dir)
|
||||||
self.stack.Pk = raeting.packKinds.pack
|
self.stack.Pk = raeting.packKinds.pack
|
||||||
self.router_yard = RemoteYard(
|
self.router_yard = RemoteYard(
|
||||||
stack=self.stack,
|
stack=self.stack,
|
||||||
lanename=self.node,
|
lanename=self.node,
|
||||||
yid=0,
|
uid=0,
|
||||||
name='manor',
|
name='manor',
|
||||||
dirpath=self.sock_dir)
|
dirpath=self.sock_dir)
|
||||||
self.stack.addRemote(self.router_yard)
|
self.stack.addRemote(self.router_yard)
|
||||||
|
Loading…
Reference in New Issue
Block a user