genvid.toolbox.ServiceTool

class genvid.toolbox.ServiceTool(**kwargs)

Bases: genvid.toolbox.network.NetworkTool

Base class for all services.

It provides the expected commands associated with a service, as well as some common utilities.

BASE_COMMANDS = {'uninstall': 'Uninstall the service.', 'stop': 'Stop a service.', 'install': 'Install the service.', 'status': 'Check the status of the service.', 'reinstall': 'Reinstall the services.', 'start': 'Start an installed service.', 'restart': 'Restart a service.'}

List of base commands and their help text for the service.

class DEFAULT_OPTIONS

Bases: object

bind = None
bootstrap = 1
datacenter = 'dc1'
ec2_tag = None
ec2_value = None
mode = 'dev'
name = None
node_class = ''
region = 'global'
replace_dns = False
servers = []
wan = None
add_service_commands()

Add the service commands to the parser.

Run from add_commands() to add the service commands to the parser.

get_startup_timeout()
install(**kwargs)

Install the configuration of the service.

poststart()

Run after successful start.

prestart()

Run before start.

reinstall(**config)

Reinstall the service.

Replaces the old configuration with a new one.

restart()

Restart the service.

run_command(command, options)
run_service_command(command, options)

Detect if the command is a service command and execute it.

Call from run_command() to handle the service commands. Adds service commands with the help of add_service_commands().

Returns:

handled, result: A tuple with a boolean saying if the
command was handled and its result if it was.
set_default_options(**kwargs)
uninstall(clean: bool = False)

Uninstall the configuration of the service.

class service.ServiceTool

Implementation of genvid.toolbox.ServiceTool