Merge pull request #20401 from jacksontj/2015.2

Misc backports to 2015.2
This commit is contained in:
Mike Place 2015-02-05 10:26:40 -07:00
commit 36efd43254
2 changed files with 28 additions and 12 deletions

View File

@ -268,19 +268,20 @@ class SyncClientMixin(object):
func_globals['__jid_event__'].fire_event(data, 'new')
# Inject some useful globals to *all* the funciton's global namespace
# only once per module-- not per func
completed_funcs = []
for mod_name, mod_func in self.functions.iteritems():
mod, _ = mod_name.split('.', 1)
if mod in completed_funcs:
continue
completed_funcs.append(mod)
for global_key, value in func_globals.iteritems():
self.functions[mod_name].func_globals[global_key] = value
try:
self._verify_fun(fun)
# Inject some useful globals to *all* the funciton's global namespace
# only once per module-- not per func
completed_funcs = []
for mod_name, mod_func in self.functions.iteritems():
mod, _ = mod_name.split('.', 1)
if mod in completed_funcs:
continue
completed_funcs.append(mod)
for global_key, value in func_globals.iteritems():
self.functions[mod_name].func_globals[global_key] = value
# There are some descrepencies of what a "low" structure is
# in the publisher world it is a dict including stuff such as jid,
# fun, arg (a list of args, with kwargs packed in). Historically

View File

@ -666,7 +666,7 @@ class Loader(object):
exc_info=True
)
return mod
except Exception:
except Exception as error:
log.error(
'Failed to import {0} {1}, this is due most likely to a '
'syntax error:\n'.format(
@ -675,6 +675,14 @@ class Loader(object):
exc_info=True
)
return mod
except SystemExit as error:
log.error(
'Failed to import {0} {1} as the module called exit()\n'.format(
self.tag, name
),
exc_info=True
)
return mod
if hasattr(mod, '__opts__'):
mod.__opts__.update(self.opts)
else:
@ -1019,7 +1027,7 @@ class Loader(object):
self.tag, name))
failed_loads[name] = path
continue
except Exception:
except Exception as error:
log.warning(
'Failed to import {0} {1}, this is due most likely to a '
'syntax error. Traceback raised:\n'.format(
@ -1027,6 +1035,13 @@ class Loader(object):
),
exc_info=True
)
except SystemExit as error:
log.warning(
'Failed to import {0} {1} as the module called exit()\n'.format(
self.tag, name
),
exc_info=True
)
continue
self.modules.append(mod)
load_names(names, failhard=False, initial_load=initial_load)