Welcome to Mirrors’s documentation!¶
Contents:
Getting Started¶
Installation¶
Pre-Build¶
git clone http://github.com/ehouse/mirrors.git
./setup.py build
Uninstall¶
pip uninstall mirrors
Configuration¶
Configuration can be in any file you choose however mirrors.conf is what is included. The file must be included when mirrors is run with the -c flag.
(ex. mirrors -c mirrors.conf)
Global Config Options¶
[GLOBAL]
All of the global configuration is stored within the [GLOBAL] block. If it is not present the application will fail to load.
async_processes = 4
The number of syncs that may be run at any given time. Scheduled syncs will wait until a spot opens up before it will begin running.
log_file = ./mirrors.log
Application log file. This is were errors, warnings or general information is logged to. Default is mirrors.log
check_sleep = 30
Time to sleep in between syncs . Default is 30 seconds.
Repo Options¶
[test1]
Name of the repo in brackets. This is how it will be accessed within the repl.
source = rsync://mirrors.rit.edu/FreeBSD
Source of the rsync transfer.
rsync_args = -avhz
Flags to pass into the rsync process.
destination = ./distros/
Destination of the rsync file transfer.
weight = 0
Weight of the sync. Lower numbers will go before higher numbers. Value between -10 and 10. Default is 0
pre_command =
Shell command to run before the rsync starts.
post_command =
Shell command to run after the rsync finishes.
log_file = ./log/LDP.log
Location of the repo log file. Rsync STDOUT and STDERR are piped here.
async_sleep = 2h
Time to wait after a sync has completed before it is re-queued.
hourly_sync = 0,6.5,12,18.5
Strict time frame for syncs to run.
Usage¶
Source Docs¶
repo.py¶
- class mirrors.repo.Repo(name, config)[source]¶
- __init__(name, config)[source]¶
A repo object which stores info about a single repo.
Parameters: - name (str) – Name of repo
- config (ConfigParser.ConfigParser) – running config options
- __weakref__¶
list of weak references to the object (if defined)
- class rsync_thread(name, config)[source]¶
Extended threading.Thread class to control rsync via subprocess.
Parameters: - name (str) – Name of repo
- config (Configparser.Configparser) – Running config options
- Repo.running_time()[source]¶
Total running time of active sync.
Return type: int Returns: An int of total syncing time elapsed Return type: None Returns: None if not syncing
- class mirrors.repo.RepoManager(config)[source]¶
- __init__(config)[source]¶
Singleton manager of the repositories and threading.
Parameters: config (Configparser.Configparser) – Running config options
- __metaclass__¶
alias of Singleton
- __weakref__¶
list of weak references to the object (if defined)
- activate(name)[source]¶
Activate repo for syncing.
Parameters: name (str) – Name of Repo Raises Repo.RepoError: if no repo exists by given name
- add_repo(name)[source]¶
Create a repo for a section in the running config.
Parameters: name (str) – Name of repo Raises Repo.RepoConfigError: if no config exists for given repo name
- deactivate(name)[source]¶
Deactivate repo from syncing.
Parameters: name (str) – Name of repo Raises Repo.RepoError: if no repo exists by given name
- del_repo(name)[source]¶
Delete repo object from dict.
Parameters: name (str) – Name of repo Raises Repo.RepoError: if no repo exists by passed in name.
- enqueue(name)[source]¶
Add repo to the queue.
Parameters: name (str) – Name of repo Raises Repo.RepoError: if repo is already queued or doesn’t exist