def __virtual__(): ''' Set the user module if the kernel is Linux ''' import sys if __grains__['kernel'] == 'Darwin': mod = sys.modules[__name__] for attr in dir(mod): if callable(getattr(mod, attr)): if not attr in ('getent', 'info', 'list_groups', '__virtual__'): delattr(mod, attr) return 'user' if __grains__['kernel'] in ('Linux', 'Darwin') else False
def __virtual__(): """ Set the user module if the kernel is Linux """ import sys if __grains__["kernel"] == "Darwin": mod = sys.modules[__name__] for attr in dir(mod): if callable(getattr(mod, attr)): if not attr in ("getent", "info", "list_groups", "__virtual__"): delattr(mod, attr) return "user" if __grains__["kernel"] in ("Linux", "Darwin") else False
def __virtual__(): ''' Set the user module if the kernel is Linux and remove some of the functionality on OS X ''' import sys from salt._compat import callable if __grains__['kernel'] == 'Darwin': mod = sys.modules[__name__] for attr in dir(mod): if callable(getattr(mod, attr)): if not attr in ('getent', 'info', 'list_groups', 'list_users', '__virtual__'): delattr(mod, attr) return 'user' if __grains__['kernel'] in ('Linux', 'Darwin') else False
def __virtual__(): ''' Set the user module if the kernel is Linux or OpenBSD and remove some of the functionality on OS X ''' import sys from salt._compat import callable if __grains__['kernel'] == 'Darwin': mod = sys.modules[__name__] for attr in dir(mod): if callable(getattr(mod, attr)): if not attr in ('_format_info', 'getent', 'info', 'list_groups', 'list_users', '__virtual__'): delattr(mod, attr) return 'user' if __grains__['kernel'] in ('Linux', 'Darwin', 'OpenBSD') else False