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