mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-27 14:22:10 +00:00
some improvements
This commit is contained in:
@ -54,6 +54,8 @@ In order to migrate to new filesystem tree the following actions are required:
|
|||||||
|
|
||||||
Alternatively it can be done by running ``service-setup`` command again.
|
Alternatively it can be done by running ``service-setup`` command again.
|
||||||
|
|
||||||
|
#. If you didn't run setup command on the previous step, make sure to remove architecture reference from ``web`` section (if any).
|
||||||
|
|
||||||
#.
|
#.
|
||||||
Make sure to update remote synchronization services if any. Almost all of them rely on current repository tree by default, so you need to setup either redirects or configure to synchronize to the old locations (e.g. ``object_path`` option for S3 synchronization).
|
Make sure to update remote synchronization services if any. Almost all of them rely on current repository tree by default, so you need to setup either redirects or configure to synchronize to the old locations (e.g. ``object_path`` option for S3 synchronization).
|
||||||
|
|
||||||
|
@ -55,11 +55,6 @@
|
|||||||
<i class="bi bi-play"></i> update
|
<i class="bi bi-play"></i> update
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<button id="package-update-all-button" class="btn dropdown-item" onclick="updateAllPackages()" hidden>
|
|
||||||
<i class="bi bi-play"></i> update all
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<button id="package-rebuild-button" class="btn dropdown-item" data-bs-toggle="modal" data-bs-target="#package-rebuild-modal" hidden>
|
<button id="package-rebuild-button" class="btn dropdown-item" data-bs-toggle="modal" data-bs-target="#package-rebuild-modal" hidden>
|
||||||
<i class="bi bi-arrow-clockwise"></i> rebuild
|
<i class="bi bi-arrow-clockwise"></i> rebuild
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
const packageRebuildButton = $("#package-rebuild-button");
|
const packageRebuildButton = $("#package-rebuild-button");
|
||||||
const packageRemoveButton = $("#package-remove-button");
|
const packageRemoveButton = $("#package-remove-button");
|
||||||
const packageUpdateButton = $("#package-update-button");
|
const packageUpdateButton = $("#package-update-button");
|
||||||
const packageUpdateAllButton = $("#package-update-all-button");
|
|
||||||
|
|
||||||
let repository = null;
|
let repository = null;
|
||||||
$("#repositories a").on("click", (event) => {
|
$("#repositories a").on("click", (event) => {
|
||||||
@ -97,24 +96,12 @@
|
|||||||
doPackageAction(url, currentSelection, repository, onSuccess, onFailure);
|
doPackageAction(url, currentSelection, repository, onSuccess, onFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAllPackages() {
|
|
||||||
const onSuccess = _ => "Repository update has been run";
|
|
||||||
const onFailure = error => `Packages update failed: ${error}`;
|
|
||||||
{% for repository in repositories %}
|
|
||||||
doPackageAction("/api/v1/service/update", [], {
|
|
||||||
architecture: "{{ repository.architecture }}",
|
|
||||||
repository: "{{ repository.repository }}",
|
|
||||||
}, onSuccess, onFailure);
|
|
||||||
{% endfor %}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideControls(hidden) {
|
function hideControls(hidden) {
|
||||||
keyImportButton.attr("hidden", hidden);
|
keyImportButton.attr("hidden", hidden);
|
||||||
packageAddButton.attr("hidden", hidden);
|
packageAddButton.attr("hidden", hidden);
|
||||||
packageRebuildButton.attr("hidden", hidden);
|
packageRebuildButton.attr("hidden", hidden);
|
||||||
packageRemoveButton.attr("hidden", hidden);
|
packageRemoveButton.attr("hidden", hidden);
|
||||||
packageUpdateButton.attr("hidden", hidden);
|
packageUpdateButton.attr("hidden", hidden);
|
||||||
packageUpdateAllButton.attr("hidden", hidden);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
|
@ -45,14 +45,18 @@ class StatusUpdate(Handler):
|
|||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
"""
|
"""
|
||||||
# we are using reporter here
|
application = Application(repository_id, configuration, report=True)
|
||||||
client = Application(repository_id, configuration, report=True).repository.reporter
|
client = application.repository.reporter
|
||||||
|
|
||||||
match args.action:
|
match args.action:
|
||||||
case Action.Update if args.package:
|
case Action.Update if args.package:
|
||||||
# update packages statuses
|
# update packages statuses
|
||||||
for package in args.package:
|
packages = application.repository.packages()
|
||||||
client.package_update(package, args.status)
|
for base in args.package:
|
||||||
|
if (local := next((package for package in packages if package.base == base), None)) is not None:
|
||||||
|
client.package_add(local, args.status)
|
||||||
|
else:
|
||||||
|
client.package_update(base, args.status)
|
||||||
case Action.Update:
|
case Action.Update:
|
||||||
# update service status
|
# update service status
|
||||||
client.status_update(args.status)
|
client.status_update(args.status)
|
||||||
|
@ -63,7 +63,7 @@ class Configuration(configparser.RawConfigParser):
|
|||||||
>>> path, repository_id = configuration.check_loaded()
|
>>> path, repository_id = configuration.check_loaded()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ARCHITECTURE_SPECIFIC_SECTIONS = ["alpm", "build", "sign", "web"]
|
ARCHITECTURE_SPECIFIC_SECTIONS = ["alpm", "build", "sign"]
|
||||||
SYSTEM_CONFIGURATION_PATH = Path(sys.prefix) / "share" / "ahriman" / "settings" / "ahriman.ini"
|
SYSTEM_CONFIGURATION_PATH = Path(sys.prefix) / "share" / "ahriman" / "settings" / "ahriman.ini"
|
||||||
converters: dict[str, Callable[[str], Any]] # typing guard
|
converters: dict[str, Callable[[str], Any]] # typing guard
|
||||||
|
|
||||||
|
@ -47,13 +47,16 @@ def test_run_packages(args: argparse.Namespace, configuration: Configuration, re
|
|||||||
must run command with specified packages
|
must run command with specified packages
|
||||||
"""
|
"""
|
||||||
args = _default_args(args)
|
args = _default_args(args)
|
||||||
args.package = [package_ahriman.base]
|
args.package = [package_ahriman.base, "package"]
|
||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
|
mocker.patch("ahriman.core.repository.repository.Repository.packages", return_value=[package_ahriman])
|
||||||
|
add_mock = mocker.patch("ahriman.core.status.client.Client.package_add")
|
||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.package_update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.package_update")
|
||||||
|
|
||||||
_, repository_id = configuration.check_loaded()
|
_, repository_id = configuration.check_loaded()
|
||||||
StatusUpdate.run(args, repository_id, configuration, report=False)
|
StatusUpdate.run(args, repository_id, configuration, report=False)
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, args.status)
|
add_mock.assert_called_once_with(package_ahriman, args.status)
|
||||||
|
update_mock.assert_called_once_with("package", args.status)
|
||||||
|
|
||||||
|
|
||||||
def test_run_remove(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
def test_run_remove(args: argparse.Namespace, configuration: Configuration, repository: Repository,
|
||||||
|
Reference in New Issue
Block a user