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 = {'start': 'Start an installed service.', 'stop': 'Stop a service.', 'restart': 'Restart a service.', 'status': 'Check the status of the service.', 'install': 'Install the service.', 'uninstall': 'Uninstall the service.', 'reinstall': 'Reinstall the services.'}

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

class DEFAULT_OPTIONS

Bases: object

mode = 'dev'
datacenter = 'dc1'
region = 'global'
bootstrap = 1
replace_dns = False
wan = None
bind = None
name = None
node_class = ''
node_id = None
servers = []
ec2_tag = None
ec2_value = None
join_policy = None
set_default_options(**kwargs)
install(**kwargs)

Install the configuration of the service.

uninstall(clean: bool = False)

Uninstall the configuration of the service.

reinstall(**config)

Reinstall the service.

Replaces the old configuration with a new one.

restart()

Restart the service.

prestart()

Run before start.

poststart()

Run after successful start.

get_startup_timeout()
add_service_commands()

Add the service commands to the parser.

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

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.
run_command(command, options)
class service.ServiceTool

Implementation of genvid.toolbox.ServiceTool