Package entropy :: Package server :: Package interfaces :: Module mirrors :: Class Server

Class Server

source code


Instance Methods
 
__init__(self, server, repository_id)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
bool
lock_mirrors(self, repository_id, lock, mirrors=None, unlock_locally=True, quiet=False)
Lock remote mirrors for given repository.
source code
bool
lock_mirrors_for_download(self, repository_id, lock, mirrors=None, unlock_locally=True, quiet=False)
This functions makes Entropy clients unable to download the repository from given mirrors.
source code
bool
download_package(self, repository_id, uri, pkg_relative_path)
Download a package given its mirror uri (uri) and its relative path (pkg_relative_path) on behalf of given repository.
source code
dict
remote_repository_status(self, repository_id)
Return the repository status (revision) for every available mirror.
source code
list
mirrors_status(self, repository_id)
Return mirrors status for given repository identifier.
source code
bool
mirror_locked(self, repository_id, uri)
Return whether mirror is locked.
source code
int
sync_repository(self, repository_id, enable_upload=True, enable_download=True, force=False)
Synchronize the given repository identifier.
source code
tuple
sync_packages(self, repository_id, ask=True, pretend=False, packages_check=False)
Synchronize packages in given repository, uploading, downloading, removing them.
source code
bool
tidy_mirrors(self, repository_id, ask=True, pretend=False, expiration_days=None)
Cleanup package mirrors for given repository from outdated package files.
source code
bool
download_notice_board(self, repository_id)
Download notice board for given repository identifier.
source code
bool
remove_notice_board(self, repository_id)
Remove notice board for given repository identifier.
source code
bool
upload_notice_board(self, repository_id)
Upload notice board for given repository identifier.
source code
bool
update_notice_board(self, repository_id, title, notice_text, link=None)
Update notice board adding a new entry, provided by a title and a body message (notice_text).
source code
tuple or None
read_notice_board(self, repository_id, do_download=True)
Read content of noticeboard for given repository.
source code
bool
remove_from_notice_board(self, repository_id, identifier)
Remove entry from noticeboard of given repository.
source code

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

Class Variables
  SYSTEM_SETTINGS_PLG_ID = 'server_plugin'
Properties

Inherited from object: __class__

Method Details

__init__(self, server, repository_id)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

lock_mirrors(self, repository_id, lock, mirrors=None, unlock_locally=True, quiet=False)

source code 

Lock remote mirrors for given repository. In this way repository will be locked for both Entropy Server and Entropy Client instances.

Parameters:
  • repository_id (string) - repository identifier
  • lock (bool) - True, for lock, False for unlock
  • mirrors (list) - provide a list of repository mirrors and override the current ones (which are stored inside repository metadata)
  • unlock_locally (bool) - True, if local mirror lock file should be handled too (in case of shadow repos local lock file should not be touched)
Returns: bool
True, if action is successfull

lock_mirrors_for_download(self, repository_id, lock, mirrors=None, unlock_locally=True, quiet=False)

source code 

This functions makes Entropy clients unable to download the repository from given mirrors.

Parameters:
  • repository_id (string) - repository identifier
  • lock (bool) - True, for lock, False for unlock
  • mirrors (list) - provide a list of repository mirrors and override the current ones (which are stored inside repository metadata)
  • unlock_locally (bool) - True, if local mirror lock file should be handled too (in case of shadow repos local lock file should not be touched)
Returns: bool
True, if action is successfull

download_package(self, repository_id, uri, pkg_relative_path)

source code 

Download a package given its mirror uri (uri) and its relative path (pkg_relative_path) on behalf of given repository.

Parameters:
  • repository_id (string) - repository identifier
  • uri (string) - mirror uri belonging to given repository identifier
  • pkg_relative_path (string) - relative path to package
Returns: bool
download status, True for success, False for failure

remote_repository_status(self, repository_id)

source code 

Return the repository status (revision) for every available mirror.

Parameters:
  • repository_id (string) - repository identifier
Returns: dict
dictionary, mirror URL (not URI) as key, revision as value (int)

mirrors_status(self, repository_id)

source code 

Return mirrors status for given repository identifier.

Parameters:
  • repository_id (string) - repository identifier
Returns: list
list of tuples of length 3 [(uri, upload_lock_status_bool, download_lock_status_bool)]

mirror_locked(self, repository_id, uri)

source code 

Return whether mirror is locked.

Parameters:
  • repository_id (string) - the repository identifier
  • uri (string) - mirror uri, as listed in repository metadata
Returns: bool
True, if mirror is locked

sync_repository(self, repository_id, enable_upload=True, enable_download=True, force=False)

source code 

Synchronize the given repository identifier.

Parameters:
  • repository_id (string) - repository identifier
  • enable_upload (bool) - enable upload in case it's required to push the repository remotely
  • enable_download (bool) - enable download in case it's required to pull the repository remotely
  • force (bool) - force the repository push in case of QA errors
Returns: int
status code, 0 means all fine, non zero values mean error

sync_packages(self, repository_id, ask=True, pretend=False, packages_check=False)

source code 

Synchronize packages in given repository, uploading, downloading, removing them. If changes were made locally, this function will do all the duties required to update the remote mirrors.

Parameters:
  • repository_id (string) - repository identifier
  • ask (bool) - be interactive and ask user for confirmation
  • pretend (bool) - just execute without effectively change anything on mirrors
  • packages_check (bool) - verify local packages after the sync.
Returns: tuple
tuple composed by (mirrors_tainted (bool), mirror_errors(bool), successfull_mirrors (list), broken_mirrors (list), check_data (dict))

To Do: improve return data documentation

tidy_mirrors(self, repository_id, ask=True, pretend=False, expiration_days=None)

source code 

Cleanup package mirrors for given repository from outdated package files. A package file is considered outdated if the corresponding entry in the repository database has been removed and the removal is ETP_EXPIRATION_DAYS (env var) days old (default is given by: etpConst['packagesexpirationdays'] and can be changed in server.conf).

Parameters:
  • repository_id (string) - repository identifier
  • ask (bool) - be interactive and ask user for confirmation
  • pretend (bool) - just execute without effectively change anything on mirrors
  • expiration_days - days after a package is considered expired
Returns: bool
True, if tidy went successful, False if not

download_notice_board(self, repository_id)

source code 

Download notice board for given repository identifier.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True if download went successful.

remove_notice_board(self, repository_id)

source code 

Remove notice board for given repository identifier.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True if removal went successful.

upload_notice_board(self, repository_id)

source code 

Upload notice board for given repository identifier.

Parameters:
  • repository_id (string) - repository identifier
Returns: bool
True if upload went successful.

update_notice_board(self, repository_id, title, notice_text, link=None)

source code 

Update notice board adding a new entry, provided by a title and a body message (notice_text). Providing a link is optional.

Parameters:
  • repository_id (string) - repository identifier
  • title (string) - noticeboard new entry title
  • notice_text (string) - noticeboard new entry text
  • link (string) - optional link to provide with the noticeboard entry
Returns: bool
True if update went successful.

read_notice_board(self, repository_id, do_download=True)

source code 

Read content of noticeboard for given repository. do_download, if True, fetches the noticeboard directly from the remote repository before returning its content. If noticeboard cannot be downloaded or do_download is False and there is any local cache, None will be returned.

Parameters:
  • repository_id (string) - repository identifier
Returns: tuple or None
the output of entropy.misc.RSS.get_entries() or None

remove_from_notice_board(self, repository_id, identifier)

source code 

Remove entry from noticeboard of given repository. read_notice_board() returns an object containing a list of entries, identifier here represents the index of that list, if it exists.

Parameters:
  • repository_id (string) - repository identifier
  • identifier (int) - notice board identifier
Returns: bool
True, if operation is successful, False otherwise