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 = {'consul': <class 'genvid.toolbox.service.ConsulService'>, 'nomad': <class 'genvid.toolbox.service.NomadService'>, 'vault': <class 'genvid.toolbox.service.VaultService'>}

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, *services, **options)

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.

@service can be used to specify which services.

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, **options)

Install the services.

reinstall(*services, **options)

Uninstall and reinstall the services.

restart(*services, **options)

Stop than restart the services.

run_command(command, options)
run_service_installer_command(command, options)

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 of add_service_commands().

Returns:

handled, result: A tuple with a boolean saying if the command were handled, and it’s result if that the case.
services = None

The instances of all services.

start(*services, **options)

Start the services.

status(*services, **options)

Return the status of all services.

stop(*services, **options)

Stop the services.

uninstall(*services, **options)

Uninstall the servicess.