view all_operations.py @ 332:d4893670f888 default tip

WIP: use watchdog reboot timer on pi
author drewp@bigasterisk.com
date Thu, 27 Feb 2025 11:09:29 -0800
parents 5b88b38f2471
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()