Commit graph

64 commits

Author SHA1 Message Date
Ron Gomes
bcf3e29e14 Fix incorrect argument ordering in error message, which provokes a
printf-related TypeError.
2014-06-09 15:03:51 -04:00
Michael Scherer
43d0fbd342 Add a better error message for service
While migrating my playbook to a newer ansible version, I faced
the error message "unknown init system, cannot enable service". It turned
out to be caused by a wrong service name that was not expanded anymore.

So by giving the name of the service that cannot be enabled and a more precise
reason, i think people will be able to diagnose their issue more easily.
2014-04-22 09:13:57 +02:00
Eric Lake
e84291d717 Adding bold to service doc to call up state and enabled. 2014-04-07 09:37:15 -05:00
Adam Nielsen
1a9c5947ed More descriptive error message if init system is unknown 2014-03-30 11:46:13 +10:00
Michael DeHaan
0bec29a626 Merge pull request #6524 from tyll/update_rc_d_disable
service module: Properly disable Debian services
2014-03-28 11:10:46 -04:00
Cristian Ciupitu
96ff1444f0 Micro-optimization: replace s.find(x)==0 with s.startswith(x)
timeit shows a speedup of ~1.4x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-27 20:35:20 +02:00
Till Maas
c21fa8ebee service module: Properly disable Debian services
Services on Debian need to be disabled with 'disable' instead of 'remove'
to avoid them being enabled again when 'update-rc.d $service defaults' is run,
e.g. as part of a postinst script.
2014-03-20 09:19:42 +01:00
James Cammarata
bc38bfe61b Merge branch 'issues/6341' of https://github.com/threatgrid/ansible into threatgrid-issues/6341 2014-03-18 10:46:39 -05:00
Michael DeHaan
92f9f50f1a Merge pull request #6339 from threatgrid/systemd-template-svc-fix
systemd template services must not discard template part
2014-03-16 12:40:44 -05:00
Michael DeHaan
5aef2f0687 Merge pull request #6005 from pgehres/chkconfig
Adding better failure output for chkconfig failures
2014-03-16 12:27:46 -05:00
Cristian Ciupitu
0749112286 Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-16 13:10:28 -04:00
James Tanner
ba0fec4f42 Force command action to not be executed by the shell unless specifically enabled 2014-03-10 16:13:30 -05:00
Charles Duffy
18f53d9219 #6341: use shared function for parsing systemd status; check rc code 2014-03-10 01:05:48 -05:00
Charles Duffy
d59973295d #6341: check systemd service status with show subcommand 2014-03-10 00:09:29 -05:00
Charles Duffy
44ebd3f4f3 systemd template services must not discard template part 2014-03-07 18:53:15 -06:00
Peter Gehres
c427a829a0 Adding better failure output for chkconfig failures rather than
just saying that the service name is unknown
2014-02-13 23:05:00 -08:00
jctanner
5967b463c9 Merge pull request #5554 from ttarabul/devel
Use /etc/rc.conf.local for sevice configuration on FreeBSD
2014-02-04 10:59:19 -08:00
Brian Coca
46dfe07181 be permissive with BSD with service enabled upper/lower/mixed cases
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-01-28 14:49:57 -05:00
Tyler
2f813f7660 keep /usr/local/etc/rc.conf for backwards compatibility 2014-01-08 14:38:49 -05:00
Tyler
1a655b2dd7 Use /etc/rc.conf.local for sevice configuration on FreeBSD
/etc/rc.conf.local is the preferred location for system-specific
startup configuration, and /usr/local/etc/rc.conf generally isn’t used.

see:
http://www.freebsd.org/doc/handbook/configtuning-core-configuration.html
2014-01-08 13:48:11 -05:00
Jasper N. Brouwer
a52ca73167 Swapped conditions of the changed if statements 2013-12-23 09:54:16 +01:00
Jasper N. Brouwer
0e11e4c86f Fixed false positive on initctl as enable_cmd
Also on update-rc.d
In service module
2013-12-04 21:49:00 +01:00
James Tanner
6008ea40ee Add more error detail to the service module for FreeBSD 2013-11-12 00:02:30 -05:00
Michael DeHaan
d34a26e307 Undo an inadvertant revert from template changes so we still allow pythonic imports in module land. 2013-10-31 16:53:05 -04:00
James Tanner
d154bf8781 Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754 2013-10-30 10:50:16 -04:00
Michael DeHaan
9858b1f2f3 Enable imports to work on a snippet based system, allowing for instance a library of common EC2 functions
to be reused between modules.  See library/system/service and library/system/ping for initial examples.  Can
work the old way to just import 'basic', or can import the new way to import multiple pieces of code from
module_utils/.
2013-10-26 11:09:30 -04:00
James Tanner
40574c1938 Fixes #4448 reloaded services should be started if not running 2013-10-25 15:30:02 -04:00
Scott Sturdivant
4d24e2e29f If the output of rcvar isn't a key=value pair, ignore it. 2013-10-21 14:20:54 -06:00
Michael DeHaan
21d4400c96 Misc pep8 fixes 2013-10-19 13:03:15 -04:00
Michael DeHaan
119b6d73dd Remove examples of module antipattern of setting the choices array for boolean types. 2013-10-11 08:45:13 -04:00
Michael DeHaan
f6c3dce497 Merge pull request #4336 from orkaa/devel
Fixes service update-rc.d functionality on debian
2013-10-07 05:56:43 -07:00
Martijn Lina
4cd3b9d637 replace dashes in rc.conf keys (which are based on freebsd rc.d filenames) to underscores 2013-10-04 16:30:39 +02:00
Nace Oroz
672a0c04e4 Fixes service update-rc.d functionality on debian 2013-10-02 14:27:38 +02:00
cdigiovanni
7ff2b3befd Added support to disable and enable upstart jobs 2013-09-30 14:50:47 -05:00
James Cammarata
c2e02fbd6b Minor tweak to service changed logic from the previous commit 2013-09-19 15:00:25 -05:00
James Cammarata
f62093da56 Merge branch 'service-enable-fix' of https://github.com/gottwald/ansible into gottwald-service-enable-fix 2013-09-19 14:59:53 -05:00
Petr Svoboda
8d290e3394 Fix traceback in service module when svc_cmd is None (2nd fix)
When service module is used on unsupported Linux system where init
script is used directly, LinuxService.svc_cmd is None so .endswith()
fails.

This extends fix from e2f20db534 also
for state=restarted.

Fixes issue #3533
2013-09-19 14:36:02 -05:00
Ingo Gottwald
f7adbf2f29 Bugfix service module: Only change service state when needed 2013-09-13 22:04:37 +02:00
James Cammarata
72eaa0570e Allow service module to manage services not ending in .service
Fixes #3417
2013-09-11 15:48:36 -05:00
James Cammarata
b2741f451e Fixes to the service module for Ubuntu 12.04 (LTS)
Fixes #3615
Fixes #3572
2013-09-10 22:19:15 -05:00
James Cammarata
9a3a3e648b Check for systemd ownership of a service even if an init.d script exists
Also slight modification to the error message in the earlier commit that
modified the update-rc.d detection portion of the code

Fixes #3474
2013-09-10 19:37:51 -05:00
James Cammarata
7c8aa669cf Minor fix to account for template service names in systemctl 2013-09-10 11:31:13 -05:00
James Cammarata
6c3af4df81 Fix for update-rc.d based systems that also have systemd installed
By default, the service module had assumed that if the system had the
update-rc.d binary, the service was either managed via upstart or standard
sysV init-style scripts. This patch adds a check for systemctl ahead
of the other methods when update-rc.d is detected, and also simplifies
the logic around the detection of systemctl-managed services
2013-09-10 11:15:30 -05:00
James Cammarata
26a8d4ce9f Added 'reloaded' state to list of states checked for bounced services
Fixes #3556
2013-09-03 09:49:19 -05:00
Petr Svoboda
e2f20db534 Fix traceback in service module when svc_cmd is None
When service module is used on unsupported Linux system where init
script is used directly, LinuxService.svc_cmd is None so .endswith()
fails.

Fixes issue #3533
2013-08-08 14:24:20 +02:00
Michael DeHaan
8fe15f0a30 Merge pull request #3426 from trbs/services_sleep_option
sleep option for service module which adds a pauze between stopping and ...
2013-07-12 08:18:22 -07:00
Brian Coca
0664e36aa2 fixed check mode
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-07-08 15:41:39 -04:00
trbs
3b2173b6df sleep option for service module which adds a pauze between stopping and starting a service using state=restarted. This helps for bad scripts that exist immediatly after signaling a process to stop. 2013-07-03 17:08:07 +02:00
Antti Rasinen
93fc3391fe Fix service enable on FreeBSD
Some services have a knob (i.e. rc.conf setting) whose name
differs from that of the script. For example, lockd process
is controlled with a script called lockd, but the rc.conf
value is rpc_lockd_enable.

Fixes issue #3382.
2013-07-03 14:52:23 +03:00
martin f. krafft
85b8538e0e Expand usage of Python 2.6 if statement
Syntax like "'foo' if bar else 'baz'" is not supported by all Python
versions targetted by Ansible. Hence we break it up.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-23 09:19:27 +02:00