Brian Coca
92b4ae4768
fixes corner case for systemd services
...
when both unit file and sysv init script exist
Thanks to @olfway for fix.
fixes #3764
2016-08-11 09:24:42 -04:00
Christian Schwarz
635c37cec6
system/service.py: fix false-positive service enablement on FreeBSD. ( #4283 )
...
sysrc(8) does not exit with non-zero status when encountering a
permission error.
By using service(8) `service <name> enabled`, we now check the actual
semantics expressed through calling sysrc(8), i.e. we check if the
service enablement worked from the rc(8) system's perspective.
Note that in case service(8) detects the wrong value is still set,
we still output the sysrc(8) output in the fail_json() call:
the user can derive the exact reason of failure from sysrc(8) output.
2016-08-01 13:35:39 -04:00
Brian Coca
7437b6b25f
updated checkmode for update-rc.d
...
fixes #4146
2016-07-11 09:39:30 -04:00
Christian Schwarz
f5e8204dbc
service module: use sysrc on FreeBSD ( #4042 )
...
* service module: use sysrc on FreeBSD
sysrc(8) is the designated userland program to edit rc files on FreeBSD.
It first appeared in FreeBSD 9.2, hence is available on all supported
versions of FreeBSD.
Side effect: fixes #2664
* Incorporate changes suggested by bcoca.
- Use `get_bin_path` to find sysrc binary.
- Only use sysrc when available (support for legacy versions of FreeBSD)
2016-07-05 09:43:05 -04:00
Brian Coca
a412451a89
fixed issue with multiline output from systemd
...
fixes #3868
2016-06-06 09:40:23 -04:00
James Tanner
9be870bb2a
Revert "remove checking of stderr for insserv ( #1846 )"
...
This reverts commit 2ee6e4cf66
.
2016-05-05 10:41:06 -04:00
TheSameCH
2ee6e4cf66
remove checking of stderr for insserv ( #1846 )
...
stderr of insserv can also contain warnings which can be ignored. checking rc only is more accurate.
fixes #1502
2016-05-04 22:09:55 -04:00
Guido Falsi
8aac5ae7ba
Make FreeBSD subclass respect the sleep option.
2016-04-23 14:10:11 +02:00
Matt Martz
c7845456a6
Various simple linting type cleanups on modules
2016-02-16 15:58:44 -06:00
Brian Coca
827b9596da
service goes back to failing when absent
...
if no tools and no init script, this should always fail
2015-12-17 12:55:43 -05:00
Brian Coca
4072bc1da0
rearranged systemd check, removed redundant systemctl check
...
fixed unused cmd and state var assignements
2015-10-23 18:59:05 -04:00
Simon Hafner
6233e72001
added earlier paths to systemd
...
2b583ce657
b925e72633
2015-10-24 00:20:59 +02:00
Simon Hafner
e65c0f896a
simpler way to check if systemd is the init system
...
According to
http://www.freedesktop.org/software/systemd/man/sd_booted.html
check if the directory /run/systemd/system/ exists.
2015-10-22 22:26:51 +02:00
Brian Coca
f6bbd2ac5b
removed syslog in favor of common module logging functions
2015-10-01 00:13:58 -04:00
Brian Coca
3e42527fde
revert must_exist
2015-10-01 00:13:58 -04:00
Brian Coca
e278f285aa
partially reverted previous change to deal with systemctl show status not returning errors on missing service
...
Now it looks for not-found key instead of running status which does return error codes when service is present but in diff states.
fixes #12216
2015-09-02 17:11:30 -04:00
Brian Coca
bbcfb1092a
check systemctl status before show as show will not return antyhing other than rc=0 even when it fails.
2015-09-01 10:58:15 -04:00
Brian Coca
5d7cb981d3
made continue into a pass (there was no loop)
2015-08-13 10:05:30 -04:00
Brian Coca
cd0a1947c2
Merge pull request #1899 from austinhyde/fix-service-rcconf-newlines
...
Service module incorrectly handles lines not ending in a newline
2015-08-12 19:34:34 -04:00
Brian Coca
7a2687178e
avoid shlex exceptions in rc parsing (happens with multiline entries)
...
fixes #1898
2015-08-12 18:10:24 -04:00
Evgeny Vereshchagin
55e8863cb4
Fix service.enable on: Debian 8, Ubuntu 15.04
...
Workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751638
See https://github.com/systemd/systemd/issues/937
2015-08-12 14:13:19 +00:00
Austin Hyde
5c25057868
Always end rc.conf entries with a new line
2015-08-10 17:42:26 -04:00
James Cammarata
bc60c893f5
Prefer non-zero rc's over text analyis in service status checks
...
Fixes ansible/ansible#10441
2015-07-27 12:51:30 -04:00
KIKUCHI Koichiro
a3b9fb58bf
Fix service enabled check failure on FreeBSD
2015-07-24 21:05:16 +09:00
Brian Coca
03d4805074
Merge pull request #1279 from no2a/devel
...
Not use "is" to compare strings
2015-07-04 16:00:05 -04:00
Greg DeKoenigsberg
2a5f0bde87
Proper author info for all remaining modules
2015-06-15 15:53:30 -04:00
Brian Coca
9acc7c402f
Revert "added innitial daemon-reloaded support to service module"
...
This reverts commit 438d87d269
.
2015-06-10 12:53:34 -04:00
Brian Coca
438d87d269
added innitial daemon-reloaded support to service module
2015-06-08 20:12:30 -04:00
Patrik Lundin
fb41bdfc1e
service: Fix comments in OpenBsdService class.
...
No functional change.
2015-05-27 08:05:30 +02:00
Brian Coca
d02ef57815
minor doc fix
2015-05-26 13:43:29 -04:00
Brian Coca
0c9dd0e6a4
Merge pull request #751 from j2sol/service_must_exist
...
Add service option to avoid failure on missing service
2015-05-26 13:39:08 -04:00
Jonathan Mainguy
442b6a2067
fixes check mode for Ubuntu 14.04
2015-05-22 21:28:36 -04:00
Semyon Deviatkin
4e22a8039c
Fix unused variable systemd_enabled
...
Removed declared but unused variable systemd_enabled
2015-05-15 11:36:04 +03:00
Arata Notsu
fff29f049e
Not use "is" to compare strings
...
As "is" tests whether if operands are the same object rather than
they have the same value, potentially causes a wrong result.
2015-05-08 01:53:13 +09:00
James Cammarata
c4f6e63117
Fix bug in service where upstart services incorrectly use init scripts
...
Fixes #1170
2015-05-04 14:03:05 -05:00
Brian Coca
727c9131c8
Merge pull request #1138 from bcoca/service_fix
...
simplified bad if chain
2015-04-14 14:04:28 -04:00
Brian Coca
f1d72ea004
simplified bad if chain
...
hopefully fixes #1136
2015-04-14 13:54:42 -04:00
Brian Coca
61f664bc47
Merge pull request #251 from davidfritzsche/patch-1
...
Add working status detection for pf on FreeBSD
i'm going to merge this to give you a usable workaround, still I consider this a bug in the init script.
2015-04-13 12:36:13 -04:00
David Wittman
8d53ef2f60
[service] Fix bug with upstart detection
...
Upstart scripts are being incorrectly identified as SysV init scripts
due to a logic error in the `service` module.
Because upstart uses multiple commands (`/sbin/start`, `/sbin/stop`,
etc.) for managing service state, the codepath for upstart sets
`self.svc_cmd` to an empty string on line 451.
Empty strings are considered a non-truthy value in Python, so
conditionals which are checking the state of `self.svc_cmd` should
explicitly compare it to `None` to avoid overlooking the fact that
the service may be controlled by an upstart script.
2015-03-25 17:37:18 -05:00
Toshio Kuratomi
939ecd33d4
In service_enable, the default of changed is True so we have to set it
...
to False explicitly if it is False.
Fixes #875
2015-03-03 11:23:35 -08:00
Brian Coca
1bca815d37
Merge pull request #95 from Gamevy/use-insserv
...
Use insserv where available
2015-02-16 18:52:38 -05:00
Brian Coca
ed8154bdc7
Merge pull request #759 from jonhadfield/systemd_enabled_check
...
use is-enabled to check systemd service status.
2015-02-16 12:29:44 -05:00
Dagobert Michelsen
1f2ffb3900
Solaris SMF is already supported and should be mentioned in the docs,
2015-02-12 17:04:31 +01:00
Brian Coca
b82055f021
Merge pull request #648 from bcoca/service_fix_update-rc.d
...
simplified update-rc.d enable/disable handling,
2015-02-11 21:05:25 -05:00
Jon Hadfield
b20b29bd17
use is-enabled to check systemd service status.
2015-02-08 18:15:15 +00:00
Jesse Keating
cf0e8d62d2
Add service option to avoid failure on missing service
...
This adds a must_exist option to the service module, which gives callers the
ability to be tolerant to services that do not exist. This allows for
opportunistic manipulation of a list of services if they happen to exist on the
host. While failed_when could be used, it's difficult to track all the
different error strings that might come from various service tools regarding a
missing service.
2015-02-05 15:23:35 -08:00
Graham Hay
17c7d9c5d5
Use insserv where available
2015-02-04 12:24:56 +00:00
Jonathan Armani
645e0653a3
Merge branch 'devel' into openbsd_rcctl
2015-01-23 13:01:34 +01:00
Toshio Kuratomi
4f1f8e89c9
More information about distutils on Solaris in case we run into this again
2015-01-22 21:55:27 -08:00
Toshio Kuratomi
effdba95de
Merge pull request #639 from tgolly/devel
...
distutils is not available on some non-Linux OS's
2015-01-22 21:49:17 -08:00