File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313def update_pools (inventory : dict ) -> None :
1414 """Updates hosts in pool(s).
1515
16- .. note:: Host must be a master
16+ .. note::
1717
18- Every non-master hosts will be ignored
18+ Every non-master hosts in inventory will be ignored
19+
20+ *Update master hosts declared in inventory first, then, update secondary hosts attached to each master.*
1921
2022 :param dict inventory:
2123 Each host (key) holds its own config data (values, eg: `enablerepos`).
@@ -33,3 +35,12 @@ def update_pools(inventory: dict) -> None:
3335 with ThreadPoolExecutor () as executor :
3436 for p in pools :
3537 executor .submit (p .master .update , inventory [p .master .hostname_or_ip ]["enablerepos" ])
38+
39+ # secondary hosts
40+ with ThreadPoolExecutor () as executor :
41+ for p in pools :
42+ # omit first item because it is a primary (master)
43+ for h in p .hosts [1 :]:
44+ # repos are the same as the primary (master)
45+ repos = inventory [p .master .hostname_or_ip ]["enablerepos" ]
46+ executor .submit (h .update , repos )
You can’t perform that action at this time.
0 commit comments