Skip to content

fix 45195 - add ignore to sysctl state and module#55719

Merged
dwoz merged 5 commits into
saltstack:masterfrom
mchugh19:sysctl_ignore_master
Apr 13, 2020
Merged

fix 45195 - add ignore to sysctl state and module#55719
dwoz merged 5 commits into
saltstack:masterfrom
mchugh19:sysctl_ignore_master

Conversation

@mchugh19

Copy link
Copy Markdown
Contributor

What does this PR do?

Add ignore support for sysctl module and state
Port of #52366 to master

What issues does this PR fix or reference?

#45195

Previous Behavior

If kernel settings were adjusted via grub, sysctl state would throw errors.

sysctl.get

# salt-call sysctl.get net.ipv6.conf.default.disable_ipv6
[ERROR   ] Command '[u'sysctl', u'-n', u'net.ipv6.conf.default.disable_ipv6']' failed with return code: 255
[ERROR   ] stdout: sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
[ERROR   ] retcode: 255
[ERROR   ] Command 'sysctl -n net.ipv6.conf.default.disable_ipv6' failed with return code: 255
[ERROR   ] output: sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
local:
    sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory

sysctl.assign

# salt-call sysctl.assign net.ipv6.conf.default.disable_ipv6 1 ignore=False
Error running 'sysctl.assign': sysctl net.ipv6.conf.default.disable_ipv6 does not exist

state sysctl.present

net.ipv6.conf.default.disable_ipv6:
  sysctl.present:
    - value: 1

# salt-call state.sls sysctl
[ERROR   ] Command '[u'sysctl', u'-n', u'net.ipv6.conf.default.disable_ipv6']' failed with return code: 255
[ERROR   ] stdout: sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
[ERROR   ] retcode: 255
[ERROR   ] Command 'sysctl -n net.ipv6.conf.default.disable_ipv6' failed with return code: 255
[ERROR   ] output: sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
[ERROR   ] Failed to set net.ipv6.conf.default.disable_ipv6 to 1: sysctl net.ipv6.conf.default.disable_ipv6 does not exist
local:
----------
          ID: net.ipv6.conf.default.disable_ipv6
    Function: sysctl.present
      Result: False
     Comment: Failed to set net.ipv6.conf.default.disable_ipv6 to 1: sysctl net.ipv6.conf.default.disable_ipv6 does not exist
     Started: 06:52:51.018918
    Duration: 22.922 ms
     Changes:

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:  22.922 ms

New Behavior

Support ignore=True in order to suppress sysctl errors on disabled settings

sysctl.get

# salt-call sysctl.get net.ipv6.conf.default.disable_ipv6 ignore=True
local:

sysctl.assign

# salt-call sysctl.assign net.ipv6.conf.default.disable_ipv6 1 ignore=True
local:
    ----------
    net.ipv6.conf.default.disable_ipv6:
        ignored

state sysctl.present

net.ipv6.conf.default.disable_ipv6:
  sysctl.present:
    - value: 1
    - ignore: True


# salt-call state.sls sysctl
local:
----------
          ID: net.ipv6.conf.default.disable_ipv6
    Function: sysctl.present
      Result: True
     Comment: Sysctl value net.ipv6.conf.default.disable_ipv6 = 1 was ignored
     Started: 06:54:07.576832
    Duration: 12.76 ms
     Changes:

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:  12.760 ms

Tests written?

Yes

Commits signed with GPG?

No

@mchugh19
mchugh19 requested a review from a team as a code owner December 21, 2019 08:42
@ghost
ghost requested a review from Ch3LL December 21, 2019 08:43
@dwoz

dwoz commented Jan 5, 2020

Copy link
Copy Markdown
Contributor

@mchugh19 This windows test failure needs to be addressed

https://jenkinsci.saltstack.com/job/pr-windows2016-py2/job/PR-55719/2/testReport/junit/integration.modules.test_network/NetworkTest/test_network_ping/

integration.modules.test_network.NetworkTest.test_network_ping

@mchugh19

mchugh19 commented Jan 5, 2020

Copy link
Copy Markdown
Contributor Author

@dwoz I can't see how the windows test failure could be related to modifications of the linux only sysctl module and state. Is it possible there is an issue with windows test machines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants