stools

Autodocumentation

Main

Entry point

stools.main.main()

Entry point function

Command

Module for command management

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

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_configuration_from_file(configuration_file)

Return a ConfigObj instance if configuration_file is validate

Parameters:configuration_file – filename of configuration file
Returns:ConfigObj instance
Return type:ConfigObj
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

Put

Module for put command

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

Representation of a put 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, timeout)

Execute command on this machine

Parameters:
  • command – command to execute
  • timeout – timeout (in seconds) for command execution
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

Get

Module for get command

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

Representation of a get 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