Commit Graph

24 Commits (76ee9a6a0439fac809b934592ac9868d1122a9ec)

Author SHA1 Message Date
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
Patrik Lundin d88080007a Fix typo: Replace "N0" with "NO". 2016-12-08 11:22:36 -05:00
Patrik Lundin 6594a1458d Multiple fixes for OpenBSD rcctl handling.
* Use the newly added 'default' argument to know if the default flags are set
  or not.
* Handle that 'status' may either return flags or YES/NO.
* Centralize flag handling logic.
* Set action variable after check if we need to keep going.

Big thanks to @ajacoutot for implementing the rcctl 'default' argument.
2016-12-08 11:22:36 -05:00
Brian Coca 77ec45e3d1 vastly simplified systemd detection, made enable/disable errors clearer both of which allows us to remove 'service name detection' as if systemd is init we still use it to handle initscripts. 2016-12-08 11:22:31 -05:00
Brian Coca 8b9772565e now actually adds usable name for systemd when service only has init script 2016-12-08 11:22:31 -05:00
Toshio Kuratomi cd7cc07e85 Gixes to doc formatting 2016-12-08 11:22:31 -05:00
Brian Coca ab96ff8b6d service cleanup 2016-12-08 11:22:30 -05:00
Patrik Lundin 8a6a4a7757 Simplify self.arguments logic.
Strange logic pointed out by @jarmani, thanks!
2016-12-08 11:22:30 -05:00
Patrik Lundin 2b18e544f5 Depend more on rcctl if it is present.
* Make the module support enable/disable of special services like pf via rcctl.
  Idea and method from @jarmani.
* Make the module handle when the user supplied 'arguments' variable does not
  match the current flags in rc.conf.local.
* Update description now that the code tries to use rcctl for everything if it
  is available.
2016-12-08 11:22:30 -05:00
Patrik Lundin 25c3c03a11 Tweak error checking for "enabled" code.
Based on input from @jarmani:
* A return value of 2 now means a service does not exist. Instead of
  trying to handle the different meanings of rc after running "status",
  just look at stderr to know if something failed.
* Skip looking at stdout to make the code cleaner. Any errors should
  turn up on stderr.
2016-12-08 11:22:30 -05:00
Patrik Lundin 32cb025b85 Fail if "rcctl status" writes to stderr. 2016-12-08 11:22:30 -05:00
Patrik Lundin 03d4b76b14 Check rc and print error message if any.
It is probably good to use stdout before printing a generic error
message as well.
2016-12-08 11:22:29 -05:00
Patrik Lundin 38d8db473f Make "enabled" code aware of --check mode. 2016-12-08 11:22:29 -05:00
Jonathan Armani d1433eca14 Add enable / disable of services for OpenBSD if rcctl is present 2016-12-08 11:22:29 -05:00
Achilleas Pipinellis 872f6aa559 Clarify supported init systems. 2016-12-08 11:22:28 -05:00
Brian Coca 78fb3217d6 service now detects systemd is actually running, not just installed 2016-12-08 11:22:27 -05:00
Toshio Kuratomi 1429507489 Fix for systemd service scripts with newlines
Fixes #127
2016-12-08 11:22:24 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00