Skip to content

Commit 1ed5e52

Browse files
committed
update_pools: ignore secondary hosts on pool init
Signed-off-by: Olivier Hoareau <olivier.hoareau@vates.tech>
1 parent ac6d72e commit 1ed5e52

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/tools/tasks/update.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from concurrent.futures import ThreadPoolExecutor
66

77
from lib.host import Host
8-
from lib.pool import Pool
8+
from lib.pool import NotAMasterHostError, Pool
99

1010
from .. import logger
1111

@@ -14,14 +14,20 @@ def update_pools(inventory: dict) -> None:
1414
1515
.. note:: Host must be a master
1616
17-
Throws error if hosts are not master (primary).
17+
Every non-master hosts will be ignored
1818
1919
:param dict inventory:
2020
Each host (key) holds its own config data (values, eg: `enablerepos`).
2121
"""
2222
logger.debug(f"Inventory: {inventory}")
2323
# init related pools
24-
pools = [Pool(h) for h in inventory]
24+
pools = []
25+
for h in inventory:
26+
try:
27+
p = Pool(h)
28+
pools.append(p)
29+
except NotAMasterHostError:
30+
logger.warning(f"[{h}] Skipping: not a master host")
2531

2632
with ThreadPoolExecutor() as executor:
2733
for p in pools:

0 commit comments

Comments
 (0)