Skip to content

Commit

Permalink
core/setup - switched systemd module
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Oct 25, 2021
1 parent d8c0f4f commit aec50e4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions code/core/service/prestart.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# E-Mail: contact@growautomation.at
# Web: https://github.com/superstes/growautomation

# ga_version 0.9
# ga_version 1.0

# environmental variable PYTHONPATH must be set to the growautomation root-path for imports to work
# (export PYTHONPATH=/var/lib/ga)
Expand All @@ -28,7 +28,7 @@
from core.config import shared_init_prestart as startup_shared_vars
from core.config import shared as config

from systemd import journal as systemd_journal
from systemd import journal
from sys import exc_info as sys_exc_info
from os import path as os_path
from os import stat as os_stat
Expand Down Expand Up @@ -288,7 +288,7 @@ def _log(self, output, level: int = 1):
self.log_cache.append({'level': level, 'output': output})

if level == 1:
systemd_journal.write(output)
journal.send(output)

def _check_factory(self) -> bool:
# REALLY basic check for errors
Expand Down
4 changes: 2 additions & 2 deletions code/core/utils/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def __init__(self, log_instance):
self.log = log_instance

def write(self, output: str, level: int = 1) -> bool:
from systemd import journal as systemd_journal
from systemd import journal

if level == 1:
systemd_journal.write(output)
journal.send(output)

return self.log.write(output=output, level=level)

Expand Down
2 changes: 1 addition & 1 deletion code/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# core
pycryptodome # (Crypto)
mysql.connector
systemd
systemd-python

# django
virtualenv
Expand Down
2 changes: 1 addition & 1 deletion setup/roles/core/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
ga_core_mods:
- 'pycryptodome'
- 'mysql.connector'
- 'systemd'
- 'systemd-python'

ga_core_path_log: "{{ ga_path_log }}/core"
2 changes: 1 addition & 1 deletion setup/roles/core/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: GA | Core | Installing packages
apt:
name: ['git', 'python3', 'python3-pip']
name: ['git', 'python3', 'python3-pip', 'python3-systemd']
state: present

- name: GA | Core | Setting system timezone
Expand Down

0 comments on commit aec50e4

Please sign in to comment.