mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-28 09:17:17 +00:00
Compare commits
2 Commits
3016a919c5
...
2414686f3c
Author | SHA1 | Date | |
---|---|---|---|
2414686f3c | |||
60bb880f9f |
@ -189,8 +189,7 @@ class Repository(Properties):
|
||||
no_local(bool): do not check local packages for updates
|
||||
no_manual(bool): do not check for manual updates
|
||||
no_vcs(bool): do not check VCS packages
|
||||
log_fn(Callable[[str]): logger function to log updates
|
||||
None]:
|
||||
log_fn(Callable[[str], None]): logger function to log updates
|
||||
|
||||
Returns:
|
||||
List[Package]: list of out-of-dated packages
|
||||
|
@ -66,11 +66,11 @@ class Lock:
|
||||
"""
|
||||
default workflow is the following:
|
||||
|
||||
check user UID
|
||||
check if there is lock file
|
||||
check web status watcher status
|
||||
create lock file
|
||||
report to status page if enabled
|
||||
1. Check user UID
|
||||
2. Check if there is lock file
|
||||
3. Check web status watcher status
|
||||
4. Create lock file
|
||||
5. Report to status page if enabled
|
||||
"""
|
||||
self.check_user()
|
||||
self.check_version()
|
||||
|
@ -36,7 +36,8 @@ class Configuration(configparser.RawConfigParser):
|
||||
extension for built-in configuration parser
|
||||
|
||||
Attributes:
|
||||
ARCHITECTURE_SPECIFIC_SECTIONS(List[str]): (class attribute) known sections which can be architecture specific (required by dump)
|
||||
ARCHITECTURE_SPECIFIC_SECTIONS(List[str]): (class attribute) known sections which can be architecture specific.
|
||||
Required by dump and merging functions
|
||||
DEFAULT_LOG_FORMAT(str): (class attribute) default log format (in case of fallback)
|
||||
DEFAULT_LOG_LEVEL(int): (class attribute) default log level (in case of fallback)
|
||||
SYSTEM_CONFIGURATION_PATH(Path): (class attribute) default system configuration path distributed by package
|
||||
@ -127,7 +128,7 @@ class Configuration(configparser.RawConfigParser):
|
||||
quote_mark = char
|
||||
elif char == quote_mark: # quoted part ended, reset quotation
|
||||
quote_mark = None
|
||||
elif char == " " and quote_mark is None: # found space outside of the quotation, yield the word
|
||||
elif char == " " and quote_mark is None: # found space outside the quotation, yield the word
|
||||
yield word
|
||||
word = ""
|
||||
else: # append character to the buffer
|
||||
|
@ -148,7 +148,8 @@ class Executor(Cleaner):
|
||||
generate reports
|
||||
|
||||
Args:
|
||||
targets(Optional[Iterable[str]]): list of targets to generate reports. Configuration option will be used if it is not set
|
||||
targets(Optional[Iterable[str]]): list of targets to generate reports. Configuration option will be used
|
||||
if it is not set
|
||||
result(Result): build result
|
||||
"""
|
||||
if targets is None:
|
||||
@ -162,7 +163,8 @@ class Executor(Cleaner):
|
||||
process synchronization to remote servers
|
||||
|
||||
Args:
|
||||
targets(Optional[Iterable[str]]): list of targets to sync. Configuration option will be used if it is not set
|
||||
targets(Optional[Iterable[str]]): list of targets to sync. Configuration option will be used
|
||||
if it is not set
|
||||
built_packages(Iterable[Package]): list of packages which has just been built
|
||||
"""
|
||||
if targets is None:
|
||||
|
@ -34,8 +34,8 @@ class Github(HttpUpload):
|
||||
upload files to github releases
|
||||
|
||||
Attributes:
|
||||
gh_owner(str): github repository owner
|
||||
gh_repository(str): github repository name
|
||||
github_owner(str): github repository owner
|
||||
github_repository(str): github repository name
|
||||
"""
|
||||
|
||||
def __init__(self, architecture: str, configuration: Configuration, section: str) -> None:
|
||||
@ -48,8 +48,8 @@ class Github(HttpUpload):
|
||||
section(str): settings section name
|
||||
"""
|
||||
HttpUpload.__init__(self, architecture, configuration, section)
|
||||
self.gh_owner = configuration.get(section, "owner")
|
||||
self.gh_repository = configuration.get(section, "repository")
|
||||
self.github_owner = configuration.get(section, "owner")
|
||||
self.github_repository = configuration.get(section, "repository")
|
||||
|
||||
def asset_remove(self, release: Dict[str, Any], name: str) -> None:
|
||||
"""
|
||||
@ -133,8 +133,8 @@ class Github(HttpUpload):
|
||||
Returns:
|
||||
Dict[str, Any]: github API release object for the new release
|
||||
"""
|
||||
response = self._request("POST", f"https://api.github.com/repos/{self.gh_owner}/{self.gh_repository}/releases",
|
||||
json={"tag_name": self.architecture, "name": self.architecture})
|
||||
url = f"https://api.github.com/repos/{self.github_owner}/{self.github_repository}/releases"
|
||||
response = self._request("POST", url, json={"tag_name": self.architecture, "name": self.architecture})
|
||||
release: Dict[str, Any] = response.json()
|
||||
return release
|
||||
|
||||
@ -145,10 +145,9 @@ class Github(HttpUpload):
|
||||
Returns:
|
||||
Optional[Dict[str, Any]]: github API release object if release found and None otherwise
|
||||
"""
|
||||
url = f"https://api.github.com/repos/{self.github_owner}/{self.github_repository}/releases/tags/{self.architecture}"
|
||||
try:
|
||||
response = self._request(
|
||||
"GET",
|
||||
f"https://api.github.com/repos/{self.gh_owner}/{self.gh_repository}/releases/tags/{self.architecture}")
|
||||
response = self._request("GET", url)
|
||||
release: Dict[str, Any] = response.json()
|
||||
return release
|
||||
except requests.HTTPError as e:
|
||||
|
@ -47,9 +47,6 @@ class SignSettings(Enum):
|
||||
|
||||
Returns:
|
||||
SignSettings: parsed value
|
||||
|
||||
Raises:
|
||||
InvalidOption: if unsupported option suppled
|
||||
"""
|
||||
if value.lower() in ("package", "packages", "sign-package"):
|
||||
return cls.Packages
|
||||
|
@ -25,7 +25,8 @@ class UserAccess(Enum):
|
||||
web user access enumeration
|
||||
|
||||
Attributes:
|
||||
Safe(UserAccess): (class attribute) user can access the page without authorization, should not be user for user configuration
|
||||
Safe(UserAccess): (class attribute) user can access the page without authorization,
|
||||
should not be used for user configuration
|
||||
Read(UserAccess): (class attribute) user can read the page
|
||||
Write(UserAccess): (class attribute) user can modify task and package list
|
||||
"""
|
||||
|
@ -39,34 +39,34 @@ def setup_routes(application: Application, static_path: Path) -> None:
|
||||
|
||||
Available routes are:
|
||||
|
||||
GET / get build status page
|
||||
GET /index.html same as above
|
||||
* GET / get build status page
|
||||
* GET /index.html same as above
|
||||
|
||||
POST /service-api/v1/add add new packages to repository
|
||||
* POST /service-api/v1/add add new packages to repository
|
||||
|
||||
POST /service-api/v1/remove remove existing package from repository
|
||||
* POST /service-api/v1/remove remove existing package from repository
|
||||
|
||||
POST /service-api/v1/request request to add new packages to repository
|
||||
* POST /service-api/v1/request request to add new packages to repository
|
||||
|
||||
GET /service-api/v1/search search for substring in AUR
|
||||
* GET /service-api/v1/search search for substring in AUR
|
||||
|
||||
POST /service-api/v1/update update packages in repository, actually it is just alias for add
|
||||
* POST /service-api/v1/update update packages in repository, actually it is just alias for add
|
||||
|
||||
GET /status-api/v1/ahriman get current service status
|
||||
POST /status-api/v1/ahriman update service status
|
||||
* GET /status-api/v1/ahriman get current service status
|
||||
* POST /status-api/v1/ahriman update service status
|
||||
|
||||
GET /status-api/v1/packages get all known packages
|
||||
POST /status-api/v1/packages force update every package from repository
|
||||
* GET /status-api/v1/packages get all known packages
|
||||
* POST /status-api/v1/packages force update every package from repository
|
||||
|
||||
DELETE /status-api/v1/package/:base delete package base from status page
|
||||
GET /status-api/v1/package/:base get package base status
|
||||
POST /status-api/v1/package/:base update package base status
|
||||
* DELETE /status-api/v1/package/:base delete package base from status page
|
||||
* GET /status-api/v1/package/:base get package base status
|
||||
* POST /status-api/v1/package/:base update package base status
|
||||
|
||||
GET /status-api/v1/status get web service status itself
|
||||
* GET /status-api/v1/status get web service status itself
|
||||
|
||||
GET /user-api/v1/login OAuth2 handler for login
|
||||
POST /user-api/v1/login login to service
|
||||
POST /user-api/v1/logout logout from service
|
||||
* GET /user-api/v1/login OAuth2 handler for login
|
||||
* POST /user-api/v1/login login to service
|
||||
* POST /user-api/v1/logout logout from service
|
||||
|
||||
Args:
|
||||
application(Application): web application instance
|
||||
|
@ -99,7 +99,8 @@ class BaseView(View):
|
||||
extract json data from either json or form data
|
||||
|
||||
Args:
|
||||
list_keys(Optional[List[str]], optional): optional list of keys which must be forced to list from form data (Default value = None)
|
||||
list_keys(Optional[List[str]], optional): optional list of keys which must be forced to list from form data
|
||||
(Default value = None)
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: raw json object or form data converted to json
|
||||
@ -118,7 +119,8 @@ class BaseView(View):
|
||||
list_keys(List[str]): list of keys which must be forced to list from form data
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: form data converted to json. In case if a key is found multiple times it will be returned as list
|
||||
Dict[str, Any]: form data converted to json. In case if a key is found multiple times
|
||||
it will be returned as list
|
||||
"""
|
||||
raw = await self.request.post()
|
||||
json: Dict[str, Any] = {}
|
||||
|
@ -17,9 +17,6 @@ def mapping(configuration: Configuration, database: SQLite) -> Mapping:
|
||||
|
||||
Returns:
|
||||
Mapping: auth service instance
|
||||
|
||||
Raises:
|
||||
|
||||
"""
|
||||
return Mapping(configuration, database)
|
||||
|
||||
@ -35,9 +32,6 @@ def oauth(configuration: Configuration, database: SQLite) -> OAuth:
|
||||
|
||||
Returns:
|
||||
OAuth: OAuth2 service instance
|
||||
|
||||
Raises:
|
||||
|
||||
"""
|
||||
configuration.set("web", "address", "https://example.com")
|
||||
return OAuth(configuration, database)
|
||||
|
Loading…
Reference in New Issue
Block a user