Created on Sep 24, 2013
@author: J. Akeret
darkskysync.DarkSkySync.
DarkSkySync
(template=u'master', configFile=None, verbose=False)[source]¶Bases: object
It delegates the remote access to the according wrappers (currently either scp over ssh or rsync over ssh) and manages the local file structure
Parameters: |
|
---|---|
Raises: | ConfigurationError – error while reading the config file |
DEFAULT_TEMPLATE
= u'master'¶REMOTE_SYNC_WRAPPER_TYPE_MAP
= {u'local': <class 'darkskysync.LocalSyncAdapter.LocalSyncAdapter'>, u'rsync': <class 'darkskysync.RsyncWrapper.RsyncWrapper'>, u'ssh': <class 'darkskysync.SSHClientAdapter.SSHClientAdapter'>}¶REMOTE_WRAPPER_TYPE_MAP
= {u'rsync': <class 'darkskysync.SSHClientAdapter.SSHClientAdapter'>, u'ssh': <class 'darkskysync.SSHClientAdapter.SSHClientAdapter'>}¶avail
(path=None)[source]¶Lists the available file structure on the remote host
Parameters: | path – [optional] sub path to directory structure to check |
---|---|
Returns: | list of file available on remote host |
Raises: | ConnectionError – remote host could not be accessed |
list
(path=None, recursive=False)[source]¶Lists the available files in the local cache
Parameters: |
|
---|---|
Returns: | list of files in the local cache |
load
(names, dry_run=False, force=False)[source]¶Loads the given file names. Checks first if the requested files are available on the file system. If not, they will be downloaded from the remote host
Parameters: |
|
---|---|
Retun: | list of files loaded from the remote host |
Raises: |
|
remove
(files=None, allFiles=False)[source]¶Removes files and filetrees from the local cache
Parameters: |
|
---|---|
Raises: |
|
This is the DarkSkySync command line interface
Created on Sep 23, 2013
@author: J. Akeret
Created on Sep 23, 2013
@author: J. Akeret
darkskysync.DataSourceFactory.
ConfigReader
(configfile)[source]¶Bases: object
Reads the configuration properties from a ini file.
datasource_section
= u'datasource'¶local_section
= u'local'¶login_section
= u'login'¶read_config
()[source]¶Reads the configuration properties from the ini file and links the section to comply with the datasource config dictionary format. :return: dictionary containing all configuration properties from the
ini file in compliance to the datasource config format
Raises: | MultipleInvalid – not all sections present or broken links between secitons |
---|
remote_section
= u'remote'¶darkskysync.DataSourceFactory.
DataSourceFactory
(config)[source]¶Bases: object
A factory creating DataSource configurations
DEFAULT_CONFIGURATION_FILE
= u'/home/gitlab-runner/.darkskysync/config'¶REMOTE_FACTORY_TYPE_MAP
= {u'local': <class 'darkskysync.RemoteFactory.SSHRemoteLocationFactory'>, u'rsync': <class 'darkskysync.RemoteFactory.SSHRemoteLocationFactory'>, u'ssh': <class 'darkskysync.RemoteFactory.SSHRemoteLocationFactory'>}¶createDataSource
(template, name=None)[source]¶Parameters: |
|
---|
will be named after the template.
Returns: | DataSource instance |
---|---|
Raises: | ConfigurationError – data source template not found in config |
Created on Dec 2, 2015
author: jakeret
darkskysync.LocalSyncAdapter.
LocalSyncAdapter
(dataSourceConfig, dry_run=False, force=False, verbose=True)[source]¶Bases: darkskysync.AbstractRemoteSyncAdapter.AbstractRemoteSyncAdapter
An adapter implementation to the paramiko ssh client
Parameters: |
|
---|
LIST_CMD
= u'ls'¶NEWLINE
= u'\n'¶Created on Sep 23, 2013
@author: J. Akeret
Created on Sep 17, 2013
@author: J. Akeret
darkskysync.RsyncWrapper.
RsyncWrapper
(dataSourceConfig, rsync_exec=u'rsync', dry_run=False, force=False, verbose=True)[source]¶Bases: darkskysync.AbstractRemoteSyncAdapter.AbstractRemoteSyncAdapter
Wrapper for the rsync unix command.
Parameters: |
|
---|
FAILURE_KEYWORDS_EX_MAP
= {u'Could not resolve hostname': ConnectionError(u'Name or service not known',), u'Permission denied': FileSystemError(u'Unable to write files. Reason: Permission denied',), u'rsync error': ConnectionError(u'An unexpected error occured',)}¶Created on Sep 25, 2013
@author: J. Akeret
darkskysync.SSHClientAdapter.
SSHClientAdapter
(dataSourceConfig, dry_run=False, force=False, verbose=True)[source]¶Bases: darkskysync.AbstractRemoteSyncAdapter.AbstractRemoteSyncAdapter
An adapter implementation to the paramiko ssh client
Parameters: |
|
---|
LIST_CMD
= u'ls'¶NEWLINE
= u'\n'¶Created on Sep 24, 2013
@author: J. Akeret
darkskysync.SSHWrapper.
SSHWrapper
(dataSourceConfig, sshExec=u'ssh')[source]¶Bases: object
Wrapps the ssh unix command
Parameters: |
|
---|
LIST_CMD
= u'ls'¶darkskysync.
avail
(path=None)[source]¶Lists the available file structure on the remote host
Parameters: | path – [optional] sub path to directory structure to check |
---|---|
Returns: | list of file available on remote host |
Raises: | ConnectionError – remote host could not be accessed |
darkskysync.
list
(path=None, recursive=False)[source]¶Lists the available files in the local cache
Parameters: |
|
---|---|
Returns: | list of files in the local cache |
darkskysync.
load
(names, dry_run=False, force=False)[source]¶Loads the given file names. Checks first if the requested files are available on the file system. If not, they will be downloaded from the remote host
Parameters: |
|
---|---|
Retun: | list of files loaded from the remote host |
Raises: |
|
darkskysync.
remove
(files=None, allFiles=False)[source]¶Removes files and filetrees from the local cache
Parameters: |
|
---|---|
Raises: |
|