Renaming isolate to standalone

This commit is contained in:
Gareth J. Greenaway 2017-09-11 11:43:31 -07:00
parent 980d3f4a53
commit 54cb69edec

View File

@ -385,7 +385,7 @@ class Schedule(object):
''' '''
instance = None instance = None
def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, isolate=None): def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standalone=None):
''' '''
Only create one instance of Schedule Only create one instance of Schedule
''' '''
@ -395,26 +395,26 @@ class Schedule(object):
# it in a WeakValueDictionary-- which will remove the item if no one # it in a WeakValueDictionary-- which will remove the item if no one
# references it-- this forces a reference while we return to the caller # references it-- this forces a reference while we return to the caller
cls.instance = object.__new__(cls) cls.instance = object.__new__(cls)
cls.instance.__singleton_init__(opts, functions, returners, intervals, cleanup, proxy, isolate) cls.instance.__singleton_init__(opts, functions, returners, intervals, cleanup, proxy, standalone)
else: else:
log.debug('Re-using Schedule') log.debug('Re-using Schedule')
return cls.instance return cls.instance
# has to remain empty for singletons, since __init__ will *always* be called # has to remain empty for singletons, since __init__ will *always* be called
def __init__(self, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, isolate=None): def __init__(self, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standalone=None):
pass pass
# an init for the singleton instance to call # an init for the singleton instance to call
def __singleton_init__(self, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, isolate=None): def __singleton_init__(self, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standalone=None):
self.opts = opts self.opts = opts
self.proxy = proxy self.proxy = proxy
self.functions = functions self.functions = functions
self.isolate = isolate self.standalone = standalone
if isinstance(intervals, dict): if isinstance(intervals, dict):
self.intervals = intervals self.intervals = intervals
else: else:
self.intervals = {} self.intervals = {}
if not self.isolate: if not self.standalone:
if hasattr(returners, '__getitem__'): if hasattr(returners, '__getitem__'):
self.returners = returners self.returners = returners
else: else:
@ -423,7 +423,7 @@ class Schedule(object):
self.schedule_returner = self.option('schedule_returner') self.schedule_returner = self.option('schedule_returner')
# Keep track of the lowest loop interval needed in this variable # Keep track of the lowest loop interval needed in this variable
self.loop_interval = six.MAXSIZE self.loop_interval = six.MAXSIZE
if not self.isolate: if not self.standalone:
clean_proc_dir(opts) clean_proc_dir(opts)
if cleanup: if cleanup:
for prefix in cleanup: for prefix in cleanup:
@ -781,7 +781,7 @@ class Schedule(object):
salt.utils.appendproctitle('{0} {1}'.format(self.__class__.__name__, ret['jid'])) salt.utils.appendproctitle('{0} {1}'.format(self.__class__.__name__, ret['jid']))
if not self.isolate: if not self.standalone:
proc_fn = os.path.join( proc_fn = os.path.join(
salt.minion.get_proc_dir(self.opts['cachedir']), salt.minion.get_proc_dir(self.opts['cachedir']),
ret['jid'] ret['jid']
@ -824,7 +824,7 @@ class Schedule(object):
try: try:
ret['pid'] = os.getpid() ret['pid'] = os.getpid()
if not self.isolate: if not self.standalone:
if 'jid_include' not in data or data['jid_include']: if 'jid_include' not in data or data['jid_include']:
log.debug('schedule.handle_func: adding this job to the jobcache ' log.debug('schedule.handle_func: adding this job to the jobcache '
'with data {0}'.format(ret)) 'with data {0}'.format(ret))
@ -858,7 +858,7 @@ class Schedule(object):
ret['return'] = self.functions[func](*args, **kwargs) ret['return'] = self.functions[func](*args, **kwargs)
if not self.isolate: if not self.standalone:
# runners do not provide retcode # runners do not provide retcode
if 'retcode' in self.functions.pack['__context__']: if 'retcode' in self.functions.pack['__context__']:
ret['retcode'] = self.functions.pack['__context__']['retcode'] ret['retcode'] = self.functions.pack['__context__']['retcode']
@ -929,7 +929,7 @@ class Schedule(object):
except Exception as exc: except Exception as exc:
log.exception("Unhandled exception firing event: {0}".format(exc)) log.exception("Unhandled exception firing event: {0}".format(exc))
if not self.isolate: if not self.standalone:
log.debug('schedule.handle_func: Removing {0}'.format(proc_fn)) log.debug('schedule.handle_func: Removing {0}'.format(proc_fn))
try: try: