mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Updated testinfra modules to work with more recent versions
The TestInfra library changed the package layout recently which caused the extension module to stop working. This patch addresses those updates and will work across all versions of the library.
This commit is contained in:
parent
a88386ad44
commit
ea4d7f4176
@ -285,13 +285,17 @@ def _register_functions():
|
||||
functions, and then register them in the module namespace so that they
|
||||
can be called via salt.
|
||||
"""
|
||||
for module_ in modules.__all__:
|
||||
try:
|
||||
modules_ = [_to_snake_case(module_) for module_ in modules.__all__]
|
||||
except AttributeError:
|
||||
modules_ = [module_ for module_ in modules.modules]
|
||||
|
||||
for mod_name in modules_:
|
||||
mod_name = _to_snake_case(module_)
|
||||
mod_func = _copy_function(mod_name, str(mod_name))
|
||||
mod_func.__doc__ = _build_doc(module_)
|
||||
mod_func.__doc__ = _build_doc(mod_name)
|
||||
__all__.append(mod_name)
|
||||
globals()[mod_name] = mod_func
|
||||
|
||||
|
||||
if TESTINFRA_PRESENT:
|
||||
_register_functions()
|
||||
|
@ -52,8 +52,12 @@ def _to_snake_case(pascal_case):
|
||||
|
||||
|
||||
def _generate_functions():
|
||||
for module in modules.__all__:
|
||||
module_name = _to_snake_case(module)
|
||||
try:
|
||||
modules_ = [_to_snake_case(module_) for module_ in modules.__all__]
|
||||
except AttributeError:
|
||||
modules_ = [module_ for module_ in modules.modules]
|
||||
|
||||
for module_name in modules_:
|
||||
func_name = 'testinfra.{0}'.format(module_name)
|
||||
__all__.append(module_name)
|
||||
log.debug('Generating state for module %s as function %s',
|
||||
|
Loading…
Reference in New Issue
Block a user