saltstack / saltstack/salt

[BUG] network.system state - templates/rh_ip/network.jinja missing RES_OPTIONS setting

Open
#62,690 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage RHEL
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
Running network.system state removes line with RES_OPTIONS=ndots:2. Similar to that, trying to set it through state fails and just ignores it. RES_OPTIONS is valid setting for the /etc/sysconfig/network file.

Further investigation led me to see that settings are hardcoded in file salt/templates/rh_ip/network.jinja and res_options is missing in this template making the states ignore it or remove it from the file if it has been added by other means.

RHEL8 (Alma 8), Salt 3005, Python 3.6.8.

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM - VMware
  • VM running on a EC2, alma 8.6
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

  1. add by hand custom line in /etc/sysconfig/network. Example:
NETWORKING=yes
HOSTNAME=something.example.com
RES_OPTIONS=ndots:2
  1. create a state that modifies hostname:
set-hostname:
  network.system:
    - hostname: something.example.com
    - apply_hostname: True
    - retain_settings: True
  1. run state and examine output (or test the state; it will show same diff):
          ID: set-hostname
    Function: network.system
      Result: None
     Comment: Global network settings are set to be updated:
              ---
              +++
              @@ -1,3 +1,2 @@
               NETWORKING=yes
               HOSTNAME=something.example.com
              -RES_OPTIONS=ndots:2
     Started: 18:39:52.957997
    Duration: 8.201 ms
     Changes:

Expected behavior
I expected that RES_OPTIONS is supported as it is a valid option.

Versions Report

salt --versions-report

Master is on CentOS7, minion on Alma 8.6. Salt versions are the same.

Salt Version:
          Salt: 3005

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 2.6.1
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 18.0.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4

System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 4.4.169-1.el7.elrepo.x86_64
        system: Linux
       version: CentOS Linux 7 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 with salt/templates/rh_ip/network.jinja and the network.system state behavior described in the reproduction. Check how retain_settings handles /etc/sysconfig/network and how the template represents supported settings. Done means RES_OPTIONS=ndots:2 is preserved and can be managed without appearing in the state diff; rerun the provided state to verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.