aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/molecule/default/tests/test_lineinfile_strategy.py
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-07-21 19:10:19 +0200
committerColin Wilk <colin@wilk.cx>2026-07-21 19:11:08 +0200
commit0055971afd5524f0df00fc8d2203a80f828885f7 (patch)
tree23019217d6a692aa83a5b09ede12bb3ebbc9da69 /molecule/default/tests/test_lineinfile_strategy.py
parentd9b5c59a50ac9967dc365f2c8586869d6ef5d9bd (diff)
downloadansible-role-prometheus-target-0055971afd5524f0df00fc8d2203a80f828885f7.tar.gz
ansible-role-prometheus-target-0055971afd5524f0df00fc8d2203a80f828885f7.zip
fix: prevent lost YAML targets during parallel writes
The YAML strategy performed a separate read-modify-write operation for every managed host. Because these tasks were delegated to the same Prometheus host, parallel Ansible forks could read the same original file before any fork wrote its update. Each fork then generated YAML containing only its own target. Although the copy module atomically replaced the file, it did not make the full read-modify-write sequence atomic. The last fork to write therefore overwrote targets added by earlier forks. Collect exporter updates from all hosts through hostvars, process them in one run_once operation, and write each distinct target file once. This preserves every target without requiring users to set serial. Add parallel coverage for multiple target files and label groups, and reset the fixtures on every convergence so stale files cannot hide the race.
Diffstat (limited to 'molecule/default/tests/test_lineinfile_strategy.py')
0 files changed, 0 insertions, 0 deletions