File locking for minion.d/grains.conf [BUG]
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
An organization using Salt inadvertently created a scenario where the running minion could execute state updates minion.d/grains.conf, while concurrently (via cron) salt-call is invoked to set other grain data. The result was a corrupted minion.d/grains.conf
Setup
Basic master/minion setup.
Steps to Reproduce the behavior
Create state with grains.present. While executing that state, invoke salt-call grains.setval foo bar. This is based on an odd race condition that was described to me during a customer call.
Expected behavior
It would be a nice improvement if file locking was added to grains functions that modify grains.conf.
Screenshots
N/A
Versions Report
All versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the grains.present state and salt-call grains.setval operations described in the reproduction, focusing on their concurrent updates to minion.d/grains.conf. Reproduce the race, then verify that concurrent grain changes no longer corrupt the file and that its contents remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100