stools

Autodocumentation

Main

Entry point

stools.main.main()

Entry point function

Colors

Module for colors management in terminal

class stools.Colors.Colors

Classe for colors management in terminal

classmethod disable_color()
Returns:string for disable color in terminal
Return type:string
classmethod enable_color(color)
Parameters:color – color name
Returns:string for enable color in terminal
Return type:string

Command

Module for command management

class stools.Command.Command(name, machine, command_line)

Representation of a command

execute()

Execute this command

Returns:return of the command
Return type:string

Configuration

Module for configuration file management

class stools.Configuration.Configuration

Class for configuration file management

classmethod get_machines(configuration_file)

Return list of all machines configured in a configuration file

Parameters:configuration_file – filename of configuration file
Returns:Dictionary of machines
Return type:dictionary
classmethod get_task(configuration_file, task_name_to_search, arguments_list='')

Get task instance of task_name_to_search configured in configuration_file

Parameters:
  • configuration_file – filename of configuration file
  • task_name_to_search – name of the task
Returns:

Task instance of task_name_to_search

Return type:

Task

classmethod get_tasks_list(configuration_file)

Return list of all tasks configured in a configuration file

Parameters:configuration_file – filename of configuration file
Returns:Dictionary of tasks
Return type:dictionary
classmethod replace_generic_commands(command_parameters, arguments_list, argument_id)

Replace generic argument

Parameters:
  • command_parameters – list of parameters of command in configuration file
  • arguments_list – list of arguments use with task name
  • argument_id – current argument id

Copy

Module for copy command

class stools.Copy.Copy(name, machine_source, machine_target, file_source, file_target)

Representation of a copy command

execute()

Execute this command

Returns:return of the command
Return type:string

Machine

Module for machine

class stools.Machine.Machine(name, ip, username, password, gateway='', prompt=None)

Representation of a machine

clean_output(output)

Delete useless space of output

Parameters:output – string to clean
Returns:cleaned string
Return type:String
create_connection()

Create SSH connection with this machine

create_connection_by_terminal()

Create SSH connection with this machine with terminal

execute_command(command)

Execute command on this machine

Parameters:command – command to execute
Returns:return of the command
Return type:String
execute_copy(command, machine_target)

Execute copy command on this machine

Parameters:
  • command – command copy to execute
  • machine_target – machine instance of target machine
Returns:

return of the command

Return type:

String

set_gateway(gateway_machine)

Set gateway to access to this machine

Parameters:gateway_machine – instance of gateway machine
write_on_terminal(terminal, string_to_write, string_of_end)

Write string_to_write on terminal and wait for string_of_end

Parameters:
  • terminal – terminal instance
  • string_to_write – string to write in terminal
  • string_of_end – string of waiting

Recovery

Module for recovery command

class stools.Recovery.Recovery(name, machine_source, machine_target, file_source, file_target)

Representation of a recovery command

execute()

Execute this command

Returns:return of the command
Return type:string

Task

Module for tasks management

class stools.Task.Task(name)

Representation of a task

add_command(command)

Add command to this task commands list

Parameters:command – command to add to commands list
execute()

Execute all commands that components this task