1
0
Fork 0

added timer module

Dieser Commit ist enthalten in:
Sebastian Tobie 2024-02-24 11:33:30 +01:00
Ursprung 8efa463b3d
Commit d64aeaa4fa
5 geänderte Dateien mit 135 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -1,10 +1,18 @@
=====================================
sebastian.systemd 0.3.8 Release Notes
sebastian.systemd 0.4.0 Release Notes
=====================================
.. contents:: Topics
v0.4.0
======
Changelog
---------
added timer module
v0.3.8
======

Datei anzeigen

@ -62,3 +62,7 @@ releases:
changes:
release_summary: fixed the import again.
release_date: "2024-02-11"
0.4.0:
release_date: "2024-02-24"
changes:
release_summary: added timer module

Datei anzeigen

@ -1,7 +1,7 @@
---
namespace: sebastian
name: systemd
version: 0.3.8
version: 0.4.0
readme: README.md

Datei anzeigen

Datei anzeigen

@ -22,13 +22,49 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore
argument_spec=dict(
name=Types.str(required=True, help="Name of the unit"),
description=Types.str(help="Description of the timer"),
onactive=Types.str(help="Starts the service x seconds after this timer was activated"),
onboot=Types.str(help="Starts the service x seconds after the device was booted or the container was started"),
onstartup=Types.str(help="Starts the service x seconds after the System's/User's systemd instance was started"),
onunitactive=Types.str(help="Starts the service x seconds after the unit this timer activates was last activated"),
onunitinactive=Types.str(help="Starts the service x seconds after the unit this timer activates was last deactivated"),
oncalendar=Types.str(help="Uses an Time string to start the unit."),
)
onactive=Types.list(
help="Starts the service x seconds after this timer was activated",
elements=Types.str(),
),
onboot=Types.list(
help="Starts the service x seconds after the device was booted or the container was started",
elements=Types.str(),
),
onstartup=Types.list(
help="Starts the service x seconds after the System's/User's systemd instance was started",
elements=Types.str(),
),
onunitactive=Types.list(
help="Starts the service x seconds after the unit this timer activates was last activated",
elements=Types.str(),
),
onunitinactive=Types.list(
help="Starts the service x seconds after the unit this timer activates was last deactivated",
elements=Types.str(),
),
oncalendar=Types.list(
help="Uses an Time string to start the unit.",
elements=Types.str(),
),
persistent=Types.bool(
help="If the system was down in the time the timer would have started the unit, start the unit as soon as possible."
),
randomdelay=Types.str(help="delays the activation by an random delay between 0 and the value"),
fixdelay=Types.bool(
help="set the random delay to an fixed value. It uses the timername, the user of the servicemanager and the machineid as the seed."
),
unit=Types.str(help="The name of the unit. only needed if its not {{name}}.service"),
),
required_one_of=[
[
"onactive",
"onboot",
"onstartup",
"onunitactive",
"onunitinactive",
"oncalendar",
],
],
)
def prepare(self):
@ -37,6 +73,18 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore
def body(self):
section = "[Timer]\n"
params = []
params.extend(
self.map_param(
onactive="OnActiveSec",
onboot="OnBootSec",
onstartup="OnStartupSec",
onunitactive="OnUnitActiveSec",
onunitinactive="OnUnitInactiveSec",
oncalendar="OnCalendar",
),
)
section += "".join(params)
return section
def unit(self) -> str:
@ -82,11 +130,61 @@ options:
elements: str
required: false
type: list
fixdelay:
description:
- set the random delay to an fixed value. It uses the timername, the user of the
servicemanager and the machineid as the seed.
required: false
type: bool
name:
description:
- Name of the unit
required: true
type: str
onactive:
default: []
description:
- Starts the service x seconds after this timer was activated
elements: str
required: false
type: list
onboot:
default: []
description:
- Starts the service x seconds after the device was booted or the container was
started
elements: str
required: false
type: list
oncalendar:
default: []
description:
- Uses an Time string to start the unit.
elements: str
required: false
type: list
onstartup:
default: []
description:
- Starts the service x seconds after the System's/User's systemd instance was
started
elements: str
required: false
type: list
onunitactive:
default: []
description:
- Starts the service x seconds after the unit this timer activates was last activated
elements: str
required: false
type: list
onunitinactive:
default: []
description:
- Starts the service x seconds after the unit this timer activates was last deactivated
elements: str
required: false
type: list
partof:
default: []
description:
@ -96,6 +194,17 @@ options:
elements: str
required: false
type: list
persistent:
description:
- If the system was down in the time the timer would have started the unit, start
the unit as soon as possible.
required: false
type: bool
randomdelay:
description:
- delays the activation by an random delay between 0 and the value
required: false
type: str
required_by:
default: []
description:
@ -111,6 +220,11 @@ options:
elements: str
required: false
type: list
unit:
description:
- The name of the unit. only needed if its not {{name}}.service
required: false
type: str
wanted_by:
default: []
description: