chattr in file.managed applied at the wrong time
Nobody has claimed this yet.
- 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
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 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