PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/testinframod.py |
import logging from salt.utils.stringutils import camel_to_snake_case log = logging.getLogger(__name__) try: from testinfra import modules TESTINFRA_PRESENT = True except ImportError: TESTINFRA_PRESENT = False __all__ = [] __virtualname__ = "testinfra" def __virtual__(): if TESTINFRA_PRESENT: return __virtualname__ return False, "The Testinfra package is not available" def _wrap_module_function(func_name): def _module_function_wrapper(name, **methods): func = __salt__[func_name] result, passes, fails = func(name, **methods) comment = "\n".join(passes + fails) if __opts__["test"] and not result: result = None return {"name": name, "comment": comment, "result": result, "changes": {}} return _module_function_wrapper def _generate_functions(): try: modules_ = [camel_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 = f"testinfra.{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) if TESTINFRA_PRESENT: _generate_functions()