mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #1266 from lelibreauquotidien/add-free-size-disk-verification
[enh] Add check for available disk space before app install/upgrade
This commit is contained in:
commit
79e8240fd1
3 changed files with 12 additions and 0 deletions
|
@ -273,6 +273,8 @@
|
|||
"diagnosis_sshd_config_insecure": "The SSH configuration appears to have been manually modified, and is insecure because it contains no 'AllowGroups' or 'AllowUsers' directive to limit access to authorized users.",
|
||||
"diagnosis_sshd_config_inconsistent": "It looks like the SSH port was manually modified in /etc/ssh/sshd_config. Since YunoHost 4.2, a new global setting 'security.ssh.port' is available to avoid manually editing the configuration.",
|
||||
"diagnosis_sshd_config_inconsistent_details": "Please run <cmd>yunohost settings set security.ssh.port -v YOUR_SSH_PORT</cmd> to define the SSH port, and check <cmd>yunohost tools regen-conf ssh --dry-run --with-diff</cmd> and <cmd>yunohost tools regen-conf ssh --force</cmd> to reset your conf to the YunoHost recommendation.",
|
||||
"disk_space_not_sufficient_install": "There is not enough disk space left to install this application",
|
||||
"disk_space_not_sufficient_update": "There is not enough disk space left to update this application",
|
||||
"domain_cannot_remove_main": "You cannot remove '{domain}' since it's the main domain, you first need to set another domain as the main domain using 'yunohost domain main-domain -n <another-domain>'; here is the list of candidate domains: {other_domains}",
|
||||
"domain_cannot_add_xmpp_upload": "You cannot add domains starting with 'xmpp-upload.'. This kind of name is reserved for the XMPP upload feature integrated in YunoHost.",
|
||||
"domain_cannot_remove_main_add_new_one": "You cannot remove '{domain}' since it's the main domain and your only domain, you need to first add another domain using 'yunohost domain add <another-domain.com>', then set is as the main domain using 'yunohost domain main-domain -n <another-domain.com>' and then you can remove the domain '{domain}' using 'yunohost domain remove {domain}'.'",
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
"backup_output_directory_required": "Vous devez spécifier un dossier de destination pour la sauvegarde",
|
||||
"backup_running_hooks": "Exécution des scripts de sauvegarde...",
|
||||
"custom_app_url_required": "Vous devez spécifier une URL pour mettre à jour votre application personnalisée {app}",
|
||||
"disk_space_not_sufficient_install": "Il ne reste pas assez d'espace disque pour installer cette application",
|
||||
"disk_space_not_sufficient_update": "Il ne reste pas assez d'espace disque pour mettre à jour cette application",
|
||||
"domain_cert_gen_failed": "Impossible de générer le certificat",
|
||||
"domain_created": "Le domaine a été créé",
|
||||
"domain_creation_failed": "Impossible de créer le domaine {domain} : {error}",
|
||||
|
|
|
@ -517,6 +517,9 @@ def app_upgrade(app=[], url=None, file=None, force=False):
|
|||
from yunohost.regenconf import manually_modified_files
|
||||
|
||||
apps = app
|
||||
# Check if disk space available
|
||||
if free_space_in_directory("/") <= 512 * 1000 * 1000:
|
||||
raise YunohostValidationError("disk_space_not_sufficient_update")
|
||||
# If no app is specified, upgrade all apps
|
||||
if not apps:
|
||||
# FIXME : not sure what's supposed to happen if there is a url and a file but no apps...
|
||||
|
@ -875,6 +878,11 @@ def app_install(
|
|||
manifest, extracted_app_folder = _extract_app_from_file(app)
|
||||
else:
|
||||
raise YunohostValidationError("app_unknown")
|
||||
|
||||
# Check if disk space available
|
||||
size = os.statvfs('/')
|
||||
if free_space_in_directory("/") <= 512 * 1000 * 1000:
|
||||
raise YunohostValidationError("disk_space_not_sufficient_install")
|
||||
|
||||
# Check ID
|
||||
if "id" not in manifest or "__" in manifest["id"]:
|
||||
|
|
Loading…
Add table
Reference in a new issue