Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while setting sysctl in FreeBSD #3403

Closed
davidone opened this issue Jan 23, 2013 · 8 comments
Closed

Error while setting sysctl in FreeBSD #3403

davidone opened this issue Jan 23, 2013 · 8 comments
Milestone

Comments

@davidone
Copy link

# salt --versions-report
           Salt: 0.12.0
         Python: 2.7.3 (default, Jan 21 2013, 12:02:00)
         Jinja2: 2.6
       M2Crypto: 0.21.1
 msgpack-python: 0.2.2
   msgpack-pure: not installed
       pycrypto: 2.6
         PyYAML: 3.10
          PyZMQ: 2.2.0

Using this section in a .sls file:

security.bsd.see_other_uids:
  sysctl.present:
    - value: 0

lead to an error in the salt-master node:

----------
    State: - sysctl
    Name:      security.bsd.see_other_uids
    Function:  present
        Result:    False
        Comment:   An exception occured in this state: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1197, in call
    ret = self.states[cdata['full']](*cdata['args'])
  File "/usr/local/lib/python2.7/site-packages/salt/states/sysctl.py", line 33, in present
    current = __salt__['sysctl.show']()
  File "/usr/local/lib/python2.7/site-packages/salt/modules/freebsd_sysctl.py", line 53, in show
    ret[comps[0]] += '{0}\n'.format(line)
KeyError: '    root@srv1-salt:/usr/obj/usr/src/sys/R410'

        Changes:   

On the salt-minion server I see:

[INFO    ] Executing command 'sysctl -ae' in directory '/root'
[DEBUG   ] output: kern.ostype=FreeBSD
kern.osrelease=9.1-RELEASE
kern.osrevision=199506
kern.version=FreeBSD 9.1-RELEASE #2: Thu Jan 10 19:06:57 CET 2013
    root@srv1-salt:/usr/obj/usr/src/sys/R410

kern.maxvnodes=206392
kern.maxproc=6164
[...]
dev.ums.0.%parent=uhub3
dev.ums.0.parseinfo=i1: Z:r0, p40, s8; B1:r0, p0, s1; B2:r0, p1, s1; B3:r0, p2, s1;
[ERROR   ] No changes made for security.bsd.see_other_uids

Using the sysctl module, everything is fine:

root@salt-master # salt '*' sysctl.get security.bsd.see_other_uids
srv1-salt:
    0
root@salt-master # salt '*' sysctl.assign security.bsd.see_other_uids 1
srv1-salt:
    security.bsd.see_other_uids:
        1
root@salt-master # salt '*' sysctl.get security.bsd.see_other_uids
srv1-salt:
    1
root@salt-master # 
giantlock added a commit to giantlock/salt that referenced this issue Jan 23, 2013
@giantlock
Copy link
Contributor

@davidone, could you try this patch please?

@cedwards
Copy link
Contributor

Confirmed this patch resolves the issue on FreeBSD 9.1-RELEASE, Salt 0.12.1.

@giantlock
Copy link
Contributor

Thanks @cedwards

@davidone
Copy link
Author

patch is working on FreeBSD 9.1-RELEASE, salt 0.12.0 too. Thank you.

thatch45 added a commit that referenced this issue Jan 24, 2013
@davidone
Copy link
Author

I upgraded to 0.12.1:

# salt --versions-report
           Salt: 0.12.1
         Python: 2.7.3 (default, Jan 21 2013, 12:02:00)
         Jinja2: 2.6
       M2Crypto: 0.21.1
 msgpack-python: 0.2.2
   msgpack-pure: not installed
       pycrypto: 2.6
         PyYAML: 3.10
          PyZMQ: 2.2.0

and applied the patch but I have another issue:

----------
    State: - sysctl
    Name:      kern.ipc.nmbclusters
    Function:  present
        Result:    False
        Comment:   An exception occured in this state: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1197, in call
    ret = self.states[cdata['full']](*cdata['args'])
  File "/usr/local/lib/python2.7/site-packages/salt/states/sysctl.py", line 33, in present
    current = __salt__['sysctl.show']()
KeyError: 'sysctl.show'

        Changes:   
----------

Executing salt-minion -l debug on the minion I have:

[INFO    ] Executing state sysctl.present for kern.ipc.nmbclusters
[ERROR   ] No changes made for kern.ipc.nmbclusters

@davidone davidone reopened this Jan 24, 2013
@giantlock
Copy link
Contributor

@davidone, could you check /var/log/salt/minion, is there any stacktraces after restart salt_minion?

@davidone
Copy link
Author

Sorry, my fault (I used tabs and the indentation was failing).

Thanks,
d.

@nbari
Copy link

nbari commented Dec 16, 2014

I am getting the same problem under FreeBSD 10.1, this is my state:

net.inet.ip.portrange.reservedhigh:
  sysctl.present:
    - value: 0

And this is the error:

      ID: net.inet.ip.portrange.reservedhigh
Function: sysctl.present
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1533, in call
              **cdata['kwargs'])
            File "/usr/local/lib/python2.7/site-packages/salt/states/sysctl.py", line 56, in present
              configured = __salt__['sysctl.show'](config_file=True)
          TypeError: show() takes no arguments (1 given)
 Started: 12:37:59.554324
Duration: 407.332 ms
 Changes: 

# salt --versions-report
           Salt: 2014.7.0
         Python: 2.7.8 (default, Dec  4 2014, 09:32:53)
         Jinja2: 2.7.3
       M2Crypto: 0.22
 msgpack-python: 0.4.2
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.11
          ioflo: Not Installed
         PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 4.0.4
           Mako: Not Installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants