saltstack / saltstack/salt

[BUG] xml.set_value removes xml header from file

Open
#67,939 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.