comparison 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
comparison
equal deleted inserted replaced
325:4d1b6a6e65d2 326:5b88b38f2471
1 import importlib
2 import os
3 from pyinfra.context import host
4
5
6 def gatherFuncs():
7 for opGroup in [
8 'users',
9 'system',
10 'apt',
11 'packages',
12 'net',
13 'dns',
14 'wireguard',
15 'kube',
16 'sync',
17 'mail',
18 'home',
19 ]:
20 if os.environ.get('GROUP') and opGroup != os.environ['GROUP']:
21 continue
22 mod = importlib.import_module(f'{opGroup}.{opGroup}')
23 operations = getattr(mod, 'operations')
24 for func in operations:
25 funcFullName = f'{mod.__name__}.{func.__name__}.{host.name}'
26 yield (funcFullName, func)
27
28
29 funcs = list(gatherFuncs())
30
31 for name, func in funcs:
32 func()