Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _register_functions():
"""
Iterate through the exposed Testinfra modules, convert them to salt
functions, and then register them in the module namespace so that they
can be called via salt.
"""
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(mod_name)
mod_func = _copy_function(mod_name, str(mod_name))
mod_func.__doc__ = _build_doc(mod_name)
__all__.append(mod_name)
globals()[mod_name] = mod_func
def _generate_functions():
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',
module_name, func_name)
globals()[module_name] = _wrap_module_function(func_name)
def __getattr__(self, name):
if name in testinfra.modules.modules:
module_class = testinfra.modules.get_module_class(name)
obj = module_class.get_module(self)
setattr(self, name, obj)
return obj
raise AttributeError("'{}' object has no attribute '{}'".format(
self.__class__.__name__, name))
def _register_functions():
"""
Iterate through the exposed Testinfra modules, convert them to salt
functions, and then register them in the module namespace so that they
can be called via salt.
"""
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(mod_name)
mod_func = _copy_function(mod_name, str(mod_name))
mod_func.__doc__ = _build_doc(mod_name)
__all__.append(mod_name)
globals()[mod_name] = mod_func
def __getattr__(self, name):
if name in testinfra.modules.modules:
module_class = testinfra.modules.get_module_class(name)
obj = module_class.get_module(self)
setattr(self, name, obj)
return obj
raise AttributeError("'{}' object has no attribute '{}'".format(
self.__class__.__name__, name))
def _generate_functions():
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',
module_name, func_name)
globals()[module_name] = _wrap_module_function(func_name)