Mercurial > code > home > repos > infra
diff system/system.py @ 331:50a8b6c39b38
don't err if all pis are commented out of inventory
author | drewp@bigasterisk.com |
---|---|
date | Sun, 23 Feb 2025 15:09:51 -0800 |
parents | 2bbcf00b8d2a |
children |
line wrap: on
line diff
--- a/system/system.py Sun Feb 23 15:09:29 2025 -0800 +++ b/system/system.py Sun Feb 23 15:09:51 2025 -0800 @@ -115,7 +115,13 @@ return iscsi_dir = '/d2/rpi-iscsi' - for pi_hostname in cast(list, pyinfra.inventory.get_group(name='pi')): + + try: + pis=pyinfra.inventory.get_group(name='pi') + except Exception as e: + print(f"no pi group, skipping {e!r}") + return + for pi_hostname in cast(list, pis): out = f'{iscsi_dir}/{pi_hostname}.disk' files.directory(path=iscsi_dir) server.shell(commands=f'dd if=/dev/zero of={out} count=0 bs=1 seek=10G conv=excl || true')