Commit Graph

96 Commits (60f85af91c5a9b433cdf3075ac6bcd024b6fb197)

Author SHA1 Message Date
Michael DeHaan c94ce66de7 Style fixes so "make pep8" is clean. 12 years ago
tin 7849f31e4c Additional example in service documentation. 12 years ago
tin d7dc4594eb Changed the service module to terminate early if only changing the enabled state.
Expanded the documentation slightly.
12 years ago
mavimo e5fe7f1afc Double quoted version_added in documentation 12 years ago
Michael DeHaan 478963768d Merge pull request #2490 from szinck/devel
Added SunOS (Solaris, illumos, etc) service management
12 years ago
Michael DeHaan 5993866df9 Merge pull request #2440 from jochu/service-chkconfig-add
attempt to add service to chkconfig when suggested
12 years ago
Shaun Zinck 590b86b41e service: fix typo 'err' in SunOS service class 12 years ago
Paul Sbarra 6bfaf86f37 service: add systemd template support 12 years ago
Paul Sbarra 4975e11699 service: fix systemd compilation error with --check 12 years ago
Shaun Zinck e50258cdd6 Added SunOS (Solaris, illumos, etc) service management using svcadm and svcs commands 12 years ago
Stephen Fromm 17101789ba Limit scope of arguments to service_control() in service module
This fixes handling of arguments (module argument) in service_control().
It is now locally scoped such that modifications to it, in the case of a
systemd host, do not later impact subsequent calls to service_control().
See issue #2449.

Without patch:
ansible-service[6177]: Command /usr/bin/systemctl stop cups cups , daemonize True

With patch:
ansible-service[6475]: Command /usr/bin/systemctl start cups , daemonize True

I also updated the comments to reflect the case where systemd is really
being called.
12 years ago
Jeffrey Chu b4789f13a7 attempt to add service to chkconfig when suggested 12 years ago
Jeffrey Chu c4d075d8a5 fail when service cannot be found by chkconfig 12 years ago
Patrik Lundin 4a3622200a Dont exit in FreeBSD/NetBSD subclass in check mode
* As the FIXMEs note: only exit if enable state is going to change.
* This is already handled in service_enable_rcconf() being called by both subclasses.
12 years ago
Nikolay Panov d3531d0d79 Fixed 'service'. Now it respect 'enabled=no' as well. 12 years ago
Stephen Fromm e1e5451f97 Consider service stopped if rc is 1
Per LSB spec, consider service stopped if rc from 'service status' is 1.
Added comment with url to LSB spec reference.
12 years ago
Ton Kersten 4b01169584 Squashed commit of the following:
commit e057ea671395ec8847f920a63cf9524f5c8fde5f
Author: Ton Kersten <tonk@tonkersten.com>
Date:   Thu Feb 28 13:02:25 2013 +0100

    Fixed the service command not working

    On Ubuntu 1[02].04 the service name was not recognized because
    there is a SysV style init script, but not an upstart config file.

    Example: The `ntp` client.

    Also removed extra spaces at the end of the lines, while at it.
12 years ago
Daniel Hokka Zakrisson 6e0da757db Merge pull request #2213 from huberteff/devel
Work around hanging module.  Thanks to Daniel Hozac for the tip.
12 years ago
Hubert Feyrer 8c0f95c657 Work around hanging module. Thanks to Daniel Hozac for the tip. 12 years ago
Daniel Hokka Zakrisson 79930d931a Merge pull request #2187 from dhozac/argument-type-check
Add type checking for module arguments, converting as much as possible
12 years ago
Michael DeHaan 4d4dbb370f Better detection of whether a service is managed by systemd or not. 12 years ago
Michael DeHaan b58cce4c1f Service module now knows a little more about systemd. This module is
really due for some refactoring, but telling how a service is managed is
a little fuzzy anyway.  on a systemd system typoing the service will now
give you a rather systemd specific error which is somewhat suboptimal.
12 years ago
Michael DeHaan 72eb0f046d Run chkconfig enable/disable only when needed. TODO, apply same logic to update-rc.d/systemd 12 years ago
Michael DeHaan 2488b2dfbc If running is given as the state value instead of 'started', still return the correct end state. 12 years ago
Michael DeHaan f7f4743746 The service module made some assumptions about how a service should be managed based on what was installed on the system in terms of service
management tools, which meant upstart services on CentOS6 were not startable.  This tweak allows things like vmware-tools to be controlled
via the service module.  More testing on other distributions (particularly with systemd) is presumably needed.
12 years ago
Daniel Hokka Zakrisson 0150f18a3b Use argument type checking to convert to boolean 12 years ago
Michael DeHaan 65b826a8a8 'make pep8' is now clean 12 years ago
Michael DeHaan 813dd8380f Taught service how to use --check mode 12 years ago
Michael DeHaan 1900cc68a7 Remove debug print message 12 years ago
Michael DeHaan 99021c1abd Make note about enablement bit 12 years ago
Michael DeHaan 4f5949eead Avoid the 'state=null' coming back from the service module. 12 years ago
Blair Zajac 6d5991aa4c Simplify and correct comparisons with None. 12 years ago
Hubert Feyrer fa16906e43 Add support for NetBSD. Tested on NetBSD 6.0/i386. 12 years ago
Michael DeHaan b3cc152f15 service status 4 should also be stopped 12 years ago
Daniel Hokka Zakrisson 768f41c6be Actually add stdout data to stdout buffer for daemon mode 12 years ago
Brendan Taylor 67a1997274 service module 'state' parameter comments should be processed by RST 12 years ago
Daniel Hokka Zakrisson a9e6ce97a3 Make service module daemonize for all the broken "daemons" out there 12 years ago
Michael DeHaan 97fd76991b Merge pull request #1867 from c0rner/devel
get_service_status() is now using self.service_control() to check status
12 years ago
Rune Kaagaard 50280f4fc4 Service mod.: Proper(?) handling of return code 69
This adds "69" to the return codes from the status command that should be
considered as not running. At least "django-celery" uses this return code,
maybe others::

    /venv/bin/python /code/project/manage.py celeryctl status
    echo $? # 69 when not running.

A bit of googling let me to http://tldp.org/LDP/abs/html/exitcodes.html and
on a Ubuntu Server 12.10 I get::

    ~# cat /usr/include/sysexits.h | grep 69
    #define EX_UNAVAILABLE	69	/* service unavailable */

I'm not sure if the content of sysexits.h is the same on other OS'es.
12 years ago
root 99fe051fb8 get_service_status() is now using self.service_control() to check status
Fixes a bug where init-scripts were not used
12 years ago
Stephen Fromm e4964f42e0 Update modules to use run_command in module_common.py
This updates apt, apt_repository, command, cron, easy_install, facter,
fireball, git, group, mount, ohai, pip, service, setup, subversion,
supervisorctl, svr4pkg, user, and yum to take advantage of run_command
in module_common.py.
12 years ago
Patrik Lundin 543c5d0de2 Use shlex for rc.conf parsing.
This makes the line parsing a lot more robust (and easier to read).
Code supplied by @dhozac, thanks!

Remove re import because this is not used anywhere.
12 years ago
Patrik Lundin 672b83b54b Rework "enabled" implementation for FreeBSD.
When trying to perform enabled=yes followed by enabled=no
against FreeBSD the module would die with the following error:
TypeError: sub() takes at most 4 arguments (5 given)

The target FreeBSD client (8.2) is running python 2.6.6. It seems the
extra 'flags' argument was added to re.sub() in 2.7.

In fixing this issue I have attempted to create a general atomic method
for modifying a rc.conf file. Hopefully this will make it easier to add
other rc based platorms. The strip/split magic was inspired by the user
module.
12 years ago
Daniel Hokka Zakrisson 48ae48973d Remove references to non-existant variable rc 12 years ago
Dag Wieers 3e538da5d0 The vars stop/start were intended as strings
This is a typo that was reported on IRC, because of this people got: "NameError: global name 'stop' is not defined".
12 years ago
Patrik Lundin 1a66a9cfb1 Refactor module to use subclasses like user module.
* Basically the moving parts from the original service module arranged in
  subclasses.
* General structure and helper methods comes from the user module.
* Less forgiving to unsupported platforms: it requires a subclass per platform.
  (This makes it easier to work on one platform without having to think about.
  what other platform might be affected in unexpected ways).
* Now has basic OpenBSD support.
* Solaris support needs to be added.

Thanks to @dhozac for general advice and Linux testing.
Thanks to @bcoca for clearing up some FreeBSD questions.
12 years ago
Jan-Piet Mens d184f72aa9 DOCUMENTATION strings 12 years ago
Dag Wieers a2a04f3b6d Make the default an empty string
Seems a bit strange I have to set a default in two locations.
12 years ago
Michael DeHaan 6f6559670f chmod -x for all module files in source checkout 12 years ago
Dag Wieers 6fcf939c0b Allow adding additional arguments to service module
Some services allow additional arguments to be provided on the command line. This patch makes it possible.
12 years ago