saltstack / saltstack/salt

File locking for minion.d/grains.conf [BUG]

Open
#58,411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.