mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
initial commit for minion swarm to work with raet
This skips the single keygen that zeromq transport uses because 1. Key gen is not exposed to salt-key yet for raet 2. raet keys are super fast, so I don't think this will be an issue, but testing on a grander scale will tell us for sure
This commit is contained in:
parent
93c5e0ece2
commit
d8efa82b15
1 changed files with 17 additions and 9 deletions
|
@ -66,6 +66,10 @@ def parse():
|
|||
dest='root_dir',
|
||||
default=None,
|
||||
help='Override the minion root_dir config')
|
||||
parser.add_option('--transport',
|
||||
dest='transport',
|
||||
default='zeromq',
|
||||
help='Declare which transport to use, default is zeromq')
|
||||
parser.add_option(
|
||||
'-c', '--config-dir', default='/etc/salt',
|
||||
help=('Pass in an alternative configuration directory. Default: '
|
||||
|
@ -99,7 +103,8 @@ class Swarm(object):
|
|||
self.swarm_root = tempfile.mkdtemp(prefix='mswarm-root', suffix='.d',
|
||||
dir=tmpdir)
|
||||
|
||||
self.pki = self._pki_dir()
|
||||
if self.opts['transport'] == 'zeromq':
|
||||
self.pki = self._pki_dir()
|
||||
self.__zfill = len(str(self.opts['minions']))
|
||||
|
||||
self.confs = set()
|
||||
|
@ -133,22 +138,25 @@ class Swarm(object):
|
|||
dpath = os.path.join(self.swarm_root, minion_id)
|
||||
os.makedirs(dpath)
|
||||
|
||||
minion_pkidir = os.path.join(dpath, 'pki')
|
||||
os.makedirs(minion_pkidir)
|
||||
minion_pem = os.path.join(self.pki, 'minion.pem')
|
||||
minion_pub = os.path.join(self.pki, 'minion.pub')
|
||||
shutil.copy(minion_pem, minion_pkidir)
|
||||
shutil.copy(minion_pub, minion_pkidir)
|
||||
|
||||
data = {
|
||||
'id': minion_id,
|
||||
'user': self.opts['user'],
|
||||
'pki_dir': minion_pkidir,
|
||||
'cachedir': os.path.join(dpath, 'cache'),
|
||||
'master': self.opts['master'],
|
||||
'log_file': os.path.join(dpath, 'minion.log')
|
||||
}
|
||||
|
||||
if self.opts['transport'] == 'zeromq':
|
||||
minion_pkidir = os.path.join(dpath, 'pki')
|
||||
os.makedirs(minion_pkidir)
|
||||
minion_pem = os.path.join(self.pki, 'minion.pem')
|
||||
minion_pub = os.path.join(self.pki, 'minion.pub')
|
||||
shutil.copy(minion_pem, minion_pkidir)
|
||||
shutil.copy(minion_pub, minion_pkidir)
|
||||
data['pki_dir'] = minion_pkidir
|
||||
elif self.opts['transport'] == 'raet':
|
||||
data['transport'] = 'raet'
|
||||
|
||||
if self.opts['root_dir']:
|
||||
data['root_dir'] = self.opts['root_dir']
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue