[services-openrc] Make list of services more flexible
- Allow just a name entry, instead of requiring an object entry; this makes "foo" equal to { name: "foo", runlevel: "default" } and simplifies more for the straightfoward case of #974.
This commit is contained in:
parent
b02ee3cd8d
commit
72c0d1a101
@ -53,6 +53,10 @@ class OpenrcController:
|
||||
"""
|
||||
|
||||
for svc in self.services.get(state, []):
|
||||
if isinstance(svc, str):
|
||||
name = svc
|
||||
runlevel = "default"
|
||||
else:
|
||||
name = svc["name"]
|
||||
runlevel = svc.get("runlevel", "default")
|
||||
|
||||
|
@ -20,11 +20,14 @@ runlevelsDir: /etc/runlevels
|
||||
# - name: the service name
|
||||
# - runlevel: can hold any runlevel present on the target system;
|
||||
# if no runlevel is provided, "default" is assumed.
|
||||
# an entry may also be a single string, which is interpreted
|
||||
# as the name field (runlevel "default" is assumed then).
|
||||
#
|
||||
# # Example services and disable settings:
|
||||
# # - add foo1 to default
|
||||
# # - add foo2 to nonetwork
|
||||
# # - remove foo3 from default
|
||||
# # - remove foo4 from default
|
||||
# services:
|
||||
# - name: foo1
|
||||
# - name: foo2
|
||||
@ -32,6 +35,7 @@ runlevelsDir: /etc/runlevels
|
||||
# disable:
|
||||
# - name: foo3
|
||||
# runlevel: default
|
||||
# - foo4
|
||||
services: []
|
||||
disable: []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user