Commit Graph

80 Commits (15047b2f26fdc4f30560d03b4f3a84098e9a1b50)

Author SHA1 Message Date
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
Michael DeHaan 15af4c63e5 Merge branch 'service_bsd' of git://github.com/bcoca/ansible into devel 12 years ago
Daniel Hokka Zakrisson 1ec38eb435 Fix service module for varnish initscript in EPEL
It outputs 'dead but pid file exists'.
12 years ago
Brian Coca e18ef3d640 Now can handle rc.conf and init.d/rc.d based systems
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
12 years ago
Jan-Piet Mens d069c57974 Reformat code: examples consistently
- added terse syntax to modules.rst
 - added description of special variables to template module
12 years ago
Michael DeHaan 95f9917df5 fix mentioning of redundant aliases in module docs, remove was removed anyway 12 years ago
Tim Bielawa 7881ddd8cb Fix typo in service module docs 12 years ago
Jan-Piet Mens c78a0a4a49 Jumbo DOCUMENTATION patch 12 years ago
Stephen Fromm f5d39b8677 Add module documentation for git, group, service, and user 12 years ago
Stephen Fromm 3d09c6cc21 Ignore failure of stop command if start succeeds with state=restarted
In some cases (see issue #1067) with state=restarted, a failure to stop
the service (which wasn't running) would appear to the module to be a
failure to restart the service even though it successfully started the
service.  This changes the behavior of the service module to focus
on the return code of the start command.  If the rc of stop is not
0 and the rc of start does equal 0, it considers the service
successfully restarted.  It then ignores the rc, stdout, and stderr
from the unsuccessful stop command.
12 years ago
Dave Coutu 5bf8415b3d Added cases for 'dead but subsys locked' status 12 years ago
Stephen Fromm f0da6b191a Migrate remaining modules to use get_bin_path in module_common.py
* Migraed easy_install, pip, service, setup, and user.
* Updated fail_json message in apt_repository
* Fixed easy_install to not hardcode location of virtualenv in
  /usr/local/bin/.
* Made handling of virtualenv more consistent between easy_install and
  pip.
12 years ago
Florian Diebold 8b19fc0ef9 Remove ternary operator to fix python 2.4 compatibility. 12 years ago
Florian Diebold fa2a65588d Support systemd in the service module.
Most of it worked already, except for the enable parameter, because it
tried to use chkconfig which only sees SysV services. First look for
systemctl and use that if it exists.
12 years ago
Michael DeHaan 1330e66709 tweak service module pattern= logic so ./hacking/test-module does not give false positives 12 years ago
Stephen Fromm 32cb95e424 Add pattern option to service module
Adds ability to check service status based on pattern.  The pattern
is a simple string.  If a pattern is provided, the output of ps is
checked first.
12 years ago
Michael DeHaan 3c2eba57fd Make pep8 tests run against the library directory as well, and associated tweaks (mostly to indentation) in the library
directory.
12 years ago