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

service.running fails on sle11 sp3 and sp4 #31617

Closed
tampakrap opened this issue Mar 2, 2016 · 9 comments
Closed

service.running fails on sle11 sp3 and sp4 #31617

tampakrap opened this issue Mar 2, 2016 · 9 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Milestone

Comments

@tampakrap
Copy link
Contributor

Description of Issue/Question

service.running state fails on SLE11 SP3 and SP4 machines. It happened in the past as well, where the SLE11 machines were falsely using systemd, see baf238f

salt minion log from the SLE11SP3 box:

2016-03-02 16:15:03,851 [salt.loader                                            ][ERROR   ][15417] Exception raised when processing __virtual__ function for rh_service. Module will not be loaded local variable 'osrelease' referenced before assignment
2016-03-02 16:15:03,851 [salt.loader                                            ][WARNING ][15417] salt.loaded.int.module.rh_service.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'rh_service', please fix this.
2016-03-02 16:15:04,708 [salt.state                                                  ][ERROR   ][15417] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/salt/state.py", line 1624, in call
    **cdata['kwargs'])
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 1491, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/salt/states/service.py", line 296, in running
    before_toggle_enable_status = __salt__['service.enabled'](name)
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 900, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/usr/lib64/python2.6/site-packages/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'service.enabled'

2016-03-02 16:15:05,430 [salt.state                                                  ][ERROR   ][15417] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/salt/state.py", line 1624, in call
    **cdata['kwargs'])
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 1491, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/salt/states/service.py", line 296, in running
    before_toggle_enable_status = __salt__['service.enabled'](name)
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 900, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/usr/lib64/python2.6/site-packages/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'service.enabled'

salt minion log from the SLE11SP4 box:

2016-03-02 15:18:44,759 [salt.state                                                  ][ERROR   ][4430] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/salt/state.py", line 1624, in call
    **cdata['kwargs'])
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 1491, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/salt/states/service.py", line 296, in running
    before_toggle_enable_status = __salt__['service.enabled'](name)
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 900, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/usr/lib64/python2.6/site-packages/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'service.enabled'

2016-03-02 15:18:45,371 [salt.state                                                  ][ERROR   ][4430] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/salt/state.py", line 1624, in call
    **cdata['kwargs'])
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 1491, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/salt/states/service.py", line 296, in running
    before_toggle_enable_status = __salt__['service.enabled'](name)
  File "/usr/lib64/python2.6/site-packages/salt/loader.py", line 900, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/usr/lib64/python2.6/site-packages/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'service.enabled'

Setup

Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).

useful grains:

    os:
        SUSE
    os_family:
        Suse
    osarch:
        x86_64
    oscodename:
        n.a
    osfullname:
        SLES
    osrelease:
        11 SP3
    osrelease_info:
        - 11 SP3
    os:
        SUSE
    os_family:
        Suse
    osarch:
        x86_64
    oscodename:
        SUSE Linux Enterprise Server 11 SP4
    osfullname:
        SLES
    osrelease:
        11.4
    osrelease_info:
        - 11
        - 4

Versions Report

Provided by running salt --versions-report

# salt-call --versions-report
Salt Version:
           Salt: 2015.8.7

Dependency Versions:
         Jinja2: 2.6
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.7.0
         Python: 2.6.9 (unknown, Apr  7 2015, 08:28:12)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.2
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: SuSE 11 x86_64
        machine: x86_64
        release: 3.0.101-68-default
         system: SUSE Linux Enterprise Server  11 x86_64
@darix
Copy link
Contributor

darix commented Mar 2, 2016

The real bug is ... the service state assumes that all provider implement a enabled method. Which is not true for modules/service.py. I have a local patch that makes sles11 use the modules/rh_service.py again.

@darix
Copy link
Contributor

darix commented Mar 2, 2016

@jfindlay jfindlay added Execution-Module State-Module Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps labels Mar 2, 2016
@jfindlay jfindlay added this to the Approved milestone Mar 2, 2016
@jfindlay
Copy link
Contributor

jfindlay commented Mar 2, 2016

@darix, you're welcome to submit your changes to 2015.8.

@Ch3LL
Copy link
Contributor

Ch3LL commented Mar 2, 2016

I also ran into this issue with the following test case:

using salt-ssh
salt-version: 2015.8.7

/srv/salt/test-state.sls:

disable_services:
  service.dead:
    - names:
      - salt-master
      - salt-minion

salt-ssh 'sles11sp4minion' state.sls test-state

ch3ll-sles11:
----------
          ID: disable_services
    Function: service.dead
        Name: salt-minion
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/tmp/.ec2-user_881c5e_salt/salt/state.py", line 1602, in call
                  **cdata['kwargs'])
                File "/tmp/.ec2-user_881c5e_salt/salt/loader.py", line 1491, in wrapper
                  return f(*args, **kwargs)
                File "/tmp/.ec2-user_881c5e_salt/salt/states/service.py", line 379, in dead
                  before_toggle_enable_status = __salt__['service.enabled'](name)
                File "/tmp/.ec2-user_881c5e_salt/salt/loader.py", line 900, in __getitem__
                  func = super(LazyLoader, self).__getitem__(item)
                File "/tmp/.ec2-user_881c5e_salt/salt/utils/lazy.py", line 93, in __getitem__
                  raise KeyError(key)
              KeyError: 'service.enabled'
     Started: 18:20:28.541897
    Duration: 2137.492 ms
     Changes:   
----------
          ID: disable_services
    Function: service.dead
        Name: salt-master
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/tmp/.ec2-user_881c5e_salt/salt/state.py", line 1602, in call
                  **cdata['kwargs'])
                File "/tmp/.ec2-user_881c5e_salt/salt/loader.py", line 1491, in wrapper
                  return f(*args, **kwargs)
                File "/tmp/.ec2-user_881c5e_salt/salt/states/service.py", line 379, in dead
                  before_toggle_enable_status = __salt__['service.enabled'](name)
                File "/tmp/.ec2-user_881c5e_salt/salt/loader.py", line 900, in __getitem__
                  func = super(LazyLoader, self).__getitem__(item)
                File "/tmp/.ec2-user_881c5e_salt/salt/utils/lazy.py", line 93, in __getitem__
                  raise KeyError(key)
             KeyError: 'service.enabled'
     Started: 18:20:30.679583
    Duration: 42.359 ms
     Changes:   

Summary for ch3ll-sles11
------------
Succeeded: 0
Failed:    2
------------
Total states run:     2

This was working in 2015.8.3 so I did a git bisect. Here is the git bisect:

9975508f865ea1152f200b8edf00f9da5d2dda8d is the first bad commit
commit 9975508f865ea1152f200b8edf00f9da5d2dda8d
Author: Justin Findlay <jfindlay@gmail.com>
Date:   Fri Dec 4 14:32:35 2015 -0700

    modules.rh_service.__virtual__: handle SUSE osrelease as num

:040000 040000 2882f370419fcb020886a8d5c088e5bbef604022 0bf86f7cd9ed77c1185d149af9d10c3f63f3a882 M      salt

@darix darix mentioned this issue Mar 2, 2016
2 tasks
@darix
Copy link
Contributor

darix commented Mar 2, 2016

didnt test develop if it is also affected.

@darix
Copy link
Contributor

darix commented Mar 2, 2016

also wondering if salt/modules/service.py should be enhanced to be usable with service state

@jfindlay
Copy link
Contributor

jfindlay commented Mar 2, 2016

@darix, all modules that provide service including salt/modules/service.py should be providing a common core API to the service state.

@rallytime
Copy link
Contributor

@tampakrap and @Ch3LL Can you give the fix in #31629 a try and confirm if this is fixed?

@rallytime rallytime added the fixed-pls-verify fix is linked, bug author to confirm fix label Mar 3, 2016
@tampakrap
Copy link
Contributor Author

confirmed thanks!

@jfindlay jfindlay closed this as completed Mar 4, 2016
rallytime pushed a commit that referenced this issue Mar 10, 2016
fixing init system detection on sles 11, refs #31617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P2 Priority 2 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Projects
None yet
Development

No branches or pull requests

5 participants