Repository URL to install this package:
Version:
1.0.0b1 ▾
|
pycklets
/
systemd_service_unit_file.py
|
---|
# -*- coding: utf-8 -*-
from pyckles import AutoPycklet
class SystemdServiceUnitFile(AutoPycklet):
"""A systemd service unit configuration.
Args:
group: The group of the file.
install_alias: A space-separated list of additional names this unit shall be installed under.
install_also: Additional units to install/deinstall when this unit is installed/deinstalled.
install_default_instance: In template unit files, this specifies for which instance the unit shall be enabled if the template is enabled without any explicitly set instance.
install_required_by: This option may be used more than once, or a space-separated list of unit names may be given.
install_wanted_by: This option may be used more than once, or a space-separated list of unit names may be given.
mode: The permissions of the file.
owner: The owner of the file.
path: The path to the file.
service_bus_name: Takes a D-Bus bus name that this service is reachable as. This option is mandatory for services where Type= is set to dbus.
service_environment: Sets environment variables for executed processes.
service_environment_file: Similar to Environment= but reads the environment variables from a text file.
service_environment_file_extra: Extra environment files, helper var to make parent templating easier.
service_exec_reload: Commands to execute to trigger a configuration reload in the service.
service_exec_start: Commands with their arguments that are executed when this service is started.
service_exec_start_post: Additional commands that are executed before or after the command in ExecStart=, respectively.
service_exec_start_pre: Additional commands that are executed before or after the command in ExecStart=, respectively.
service_exec_stop: Commands to execute to stop the service started via ExecStart=.
service_exec_stop_post: Additional commands that are executed after the service is stopped.
service_group: Set the UNIX user or group that the processes are executed as, respectively.
service_guess_main_pid: Takes a boolean value that specifies whether systemd should try to guess the main PID of a service if it cannot be determined reliably.
service_permissions_start_only: Takes a boolean argument. If true, the permission-related execution options, as configured with User= and similar options (see systemd.exec(5) for more information), are only applied to the process started with ExecStart=, and not to the various other ExecStartPre=, ExecStartPost=, ExecReload=, ExecStop=, and ExecStopPost= commands. If false, the setting is applied to all configured commands the same way. Defaults to false.
service_pid_file: Takes a path referring to the PID file of the service.
service_private_tmp: If true, sets up a new file system namespace for the executed processes and mounts private /tmp and /var/tmp directories inside it that is not shared by processes outside of the namespace.
service_remain_after_exit: Takes a boolean value that specifies whether the service shall be considered active even when all its processes exited. Defaults to no.
service_restart: Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached.
service_restart_sec: Configures the time to sleep before restarting a service (as configured with Restart=).
service_timeout_start_sec: Configures the time to wait for start-up.
service_type: Configures the process start-up type for this service unit.
service_user: Set the UNIX user or group that the processes are executed as, respectively.
service_working_directory: Takes a directory path relative to the service's root directory specified by RootDirectory=, or the special value "~".
unit_after: These two settings ('Before', 'After') expect a space-separated list of unit names. They configure ordering dependencies between units.
unit_before: These two settings ('Before', 'After') expect a space-separated list of unit names. They configure ordering dependencies between units.
unit_binds_to: Configures requirement dependencies, very similar in style to Requires=.
unit_conflicts: A space-separated list of unit names. Configures negative requirement dependencies.
unit_description: A human readable name for the unit.
unit_documentation: A space-separated list of URIs referencing documentation for this unit or its configuration.
unit_part_of: Configures dependencies similar to Requires=, but limited to stopping and restarting of units.
unit_requires: Configures requirement dependencies on other units.
unit_requisite: Similar to Requires=. However, if the units listed here are not started already, they will not be started and the starting of this unit will fail immediately.
unit_wants: A weaker version of Requires=. Units listed in this option will be started if the configuring unit is.
"""
FRECKLET_ID = "systemd-service-unit-file"
def __init__(
self,
group=None,
install_alias=None,
install_also=None,
install_default_instance=None,
install_required_by=None,
install_wanted_by=None,
mode=None,
owner=None,
path=None,
service_bus_name=None,
service_environment=None,
service_environment_file=None,
service_environment_file_extra=None,
service_exec_reload=None,
service_exec_start=None,
service_exec_start_post=None,
service_exec_start_pre=None,
service_exec_stop=None,
service_exec_stop_post=None,
service_group=None,
service_guess_main_pid=None,
service_permissions_start_only=None,
service_pid_file=None,
service_private_tmp=None,
service_remain_after_exit=None,
service_restart=None,
service_restart_sec=None,
service_timeout_start_sec=None,
service_type="simple",
service_user=None,
service_working_directory=None,
unit_after=None,
unit_before=None,
unit_binds_to=None,
unit_conflicts=None,
unit_description=None,
unit_documentation=None,
unit_part_of=None,
unit_requires=None,
unit_requisite=None,
unit_wants=None,
):
super(SystemdServiceUnitFile, self).__init__(
var_names=[
"group",
"install_alias",
"install_also",
"install_default_instance",
"install_required_by",
"install_wanted_by",
"mode",
"owner",
"path",
"service_bus_name",
"service_environment",
"service_environment_file",
"service_environment_file_extra",
"service_exec_reload",
"service_exec_start",
"service_exec_start_post",
"service_exec_start_pre",
"service_exec_stop",
"service_exec_stop_post",
"service_group",
"service_guess_main_pid",
"service_permissions_start_only",
"service_pid_file",
"service_private_tmp",
"service_remain_after_exit",
"service_restart",
"service_restart_sec",
"service_timeout_start_sec",
"service_type",
"service_user",
"service_working_directory",
"unit_after",
"unit_before",
"unit_binds_to",
"unit_conflicts",
"unit_description",
"unit_documentation",
"unit_part_of",
"unit_requires",
"unit_requisite",
"unit_wants",
]
)
self._group = group
self._install_alias = install_alias
self._install_also = install_also
self._install_default_instance = install_default_instance
self._install_required_by = install_required_by
self._install_wanted_by = install_wanted_by
self._mode = mode
self._owner = owner
self._path = path
self._service_bus_name = service_bus_name
self._service_environment = service_environment
self._service_environment_file = service_environment_file
self._service_environment_file_extra = service_environment_file_extra
self._service_exec_reload = service_exec_reload
self._service_exec_start = service_exec_start
self._service_exec_start_post = service_exec_start_post
self._service_exec_start_pre = service_exec_start_pre
self._service_exec_stop = service_exec_stop
self._service_exec_stop_post = service_exec_stop_post
self._service_group = service_group
self._service_guess_main_pid = service_guess_main_pid
self._service_permissions_start_only = service_permissions_start_only
self._service_pid_file = service_pid_file
self._service_private_tmp = service_private_tmp
self._service_remain_after_exit = service_remain_after_exit
self._service_restart = service_restart
self._service_restart_sec = service_restart_sec
self._service_timeout_start_sec = service_timeout_start_sec
self._service_type = service_type
self._service_user = service_user
self._service_working_directory = service_working_directory
self._unit_after = unit_after
self._unit_before = unit_before
self._unit_binds_to = unit_binds_to
self._unit_conflicts = unit_conflicts
self._unit_description = unit_description
self._unit_documentation = unit_documentation
self._unit_part_of = unit_part_of
self._unit_requires = unit_requires
self._unit_requisite = unit_requisite
self._unit_wants = unit_wants
@property
def group(self):
return self._group
@group.setter
def group(self, group):
self._group = group
@property
def install_alias(self):
return self._install_alias
@install_alias.setter
def install_alias(self, install_alias):
self._install_alias = install_alias
@property
def install_also(self):
return self._install_also
@install_also.setter
def install_also(self, install_also):
self._install_also = install_also
@property
def install_default_instance(self):
return self._install_default_instance
@install_default_instance.setter
def install_default_instance(self, install_default_instance):
self._install_default_instance = install_default_instance
@property
def install_required_by(self):
return self._install_required_by
@install_required_by.setter
def install_required_by(self, install_required_by):
self._install_required_by = install_required_by
@property
def install_wanted_by(self):
return self._install_wanted_by
@install_wanted_by.setter
def install_wanted_by(self, install_wanted_by):
self._install_wanted_by = install_wanted_by
@property
def mode(self):
return self._mode
@mode.setter
def mode(self, mode):
self._mode = mode
@property
def owner(self):
return self._owner
@owner.setter
def owner(self, owner):
self._owner = owner
@property
def path(self):
return self._path
@path.setter
def path(self, path):
self._path = path
@property
def service_bus_name(self):
return self._service_bus_name
@service_bus_name.setter
def service_bus_name(self, service_bus_name):
self._service_bus_name = service_bus_name
@property
def service_environment(self):
return self._service_environment
@service_environment.setter
def service_environment(self, service_environment):
self._service_environment = service_environment
@property
def service_environment_file(self):
return self._service_environment_file
@service_environment_file.setter
def service_environment_file(self, service_environment_file):
self._service_environment_file = service_environment_file
@property
def service_environment_file_extra(self):
return self._service_environment_file_extra
@service_environment_file_extra.setter
def service_environment_file_extra(self, service_environment_file_extra):
self._service_environment_file_extra = service_environment_file_extra
@property
def service_exec_reload(self):
return self._service_exec_reload
@service_exec_reload.setter
def service_exec_reload(self, service_exec_reload):
self._service_exec_reload = service_exec_reload
@property
def service_exec_start(self):
return self._service_exec_start
@service_exec_start.setter
def service_exec_start(self, service_exec_start):
self._service_exec_start = service_exec_start
@property
def service_exec_start_post(self):
return self._service_exec_start_post
@service_exec_start_post.setter
def service_exec_start_post(self, service_exec_start_post):
self._service_exec_start_post = service_exec_start_post
@property
def service_exec_start_pre(self):
return self._service_exec_start_pre
@service_exec_start_pre.setter
def service_exec_start_pre(self, service_exec_start_pre):
self._service_exec_start_pre = service_exec_start_pre
@property
def service_exec_stop(self):
return self._service_exec_stop
@service_exec_stop.setter
def service_exec_stop(self, service_exec_stop):
self._service_exec_stop = service_exec_stop
@property
def service_exec_stop_post(self):
return self._service_exec_stop_post
@service_exec_stop_post.setter
def service_exec_stop_post(self, service_exec_stop_post):
self._service_exec_stop_post = service_exec_stop_post
@property
def service_group(self):
return self._service_group
@service_group.setter
def service_group(self, service_group):
self._service_group = service_group
@property
def service_guess_main_pid(self):
return self._service_guess_main_pid
@service_guess_main_pid.setter
def service_guess_main_pid(self, service_guess_main_pid):
self._service_guess_main_pid = service_guess_main_pid
@property
def service_permissions_start_only(self):
return self._service_permissions_start_only
@service_permissions_start_only.setter
def service_permissions_start_only(self, service_permissions_start_only):
self._service_permissions_start_only = service_permissions_start_only
@property
def service_pid_file(self):
return self._service_pid_file
@service_pid_file.setter
def service_pid_file(self, service_pid_file):
self._service_pid_file = service_pid_file
@property
def service_private_tmp(self):
return self._service_private_tmp
@service_private_tmp.setter
def service_private_tmp(self, service_private_tmp):
self._service_private_tmp = service_private_tmp
@property
def service_remain_after_exit(self):
return self._service_remain_after_exit
@service_remain_after_exit.setter
def service_remain_after_exit(self, service_remain_after_exit):
self._service_remain_after_exit = service_remain_after_exit
@property
def service_restart(self):
return self._service_restart
@service_restart.setter
def service_restart(self, service_restart):
self._service_restart = service_restart
@property
def service_restart_sec(self):
return self._service_restart_sec
@service_restart_sec.setter
def service_restart_sec(self, service_restart_sec):
self._service_restart_sec = service_restart_sec
@property
def service_timeout_start_sec(self):
return self._service_timeout_start_sec
@service_timeout_start_sec.setter
def service_timeout_start_sec(self, service_timeout_start_sec):
self._service_timeout_start_sec = service_timeout_start_sec
@property
def service_type(self):
return self._service_type
@service_type.setter
def service_type(self, service_type):
self._service_type = service_type
@property
def service_user(self):
return self._service_user
@service_user.setter
def service_user(self, service_user):
self._service_user = service_user
@property
def service_working_directory(self):
return self._service_working_directory
@service_working_directory.setter
def service_working_directory(self, service_working_directory):
self._service_working_directory = service_working_directory
@property
def unit_after(self):
return self._unit_after
@unit_after.setter
def unit_after(self, unit_after):
self._unit_after = unit_after
@property
def unit_before(self):
return self._unit_before
@unit_before.setter
def unit_before(self, unit_before):
self._unit_before = unit_before
@property
def unit_binds_to(self):
return self._unit_binds_to
@unit_binds_to.setter
def unit_binds_to(self, unit_binds_to):
self._unit_binds_to = unit_binds_to
@property
def unit_conflicts(self):
return self._unit_conflicts
@unit_conflicts.setter
def unit_conflicts(self, unit_conflicts):
self._unit_conflicts = unit_conflicts
@property
def unit_description(self):
return self._unit_description
@unit_description.setter
def unit_description(self, unit_description):
self._unit_description = unit_description
@property
def unit_documentation(self):
return self._unit_documentation
@unit_documentation.setter
def unit_documentation(self, unit_documentation):
self._unit_documentation = unit_documentation
@property
def unit_part_of(self):
return self._unit_part_of
@unit_part_of.setter
def unit_part_of(self, unit_part_of):
self._unit_part_of = unit_part_of
@property
def unit_requires(self):
return self._unit_requires
@unit_requires.setter
def unit_requires(self, unit_requires):
self._unit_requires = unit_requires
@property
def unit_requisite(self):
return self._unit_requisite
@unit_requisite.setter
def unit_requisite(self, unit_requisite):
self._unit_requisite = unit_requisite
@property
def unit_wants(self):
return self._unit_wants
@unit_wants.setter
def unit_wants(self, unit_wants):
self._unit_wants = unit_wants