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

salt/modules/service does not implement the complete API for the service state #31648

Closed
darix opened this issue Mar 3, 2016 · 4 comments
Closed
Labels
Execution-Module Feature new functionality including changes to functionality and code refactors, etc. Platform Relates to OS, containers, platform-based utilities like FS, system based apps stale
Milestone

Comments

@darix
Copy link
Contributor

darix commented Mar 3, 2016

Splitted from #31617

2016-03-02 15:25:47,792 [salt.state                                                  ][ERROR   ][10683] 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'

This error happened because the bug from #31617 salt picked the modules/service.py instead of modules/rh_service.py.

$ grep '^def ' service.py 
def __virtual__():
def start(name):
def stop(name):
def restart(name):
def status(name, sig=None):
def reload_(name):
def available(name):
def missing(name):
def get_all():

compared to the RH service module

$ grep '^def ' rh_service.py
def __virtual__():
def _runlevel():
def _chkconfig_add(name):
def _service_is_upstart(name):
def _service_is_sysv(name):
def _service_is_chkconfig(name):
def _sysv_is_enabled(name, runlevel=None):
def _chkconfig_is_enabled(name, runlevel=None):
def _sysv_enable(name):
def _sysv_disable(name):
def _upstart_services():
def _sysv_services():
def get_enabled(limit=''):
def get_disabled(limit=''):
def get_all(limit=''):
def available(name, limit=''):
def missing(name, limit=''):
def start(name):
def stop(name):
def restart(name):
def reload_(name):
def status(name, sig=None):
def enable(name, **kwargs):
def disable(name, **kwargs):
def enabled(name, **kwargs):
def disabled(name):
@jfindlay jfindlay added the Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged label Mar 3, 2016
@jfindlay jfindlay added this to the Blocked milestone Mar 3, 2016
@jfindlay
Copy link
Contributor

jfindlay commented Mar 3, 2016

@darix, thanks for reporting. Part of the issue here is that there are more specific and more things that can be done with the redhat or systemd service than a generic service module that applies to many platforms.

Pragmatically what may need to be done is ensure that all calls to __salt__['service.*'] from anywhere, not only the service state, are defined in each of the providers of the service module. This may involve reducing the variety of functions used or adding placeholder functions that report that they are not or cannot be implemented on the platform.

@darix
Copy link
Contributor Author

darix commented Mar 4, 2016

i figured that would be the reason, but i didnt know how the project plans to proceed with this issue or if feature parity can actually be reached for the plain service.py.

@jfindlay jfindlay modified the milestones: Approved, Blocked Mar 4, 2016
@jfindlay jfindlay added Feature new functionality including changes to functionality and code refactors, etc. Execution-Module Platform Relates to OS, containers, platform-based utilities like FS, system based apps and removed Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged labels Mar 4, 2016
@jfindlay
Copy link
Contributor

jfindlay commented Mar 4, 2016

@darix, perhaps what we should do is standardize the required API for a set of literal modules that provide the same logical module as part of the requirements for a provider. I am unsure how to do this unless the salt loader could be modified to check for the required common functions and their arguments, perhaps as an unit test.

@stale
Copy link

stale bot commented Apr 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Apr 3, 2018
@stale stale bot closed this as completed Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Execution-Module Feature new functionality including changes to functionality and code refactors, etc. Platform Relates to OS, containers, platform-based utilities like FS, system based apps stale
Projects
None yet
Development

No branches or pull requests

2 participants