configsync.configsync_config Module

Module contains objects to manipulate, execute and resolve the ConfigSync configuration.

class configsync.configsync_config.ConfigSyncConfig[source]

Bases: object

This class is supposed to manipulate the ConfigSync configuration. It also stores the list of remotelly synchronized files and methods to load/store configuration from/to files.

restoreConfiguration()[source]

Restore stored configuration from a file or create the path to the configuration file and set the default values.

restoreFileList()[source]

Restore file list from remote directory if exists. Otherwise clear the file list as there shouldn’t be any files stored. This should be called after ConfigSync.restoreConfiguration() method as the file list should be in the git working directory set in configuration.

setConfigDefaults()[source]

Set default values to configuration if there’s no configuration stored yet.

storeConfiguration()[source]

Store configuration into file to make them persistent.

storeFileList()[source]

Store file list to a file on remote directory.

class configsync.configsync_config.ConfigSyncConfigContainer[source]

Bases: object

Container of the ConfigSync local configuration. The configuration is not synchronized remotelly and is store under user home directory in .configsync folder.

addFile(_file, _synced)[source]

Add a file into list of synced files. Every entry consists of an original file name and a local file name the remote file is synced with. The ‘file name’ means a full path in this case.

Parameters:
  • _file (string) – Original file name (remote)
  • _synced (string) – Local sync target file
delFile(_file)[source]

Delete a file entry from the list. It occurs when the file is not synchronized any more.

Parameters:_file (string) – Full path of the synchronized file
existsFile(_file)[source]

Check the (remote) file existence in the list of synchronized files.

Parameters:_file (string) – Full path of the expected synchronized file
Returns:True if the file exists in the list
Return type:bool
getValue(_file)[source]

Return a name of the local file which is synchronized with the file given in parameter

Parameters:_file (string) – Full path of the synchronized file
Returns:Full path of the local file which is synchronized with the given one
Return type:string
class configsync.configsync_config.ConfigSyncFilesContainer[source]

Bases: object

Container of file list. This file list is synchornized. The file list consists from trio - file name, file original owner, count of linked sides

addFile(_file, _owner)[source]

Add a file into a list of remote files. Every file is represented by its name with name of computer of its origin and count of linked sides. The count of linked sides is set to 1.

Parameters:
  • _file (string) – Full name of the synchronized file
  • _owner (string) – Name of the computer of the file’s origin

Increase the count of synced sides by 1.

Parameters:_file (string) – Full name of the synchronized file
delFile(_file)[source]

Deete a file entry from the list of synced files. The file should be deleted after the count of synced sides goes bellow 1.

Parameters:_file (string) – Full name of the synchronized file

Decrease the count of synced sides by 1. It also checks ify the count goes bellow 1. It’s represented by the return value.

Parameters:_file (string) – Full name of the synchronized file
Returns:True if the decreasing makes the count be bellow 1 and the actual file deleting is needed.
Return type:bool
existsFile(_file)[source]

Check the (remote) file existence in the list of synchronized files.

Parameters:_file (string) – Full name of the synchronized file