[BUG] xml.set_value removes xml header from file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
The command xml.set_value removes the xml version header from the resulting file. Is that by design?
Setup
Consider the file /tmp/set_value_test.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<key>
<default>true</default>
</key>
</two>
</one>
Current behavior
After running the command:
salt <host> xml.set_value /tmp/set_value_test.xml './/two/key/default' '"false"'
/tmp/set_value_test.xml contains the following:
<one>
<two>
<key>
<default>false</default>
</key>
</two>
Expected behavior
The file /tmp/set_value_test.xml to contain the following:
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<key>
<default>false</default>
</key>
</two>
</one>
Versions Report
Salt Version:
Salt: 3006.10
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 by reproducing the issue with the xml.set_value command and then trace its implementation in Salt. Confirm that updating the selected value preserves the XML declaration and formatting shown in the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100