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', 'restart': 'Restart a service', 'install': 'Install the service', 'stop': 'Stop a service', 'uninstall': 'Uninstall the service', 'reinstall': 'Reinstall the services', 'status': 'Check the status of the 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
= []¶
-
vault_enabled
= False¶
-
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.
-
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.
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 ofadd_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.
-
-
class
service.
ServiceTool
¶ Implementation of
genvid.toolbox.ServiceTool