configsync.configsync_core Module

Module contains the core of ConfigSync synchronization. It contains all the real functionality of git control and file manipulation. Take a look into implemented methods to get more perspective.

class configsync.configsync_core.ConfigSyncCore(_config=<configsync.configsync_config.ConfigSyncConfig object>)[source]

Bases: object

ConfigSync synchronization core.

createWorkingDirectory(_path)[source]

Create git working directory. In this directory the ConfigSync synchronization git instance is proceed.

Parameters:_path (string) – Path to the working directory
Returns:True if working directory created successfully
Return type:bool
gitAdd(_file)[source]

Add given file to local branch. This is called after every file change.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The executed command should use native module instead of calling system dependent program.

Parameters:_file (string) – File basename in working directory
gitAddFilelist()[source]

Add a file list to local branch. This is called after every file change.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The executed command should use native module instead of calling system dependent program.

gitClone(_repo, _path)[source]

Clone given repository into the given working directory. This method is proceed only once after configuration of ConfigSync is set.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

TODO: The address should be parsed and checked if this is correct git address.

FIXME: The executed command should use native module instead of calling system dependent program.

Parameters:
  • _repo (string) – Link to the git repository
  • _path (string) – Path to the working directory
Returns:

True if clone command passed without any error

Return type:

bool

gitCommit()[source]

Git commit command. The commit message contains machine name and time stamp.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The command execution is quite time consuming. It should be done on background.

FIXME: The executed command should use native module instead of calling system dependent program.

gitPull()[source]

Git pull command.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The command execution is quite time consuming. It should be done on background.

FIXME: The executed command should use native module instead of calling system dependent program.

gitPush()[source]

Git push command.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The command execution is quite time consuming. It should be done on background.

FIXME: The executed command should use native module instead of calling system dependent program.

gitRemove(_file)[source]

Remove a file from local branch. This is called after every file remove.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The executed command should use native module instead of calling system dependent program.

Parameters:_file (string) – File basename in working directory
linkFile(_f, _s)[source]

Make a hardlink to the file to synchronize to ConfigSync working directory to begin file tracking.

FIXME: The executed command should use native module instead of calling system dependent program.

Parameters:
  • _f (string) – Path to the original file what should be synchronized
  • _s (string) – Path to the file in ConfigSync working directory
synchronize()[source]

Do the synchronization itself.

TODO: The command output should be checked. An error or password or encryption information could be required. The check should be added.

FIXME: The command execution is quite time consuming. It should be done on background.

unlinkFile(_file)[source]

Split a hardlink connection between two files to make them independent. This method is called when file should not be synchronized any longer.

FIXME: The executed command should use native module instead of calling system dependent program.

Parameters:_file (string) – Path to the file in ConfigSync working directory