Package entropy :: Package transceivers :: Package uri_handlers :: Package plugins :: Package interfaces :: Module ssh_plugin :: Class EntropySshUriHandler

Class EntropySshUriHandler

source code


EntropyUriHandler based SSH (with pubkey) transceiver plugin.

Instance Methods
 
__init__(self, uri)
EntropyUriHandler constructor.
source code
 
__enter__(self)
Support for "with" statement, this will trigger UriHandler connection setup.
source code
 
__exit__(self, exc_type, exc_value, traceback)
Support for "with" statement, this will trigger UriHandler connection hang up.
source code
bool
download(self, remote_path, save_path)
Download URI and save it to save_path.
source code
bool
download_many(self, remote_paths, save_dir)
Download many files at once, taken from remote_paths, stored into save_dir
source code
bool
upload(self, load_path, remote_path)
Upload URI from load_path location to uri.
source code
bool
lock(self, remote_path)
Create remote "lock" file atomically.
source code
bool
upload_many(self, load_path_list, remote_dir)
Upload many files at once, taken from load_path_list, stored into remote_dir
source code
bool
rename(self, remote_path_old, remote_path_new)
Rename URI old to URI new.
source code
bool
copy(self, remote_path_old, remote_path_new)
Copy URI old to URI new.
source code
bool
delete(self, remote_path)
Remove the remote path (must be a file).
source code
bool
delete_many(self, remote_paths)
Remove many files at once, taken from remote_paths.
source code
string or None (if not supported)
get_md5(self, remote_path)
Return MD5 checksum of file at URI.
source code
list
list_content(self, remote_path)
List content of directory referenced at URI.
source code
list
list_content_metadata(self, remote_path)
List content of directory referenced at URI with metadata in this form: [(name, size, owner, group, permissions<drwxr-xr-x>,), ...] permissions, owner, group, size, name.
source code
bool
is_dir(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's a directory.
source code
bool
is_file(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's a file.
source code
bool
is_path_available(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's available or not.
source code
 
makedirs(self, remote_path)
Given a remote path, recursively create all the missing directories.
source code
 
keep_alive(self)
Send a keep-alive ping to handler.
source code
 
close(self)
Called when requesting to close connection completely.
source code

Inherited from skel.EntropyUriHandler: get_uri, set_output_interface, set_silent, set_speed_limit, set_timeout, set_verbosity

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from output.TextInterface: ask_question, edit_file, input_box, output, set_title

Static Methods
bool
approve_uri(uri)
Approve given URI by returning True or False depending if this class is able to handle it.
source code
string
get_uri_name(uri)
Given a valid URI (meaning that implementation can handle the provided URI), it extracts and returns the URI name (hostname).
source code
string
hide_sensible_data(uri)
Given an URI, hide sensible data from string and return it back.
source code
Class Variables
  PLUGIN_API_VERSION = 4
  valid_lock_path = re.compile(r'^([A-Za-z0-9/\.:-_~]+)$')

Inherited from skel.EntropyUriHandler: BASE_PLUGIN_API_VERSION, TMP_TXC_FILE_EXT

Inherited from output.TextInterface: OUTPUT_LOCK

Properties

Inherited from object: __class__

Method Details

approve_uri(uri)
Static Method

source code 

Approve given URI by returning True or False depending if this class is able to handle it.

Parameters:
  • uri - URI to handle
Returns: bool
True, if URI can be handled by this class
Overrides: skel.EntropyUriHandler.approve_uri
(inherited documentation)

get_uri_name(uri)
Static Method

source code 

Given a valid URI (meaning that implementation can handle the provided URI), it extracts and returns the URI name (hostname).

Parameters:
  • uri - URI to handle
Returns: string
URI name
Overrides: skel.EntropyUriHandler.get_uri_name
(inherited documentation)

hide_sensible_data(uri)
Static Method

source code 

Given an URI, hide sensible data from string and return it back.

Parameters:
  • uri - URI to handle
Returns: string
URI cleaned
Overrides: skel.EntropyUriHandler.hide_sensible_data
(inherited documentation)

__init__(self, uri)
(Constructor)

source code 

EntropyUriHandler constructor.

Parameters:
  • uri - URI to handle
Overrides: object.__init__
(inherited documentation)

__enter__(self)

source code 

Support for "with" statement, this will trigger UriHandler connection setup.

Overrides: skel.EntropyUriHandler.__enter__
(inherited documentation)

__exit__(self, exc_type, exc_value, traceback)

source code 

Support for "with" statement, this will trigger UriHandler connection hang up.

Overrides: skel.EntropyUriHandler.__exit__
(inherited documentation)

download(self, remote_path, save_path)

source code 

Download URI and save it to save_path.

Parameters:
  • remote_path - remote path to handle
  • save_path - complete path where to store file from uri. If directory doesn't exist, it will be created with default Entropy permissions.
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.download
(inherited documentation)

download_many(self, remote_paths, save_dir)

source code 

Download many files at once, taken from remote_paths, stored into save_dir

Parameters:
  • remote_paths - list of remote paths to handle
  • save_dir - directory where to store file from uri. If directory doesn't exist, it will be created with default Entropy permissions.
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.download_many
(inherited documentation)

upload(self, load_path, remote_path)

source code 

Upload URI from load_path location to uri.

Parameters:
  • load_path - remote path to handle
  • remote_path - remote path to handle ("directory"/"file name" !)
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.upload
(inherited documentation)

lock(self, remote_path)

source code 

Create remote "lock" file atomically. To drop a lock, just call remove(). The goal here is just being able to create a remote file in mutual exclusion between other Entropy Server instances. Please note: the locking mechanism is guaranteed to work only when callers share the same transceiver plugin.

Parameters:
  • remote_path - remote path to file lock
Returns: bool
True, if lock has been created, False otherwise
Overrides: skel.EntropyUriHandler.lock
(inherited documentation)

upload_many(self, load_path_list, remote_dir)

source code 

Upload many files at once, taken from load_path_list, stored into remote_dir

Parameters:
  • load_path_list - remote path to handle
  • remote_dir - remote dir where to store data
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.upload_many
(inherited documentation)

rename(self, remote_path_old, remote_path_new)

source code 

Rename URI old to URI new.

Parameters:
  • remote_path_old - remote path to handle
  • remote_path_new - remote path to create
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.rename
(inherited documentation)

copy(self, remote_path_old, remote_path_new)

source code 

Copy URI old to URI new.

Parameters:
  • remote_path_old - remote path to handle
  • remote_path_new - remote path to create
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.copy
(inherited documentation)

delete(self, remote_path)

source code 

Remove the remote path (must be a file).

Parameters:
  • remote_path_old - remote path to remove (only file allowed)
Returns: bool
True, if operation went successful
Raises:
Overrides: skel.EntropyUriHandler.delete
(inherited documentation)

delete_many(self, remote_paths)

source code 

Remove many files at once, taken from remote_paths.

Parameters:
  • remote_paths - list of remote paths to handle
Returns: bool
execution status, True if done
Raises:
Overrides: skel.EntropyUriHandler.delete_many
(inherited documentation)

get_md5(self, remote_path)

source code 

Return MD5 checksum of file at URI.

Parameters:
  • remote_path - remote path to handle
Returns: string or None (if not supported)
MD5 checksum in hexdigest form
Overrides: skel.EntropyUriHandler.get_md5
(inherited documentation)

list_content(self, remote_path)

source code 

List content of directory referenced at URI.

Parameters:
  • remote_path - remote path to handle
Returns: list
content
Raises:
  • ValueError - if remote_path does not exist
Overrides: skel.EntropyUriHandler.list_content
(inherited documentation)

list_content_metadata(self, remote_path)

source code 

List content of directory referenced at URI with metadata in this form: [(name, size, owner, group, permissions<drwxr-xr-x>,), ...] permissions, owner, group, size, name.

Parameters:
  • remote_path - remote path to handle
Returns: list
content
Raises:
  • ValueError - if remote_path does not exist
Overrides: skel.EntropyUriHandler.list_content_metadata
(inherited documentation)

is_dir(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's a directory.

Parameters:
  • remote_path - URI to handle
Returns: bool
True, if remote_path is a directory
Overrides: skel.EntropyUriHandler.is_dir
(inherited documentation)

is_file(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's a file.

Parameters:
  • remote_path - URI to handle
Returns: bool
True, if remote_path is a file
Overrides: skel.EntropyUriHandler.is_file
(inherited documentation)

is_path_available(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's available or not.

Parameters:
  • remote_path - URI to handle
Returns: bool
availability
Overrides: skel.EntropyUriHandler.is_path_available
(inherited documentation)

makedirs(self, remote_path)

source code 

Given a remote path, recursively create all the missing directories.

Parameters:
  • remote_path - URI to handle
Overrides: skel.EntropyUriHandler.makedirs
(inherited documentation)

keep_alive(self)

source code 

Send a keep-alive ping to handler.

Raises:
Overrides: skel.EntropyUriHandler.keep_alive
(inherited documentation)

close(self)

source code 

Called when requesting to close connection completely.

Overrides: skel.EntropyUriHandler.close
(inherited documentation)