genvid.toolbox.ServiceInstaller¶
-
class
genvid.toolbox.
ServiceInstaller
(**kwargs)¶ Bases:
genvid.toolbox.service.ServiceTool
Base class for installing all services.
This class used a SUPERVISOR_BASE to create a mixin (through multi-inheritance) of the actual services.
-
DESCRIPTION
= 'Installation of services'¶
-
NAME
= 'service-installer'¶
-
SERVICES
= ('consul', 'vault', 'nomad')¶ The list of all services.
-
SERVICE_CLASSES
= {'vault': <class 'genvid.toolbox.service.VaultService'>, 'consul': <class 'genvid.toolbox.service.ConsulService'>, 'nomad': <class 'genvid.toolbox.service.NomadService'>}¶ The base class associated with each service.
-
SUPERVISOR_BASE
¶ The mixin base class for service.
alias of
ServiceTool
-
add_commands
()¶ Add service installer and consul commands.
-
add_service_installer_commands
()¶ Add the service installer commands to the parser.
Run it from
add_commands()
to add the service installer commands to the parser.
-
do_command
(command: str, *services: str, **options: str) → typing.Any¶ Execute the command based on their name.
The behavior is similar to how they are on the command line, with options being used as keyword argument.
Parameters: - command – The name of the command to run.
- services – A possible list of services to run the command. All of them if not specified.
Options: Any options to pass to the command.
-
get_service_class
(name)¶ Returns the class of the named service.
-
get_services
(*services)¶ Yield the services associated with name.
The default returns all services.
-
get_tool_class
(basekls)¶ Create and return the mixed-ins class of the service.
-
install
(*services: str, **options: str) → typing.Any¶ Install the services.
-
reinstall
(*services: str, **options: str) → typing.Any¶ Uninstall and reinstall the services.
-
restart
(*services: str, **options: str) → typing.Any¶ Stop than restart the services.
-
run_command
(command: str, options) → typing.Tuple[bool, typing.Any]¶
-
run_service_installer_command
(command: str, options) → typing.Tuple[bool, typing.Any]¶ Detect if the command is a service installer command and execute it.
Call it from
run_command()
to handle the service installer commands. The service installer commands are added with the help ofadd_service_commands()
.Returns: if the command were handled, and it’s result if that the case.
-
services
= None¶ The instances of all services.
-
start
(*services: str, **options: str) → typing.Any¶ Start the services.
-
status
(*services: str, **options: str) → typing.Any¶ Return the status of all services.
-
stop
(*services: str, **options: str) → typing.Any¶ Stop the services.
-
uninstall
(*services: str, **options: str) → typing.Any¶ Uninstall the servicess.
-
-
class
service.
ServiceInstaller
¶ Implementation of
genvid.toolbox.ServiceInstaller