saltstack / saltstack/salt

chattr in file.managed applied at the wrong time

Open
#55,489 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

when using file.managed, an immutable file causes an error.
When using attrs: "" - that removes immutable, but only AFTER the content change (that fails, immutable is never removed)

Setup

echo "aa" > /somefile
chattr +i /somefile

Steps to Reproduce Issue

state:
some file:
file.managed:
- name: /somefile
- attr: ""
- content: "xx"

salt runs with: Failed to commit change: [Errno 1] Operation not permitted
if the file content is ok, immutable flag gets properly removed

Versions Report

Salt Version:
Salt: 2018.3.4

Dependency Versions:
cffi: 1.6.0
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: 0.26.3
libnacl: Not Installed
M2Crypto: 0.28.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: 1.2.5
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.26.4
Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 4.15.0-54-generic
system: Linux
version: CentOS Linux 7.6.1810 Core

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 at the file.managed state handling for the attr and content options, then reproduce the issue with an immutable /somefile using the Salt state shown. Done means the immutable attribute is removed before the content update so the state completes without the operation-not-permitted error, while the attribute is correctly cleared.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.