Mercurial > code > home > repos > infra
view all_operations.py @ 326:5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
author | drewp@bigasterisk.com |
---|---|
date | Mon, 20 Jan 2025 21:55:08 -0800 |
parents | |
children |
line wrap: on
line source
import importlib import os from pyinfra.context import host def gatherFuncs(): for opGroup in [ 'users', 'system', 'apt', 'packages', 'net', 'dns', 'wireguard', 'kube', 'sync', 'mail', 'home', ]: if os.environ.get('GROUP') and opGroup != os.environ['GROUP']: continue mod = importlib.import_module(f'{opGroup}.{opGroup}') operations = getattr(mod, 'operations') for func in operations: funcFullName = f'{mod.__name__}.{func.__name__}.{host.name}' yield (funcFullName, func) funcs = list(gatherFuncs()) for name, func in funcs: func()