Commit Graph

67 Commits (b85bcb71c3b6215c3f856bd23c8e51154108e6f2)

Author SHA1 Message Date
Brian Coca d36bea766d make sure all svcadm operations are syncronous
fixes #5296
2016-12-08 11:25:25 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
Toshio Kuratomi ae310d5034 Fix syntax 2016-12-08 11:25:05 -05:00
Brian Coca 6030bcdb47 switched to use built in function for validation 2016-12-08 11:25:04 -05:00
Brian Coca 3c89a21e0c fixes corner case for systemd services
when both unit file and sysv init script exist
Thanks to @olfway for fix.

fixes #3764
2016-12-08 11:24:49 -05:00
Christian Schwarz e526b2ad3d 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-12-08 11:24:46 -05:00
Brian Coca 72eaf0281a updated checkmode for update-rc.d
fixes #4146
2016-12-08 11:24:43 -05:00
Christian Schwarz e25cb4df77 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-12-08 11:24:41 -05:00
Brian Coca 03f06ca2e8 fixed issue with multiline output from systemd
fixes #3868
2016-12-08 11:24:35 -05:00
James Tanner bc39f8c42e Revert "remove checking of stderr for insserv (#1846)"
This reverts commit 2ee6e4cf668a9bba77c3bb019d473f3614563838.
2016-12-08 11:24:26 -05:00
TheSameCH ca8bf6ab4c 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-12-08 11:24:26 -05:00
Guido Falsi 582a5bccc8 Make FreeBSD subclass respect the sleep option. 2016-12-08 11:24:20 -05:00
Matt Martz aaf762573e Various simple linting type cleanups on modules 2016-12-08 11:24:06 -05:00
Brian Coca f8a36c4047 service goes back to failing when absent
if no tools and no init script, this should always fail
2016-12-08 11:23:53 -05:00
Brian Coca d2cffb31c3 rearranged systemd check, removed redundant systemctl check fixed unused cmd and state var assignements 2016-12-08 11:23:44 -05:00
Simon Hafner 923e442409 added earlier paths to systemd
2b583ce657
b925e72633
2016-12-08 11:23:43 -05:00
Simon Hafner 4af48e139c 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.
2016-12-08 11:23:43 -05:00
Brian Coca d55ba3ab7c removed syslog in favor of common module logging functions 2016-12-08 11:23:38 -05:00
Brian Coca 682cb99d45 revert must_exist 2016-12-08 11:23:38 -05:00
Brian Coca 917b7071d6 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 2016-12-08 11:23:34 -05:00
Brian Coca fd23120d42 check systemctl status before show as show will not return antyhing other than rc=0 even when it fails. 2016-12-08 11:23:34 -05:00
Brian Coca 34f8eb0f4c made continue into a pass (there was no loop) 2016-12-08 11:23:30 -05:00
Brian Coca 686026919e avoid shlex exceptions in rc parsing (happens with multiline entries) fixes #1898 2016-12-08 11:23:30 -05:00
Evgeny Vereshchagin fe840225fb 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
2016-12-08 11:23:30 -05:00
Austin Hyde ca512b5def Always end rc.conf entries with a new line 2016-12-08 11:23:30 -05:00
James Cammarata 05c6732462 Prefer non-zero rc's over text analyis in service status checks
Fixes ansible/ansible#10441
2016-12-08 11:23:26 -05:00
KIKUCHI Koichiro dab7305d3b Fix service enabled check failure on FreeBSD 2016-12-08 11:23:25 -05:00
Arata Notsu cc76a479e1 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.
2016-12-08 11:23:14 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Brian Coca b2dadaadf8 Revert "added innitial daemon-reloaded support to service module"
This reverts commit 438d87d26991c26de4a6b1457b154eb8f50d093a.
2016-12-08 11:23:06 -05:00
Brian Coca 55d04f4ddf added innitial daemon-reloaded support to service module 2016-12-08 11:23:05 -05:00
Patrik Lundin 899788f1a7 service: Fix comments in OpenBsdService class.
No functional change.
2016-12-08 11:23:02 -05:00
Jonathan Mainguy 20301427f8 fixes check mode for Ubuntu 14.04 2016-12-08 11:23:01 -05:00
Semyon Deviatkin e94140e52b Fix unused variable systemd_enabled
Removed declared but unused variable systemd_enabled
2016-12-08 11:22:59 -05:00
Jesse Keating 17aabee6df 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.
2016-12-08 11:22:58 -05:00
James Cammarata d7ce6b0d4b Fix bug in service where upstart services incorrectly use init scripts
Fixes #1170
2016-12-08 11:22:57 -05:00
Brian Coca a6107e35e9 simplified bad if chain hopefully fixes #1136 2016-12-08 11:22:54 -05:00
David Wittman 15235a718d 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.
2016-12-08 11:22:52 -05:00
David Fritzsche 14720b54ac Add working status detection for pf on FreeBSD
The return code of "service pf onestatus" is usually zero on FreeBSD (tested with FreeBSD 10.0), even if pf is not running. So the service module always thinks that pf is running, even when it needs to be started.
2016-12-08 11:22:50 -05:00
Toshio Kuratomi 9fa04de137 In service_enable, the default of changed is True so we have to set it to False explicitly if it is False.
Fixes #875
2016-12-08 11:22:46 -05:00
Jon Hadfield 90f5a23f34 use is-enabled to check systemd service status. 2016-12-08 11:22:42 -05:00
Graham Hay 15fcbcb0ee Use insserv where available 2016-12-08 11:22:42 -05:00
Dagobert Michelsen 9991e8d8f1 Solaris SMF is already supported and should be mentioned in the docs, 2016-12-08 11:22:41 -05:00
Brian Coca b6a1927f13 now allows for case in which someone removed the K* links and is trying to reenable a service 2016-12-08 11:22:41 -05:00
Brian Coca 03273e06c7 simplified update-rc.d enable/disable handling, removed forced defaults creation as that breaks local customizations 2016-12-08 11:22:41 -05:00
Toshio Kuratomi a73bd8dcbc More information about distutils on Solaris in case we run into this again 2016-12-08 11:22:39 -05:00
Patrik Lundin 88fe45d7e7 Update OpenBSD rcctl handling to use new syntax.
See http://marc.info/?l=openbsd-cvs&m=142054488027109&w=2
2016-12-08 11:22:38 -05:00
Tim G b2e39265e1 Load distutils on all platforms EXCEPT Solaris.
Solaris doesn't ship distutils with with the default Python package.  This patch fixes "service" on Solaris since 30d6713.
2016-12-08 11:22:38 -05:00
Tim G ea77ac076b distutils is not available on some non-Linux OS's 2016-12-08 11:22:37 -05:00
Patrik Lundin 9803938663 Handle string returned by 'default' correctly.
We need to handle the string returned by 'default' in the same way we handle
the string returned by 'status' since the resulting flags are compared later.
2016-12-08 11:22:36 -05:00