genvid.toolbox.ServiceTool
- class genvid.toolbox.ServiceTool(**kwargs)
Bases:
NetworkTool
Base class for all services.
It provides the expected commands associated with a service, as well as some common utilities.
- BASE_COMMANDS = {'install': 'Install the service.', 'reinstall': 'Reinstall the services.', 'restart': 'Restart a service.', 'start': 'Start an installed service.', 'status': 'Check the status of the service.', 'stop': 'Stop a service.', 'uninstall': 'Uninstall the service.'}
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.
- 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 ofadd_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)
Run command with those options.
You must override this method.
- Parameters:
command – The name of the command to run.
options – A
argparse.Namespace
object with the options pass in arguments.
- class service.ServiceTool
Implementation of
genvid.toolbox.ServiceTool