mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
add simplify code
This commit is contained in:
parent
aec9385c6b
commit
b8214824fd
2 changed files with 12 additions and 15 deletions
|
@ -3288,7 +3288,6 @@ def api_config(path):
|
|||
return opts
|
||||
|
||||
|
||||
|
||||
def spm_config(path):
|
||||
'''
|
||||
Read in the salt master config file and add additional configs that
|
||||
|
|
|
@ -706,9 +706,9 @@ class ReqServer(SignalHandlingMultiprocessingProcess):
|
|||
name = 'MWorker-{0}'.format(ind)
|
||||
self.process_manager.add_process(MWorker,
|
||||
args=(self.opts,
|
||||
self.master_key,
|
||||
self.key,
|
||||
req_channels,
|
||||
self.master_key,
|
||||
name
|
||||
),
|
||||
kwargs=kwargs,
|
||||
|
@ -750,10 +750,10 @@ class MWorker(SignalHandlingMultiprocessingProcess):
|
|||
'''
|
||||
def __init__(self,
|
||||
opts,
|
||||
mkey,
|
||||
key,
|
||||
req_channels,
|
||||
name,
|
||||
req_channels=None,
|
||||
mkey=None,
|
||||
name=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Create a salt master worker process
|
||||
|
@ -765,8 +765,10 @@ class MWorker(SignalHandlingMultiprocessingProcess):
|
|||
:rtype: MWorker
|
||||
:return: Master worker
|
||||
'''
|
||||
kwargs['name'] = name
|
||||
SignalHandlingMultiprocessingProcess.__init__(self, **kwargs)
|
||||
if name:
|
||||
kwargs['name'] = name
|
||||
super(MWorker, self).__init__(**kwargs)
|
||||
self.kwargs = kwargs
|
||||
self.opts = opts
|
||||
self.req_channels = req_channels
|
||||
|
||||
|
@ -781,22 +783,18 @@ class MWorker(SignalHandlingMultiprocessingProcess):
|
|||
# non-Windows platforms.
|
||||
def __setstate__(self, state):
|
||||
self._is_child = True
|
||||
SignalHandlingMultiprocessingProcess.__init__(self, log_queue=state['log_queue'])
|
||||
self.opts = state['opts']
|
||||
self.req_channels = state['req_channels']
|
||||
self.mkey = state['mkey']
|
||||
self.key = state['key']
|
||||
super(MWorker, self).__init__(**state)
|
||||
self.k_mtime = state['k_mtime']
|
||||
SMaster.secrets = state['secrets']
|
||||
|
||||
def __getstate__(self):
|
||||
return {'opts': self.opts,
|
||||
'key': self.key,
|
||||
'req_channels': self.req_channels,
|
||||
'mkey': self.mkey,
|
||||
'key': self.key,
|
||||
'k_mtime': self.k_mtime,
|
||||
'log_queue': self.log_queue,
|
||||
'secrets': SMaster.secrets}
|
||||
'secrets': SMaster.secrets,
|
||||
'kwargs': self.kwargs}
|
||||
|
||||
def _handle_signals(self, signum, sigframe):
|
||||
for channel in getattr(self, 'req_channels', ()):
|
||||
|
|
Loading…
Add table
Reference in a new issue