From cd640bda9fb682c63bebc46363e0dce90e23b2f9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Jun 2018 09:21:31 -0400 Subject: [PATCH] [services-openrc] Restrict actions - Document the functions some more - Only "state" (i.e. action) "add" and "del" make sense, avoid calling rc-update for other keys (e.g. typo's). This matches the documentation, although there might be other actions that make sense (see also services-systemd, with its enable, disable and mask actions). --- src/modules/services-openrc/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/services-openrc/main.py b/src/modules/services-openrc/main.py index a3b273141..eb0da046e 100644 --- a/src/modules/services-openrc/main.py +++ b/src/modules/services-openrc/main.py @@ -28,7 +28,10 @@ from os.path import exists, join class OpenrcController: - """This is the openrc service controller + """ + This is the openrc service controller. + All of its state comes from global storage and the job + configuration at initialization time. """ def __init__(self): @@ -38,7 +41,10 @@ class OpenrcController: self.runlevelsDir = libcalamares.job.configuration['runlevelsDir'] def update(self, state): - """call rc-update for each service listed + """ + Call rc-update for each service listed + in services for the given @p state. rc-update + is called with @p state as the command as well. """ for svc in self.services[state]: @@ -52,11 +58,12 @@ class OpenrcController: """Run the controller """ - for state in self.services.keys(): + for state in ("add", "del"): self.update(state) def run(): - """Setup services + """ + Setup services """ return OpenrcController().run()