Commit Graph

78 Commits (8d3119dfe5279926dcd1ce970ad7cdeefe2829c5)

Author SHA1 Message Date
Toshio Kuratomi 432ee70da1 Fix syntax 8 years ago
Brian Coca 067167a9b3 switched to use built in function for validation 8 years ago
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
8 years ago
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.
8 years ago
Brian Coca 7437b6b25f updated checkmode for update-rc.d
fixes #4146
8 years ago
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)
8 years ago
Brian Coca a412451a89 fixed issue with multiline output from systemd
fixes #3868
9 years ago
James Tanner 9be870bb2a Revert "remove checking of stderr for insserv (#1846)"
This reverts commit 2ee6e4cf66.
9 years ago
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
9 years ago
Guido Falsi 8aac5ae7ba Make FreeBSD subclass respect the sleep option. 9 years ago
Matt Martz c7845456a6 Various simple linting type cleanups on modules 9 years ago
Brian Coca 827b9596da service goes back to failing when absent
if no tools and no init script, this should always fail
9 years ago
Brian Coca 4072bc1da0 rearranged systemd check, removed redundant systemctl check
fixed unused cmd and state var assignements
9 years ago
Simon Hafner 6233e72001 added earlier paths to systemd
2b583ce657
b925e72633
9 years ago
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.
9 years ago
Brian Coca f6bbd2ac5b removed syslog in favor of common module logging functions 9 years ago
Brian Coca 3e42527fde revert must_exist 9 years ago
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
9 years ago
Brian Coca bbcfb1092a check systemctl status before show as show will not return antyhing other than rc=0 even when it fails. 9 years ago
Brian Coca 5d7cb981d3 made continue into a pass (there was no loop) 9 years ago
Brian Coca cd0a1947c2 Merge pull request #1899 from austinhyde/fix-service-rcconf-newlines
Service module incorrectly handles lines not ending in a newline
9 years ago
Brian Coca 7a2687178e avoid shlex exceptions in rc parsing (happens with multiline entries)
fixes #1898
9 years ago
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
9 years ago
Austin Hyde 5c25057868 Always end rc.conf entries with a new line 9 years ago
James Cammarata bc60c893f5 Prefer non-zero rc's over text analyis in service status checks
Fixes ansible/ansible#10441
9 years ago
KIKUCHI Koichiro a3b9fb58bf Fix service enabled check failure on FreeBSD 9 years ago
Brian Coca 03d4805074 Merge pull request #1279 from no2a/devel
Not use "is" to compare strings
9 years ago
Greg DeKoenigsberg 2a5f0bde87 Proper author info for all remaining modules 10 years ago
Brian Coca 9acc7c402f Revert "added innitial daemon-reloaded support to service module"
This reverts commit 438d87d269.
10 years ago
Brian Coca 438d87d269 added innitial daemon-reloaded support to service module 10 years ago
Patrik Lundin fb41bdfc1e service: Fix comments in OpenBsdService class.
No functional change.
10 years ago
Brian Coca d02ef57815 minor doc fix 10 years ago
Brian Coca 0c9dd0e6a4 Merge pull request #751 from j2sol/service_must_exist
Add service option to avoid failure on missing service
10 years ago
Jonathan Mainguy 442b6a2067 fixes check mode for Ubuntu 14.04 10 years ago
Semyon Deviatkin 4e22a8039c Fix unused variable systemd_enabled
Removed declared but unused variable systemd_enabled
10 years ago
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.
10 years ago
James Cammarata c4f6e63117 Fix bug in service where upstart services incorrectly use init scripts
Fixes #1170
10 years ago
Brian Coca 727c9131c8 Merge pull request #1138 from bcoca/service_fix
simplified bad if chain
10 years ago
Brian Coca f1d72ea004 simplified bad if chain
hopefully fixes #1136
10 years ago
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.
10 years ago
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.
10 years ago
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
10 years ago
Brian Coca 1bca815d37 Merge pull request #95 from Gamevy/use-insserv
Use insserv where available
10 years ago
Brian Coca ed8154bdc7 Merge pull request #759 from jonhadfield/systemd_enabled_check
use is-enabled to check systemd service status.
10 years ago
Dagobert Michelsen 1f2ffb3900 Solaris SMF is already supported and should be mentioned in the docs, 10 years ago
Brian Coca b82055f021 Merge pull request #648 from bcoca/service_fix_update-rc.d
simplified update-rc.d enable/disable handling,
10 years ago
Jon Hadfield b20b29bd17 use is-enabled to check systemd service status. 10 years ago
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.
10 years ago
Graham Hay 17c7d9c5d5 Use insserv where available 10 years ago
Jonathan Armani 645e0653a3 Merge branch 'devel' into openbsd_rcctl 10 years ago