mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
apt resources: Yoloimplement extras repo management
This commit is contained in:
parent
55963bef23
commit
33d4dc9749
1 changed files with 16 additions and 8 deletions
|
@ -30,7 +30,7 @@ from moulinette.utils.filesystem import (
|
||||||
rm,
|
rm,
|
||||||
)
|
)
|
||||||
|
|
||||||
from yunohost.utils.error import YunohostError, YunohostValidationError
|
from yunohost.utils.error import YunohostError
|
||||||
from yunohost.hook import hook_exec
|
from yunohost.hook import hook_exec
|
||||||
|
|
||||||
logger = getActionLogger("yunohost.app_resources")
|
logger = getActionLogger("yunohost.app_resources")
|
||||||
|
@ -210,7 +210,7 @@ class PermissionsResource(AppResource):
|
||||||
properties[perm]["show_tile"] = bool(properties[perm]["url"])
|
properties[perm]["show_tile"] = bool(properties[perm]["url"])
|
||||||
|
|
||||||
if isinstance(properties["main"]["url"], str) and properties["main"]["url"] != "/":
|
if isinstance(properties["main"]["url"], str) and properties["main"]["url"] != "/":
|
||||||
raise YunohostError("URL for the 'main' permission should be '/' for webapps (or undefined/None for non-webapps). Note that / refers to the install url of the app")
|
raise YunohostValidationError("URL for the 'main' permission should be '/' for webapps (or undefined/None for non-webapps). Note that / refers to the install url of the app")
|
||||||
|
|
||||||
super().__init__({"permissions": properties}, *args, **kwargs)
|
super().__init__({"permissions": properties}, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -523,17 +523,25 @@ class AptDependenciesAppResource(AppResource):
|
||||||
"extras": {}
|
"extras": {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, properties: Dict[str, Any], *args, **kwargs):
|
||||||
|
|
||||||
|
for key, values in properties.get("extras", {}).items():
|
||||||
|
if not all(isinstance(values.get(k), str) for k in ["repo", "key", "packages"]):
|
||||||
|
raise YunohostError("In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' and 'packages' defined and be strings")
|
||||||
|
|
||||||
|
super().__init__(properties, *args, **kwargs)
|
||||||
|
|
||||||
def provision_or_update(self, context: Dict):
|
def provision_or_update(self, context: Dict):
|
||||||
|
|
||||||
# FIXME : implement 'extras' management
|
script = [f"ynh_install_app_dependencies {self.packages}"]
|
||||||
self._run_script("provision_or_update",
|
for repo, values in self.extras.items():
|
||||||
"ynh_install_app_dependencies $apt_dependencies",
|
script += [f"ynh_install_extra_app_dependencies --repo='{values['repo']}' --key='{values['key']}' --package='{values['packages']}'"]
|
||||||
{"apt_dependencies": self.packages})
|
|
||||||
|
self._run_script("provision_or_update", '\n'.join(script))
|
||||||
|
|
||||||
def deprovision(self, context: Dict):
|
def deprovision(self, context: Dict):
|
||||||
|
|
||||||
self._run_script("deprovision",
|
self._run_script("deprovision", "ynh_remove_app_dependencies")
|
||||||
"ynh_remove_app_dependencies")
|
|
||||||
|
|
||||||
|
|
||||||
class PortResource(AppResource):
|
class PortResource(AppResource):
|
||||||
|
|
Loading…
Add table
Reference in a new issue