Skip to content

Commit

Permalink
Do not overwrite master keys
Browse files Browse the repository at this point in the history
salt-api should not overwrite the master's keys when it starts up. Give
salt-api it's own cache directory and set of keys.
  • Loading branch information
dwoz committed Sep 22, 2020
1 parent a64fdab commit 2589408
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions salt/netapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ class NetapiClient(object):

def __init__(self, opts):
self.opts = opts
self.loadauth = salt.auth.LoadAuth(opts)
self.key = salt.daemons.masterapi.access_keys(self.opts)
minopts = copy.deepcopy(self.opts)
minopts["enable_ssh_minions"] = True
self.ckminions = salt.utils.minions.CkMinions(minopts)
apiopts = copy.deepcopy(self.opts)
apiopts["enable_ssh_minions"] = True
apiopts["cachedir"] = os.path.join(opts["cachedir"], "saltapi")
if not os.path.exists(apiopts["cachedir"]):
os.makedirs(apiopts["cachedir"])
self.resolver = salt.auth.Resolver(apiopts)
self.loadauth = salt.auth.LoadAuth(apiopts)
self.key = salt.daemons.masterapi.access_keys(apiopts)
self.ckminions = salt.utils.minions.CkMinions(apiopts)

def _is_master_running(self):
"""
Expand Down

0 comments on commit 2589408

Please sign in to comment.