mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Only generate one pair of minion keys for the swarm
This commit is contained in:
parent
2c911f5806
commit
c29d1d6076
@ -64,8 +64,19 @@ class Swarm(object):
|
||||
'''
|
||||
def __init__(self, opts):
|
||||
self.opts = opts
|
||||
self.pki = self._pki_dir()
|
||||
self.confs = set()
|
||||
|
||||
def _pki_dir(self):
|
||||
'''
|
||||
Create the shared pki directory
|
||||
'''
|
||||
path = tempfile.mkdtemp()
|
||||
cmd = 'salt-key --gen-keys minion --gen-keys-dir {0}'.format(path)
|
||||
print('Creating shared pki keys for the swarm')
|
||||
subprocess.call(cmd, shell=True)
|
||||
return path
|
||||
|
||||
def mkconf(self):
|
||||
'''
|
||||
Create a config file for a single minion
|
||||
@ -78,7 +89,7 @@ class Swarm(object):
|
||||
dpath = '{0}.d'.format(path)
|
||||
os.makedirs(dpath)
|
||||
data = {'id': os.path.basename(path),
|
||||
'pki_dir': os.path.join(dpath, 'pki'),
|
||||
'pki_dir': self.pki,
|
||||
'cachedir': os.path.join(dpath, 'cache'),
|
||||
'master': self.opts['master'],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user