-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
324 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
from os import mkdir | ||
from shutil import rmtree | ||
from tomllib import loads | ||
|
||
from jinja2 import Environment, FileSystemLoader | ||
|
||
if __name__ == "__main__": | ||
with open("./timers.toml", "r") as f: | ||
timers = loads(f.read())["timer"] | ||
if not timers: | ||
exit() | ||
env = Environment(loader=FileSystemLoader("./templates")) | ||
templates = { | ||
"service": env.get_template("service"), | ||
"timer": env.get_template("timer"), | ||
} | ||
rmtree("output") | ||
mkdir("output") | ||
for timer in timers: | ||
base_path = "./output/outdated-" + timer["command"] | ||
for type in ["service", "timer"]: | ||
with open(f"{base_path}.{type}", "w") as f: | ||
f.write(templates[type].render(**timer)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Notify maintainers about their projects if necessary | ||
Wants=outdated-notify.timer | ||
|
||
[Service] | ||
ExecStart=docker exec outdated-api sh -c './manage.py notify' | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Timer for Notify maintainers about their projects if necessary | ||
|
||
[Timer] | ||
Unit=outdated-notify.service | ||
OnCalendar=Mon *-*-* 00:00:00 | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Sync all projects with their remote counterparts | ||
Wants=outdated-syncprojects.timer | ||
|
||
[Service] | ||
ExecStart=docker exec outdated-api sh -c './manage.py syncprojects' | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Timer for Sync all projects with their remote counterparts | ||
|
||
[Timer] | ||
Unit=outdated-syncprojects.service | ||
OnCalendar=*-*-* 00:00:00 | ||
|
||
[Install] | ||
WantedBy=timers.target |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[tool.poetry] | ||
name = "systemd-timer-creation-tool" | ||
version = "0.1.0" | ||
description = "create systemd timers without boilerplate" | ||
authors = ["Adfinis AG"] | ||
readme = "README.md" | ||
packages = [{include = "systemd_timer_creation_tool"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
jinja2 = "^3.1.2" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
black = "^23.7.0" | ||
isort = "^5.12.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description={{description}} | ||
Wants=outdated-{{command}}.timer | ||
|
||
[Service] | ||
ExecStart=docker exec outdated-api sh -c './manage.py {{command}}' | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Timer for {{description}} | ||
|
||
[Timer] | ||
Unit=outdated-{{command}}.service | ||
OnCalendar={{schedule}} | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[[timer]] | ||
description="Sync all projects with their remote counterparts" | ||
command="syncprojects" | ||
schedule="*-*-* 00:00:00" | ||
|
||
[[timer]] | ||
description="Notify maintainers about their projects if necessary" | ||
command="notify" | ||
schedule="Mon *-*-* 00:00:00" |