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 = {'reinstall': 'Reinstall the services', 'start': 'Start an installed service', 'install': 'Install the service', 'status': 'Check the status of the service', 'uninstall': 'Uninstall the service', 'restart': 'Restart a service', 'stop': 'Stop 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 it from add_commands() to add the service commands to the parser.

install(**kwargs)

Install the configuration of the service.

reinstall(**config)

Reinstall the service.

The old configuration is replaced 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 it from run_command() to handle the service commands. The service 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.
set_default_options(**kwargs)
uninstall()

Uninstall the configuration of the service.