Skip to content

Commit 2814e95

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

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
@@ -4,7 +4,7 @@
44
"""
55
from concurrent.futures import ThreadPoolExecutor
66

7-
from lib.pool import Pool
7+
from lib.pool import NotAMasterHostError, Pool
88

99
from .. import logger
1010

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

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

0 commit comments

Comments
 (0)