Apply suggestions from code review

This commit is contained in:
Alexandre Aubin 2021-08-08 19:00:03 +02:00 committed by GitHub
parent 75ab54ee14
commit 6f908e9ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -518,8 +518,7 @@ def app_upgrade(app=[], url=None, file=None, force=False):
apps = app apps = app
# Check if disk space available # Check if disk space available
size = os.statvfs('/') if free_space_in_directory("/") <= 512 * 1000 * 1000:
if (size.f_bavail * size.f_frsize) / 1024 <= 512000:
raise YunohostValidationError("disk_space_not_sufficient_update") raise YunohostValidationError("disk_space_not_sufficient_update")
# If no app is specified, upgrade all apps # If no app is specified, upgrade all apps
if not apps: if not apps:
@ -882,7 +881,7 @@ def app_install(
# Check if disk space available # Check if disk space available
size = os.statvfs('/') size = os.statvfs('/')
if (size.f_bavail * size.f_frsize) / 1024 <= 512000: if free_space_in_directory("/") <= 512 * 1000 * 1000:
raise YunohostValidationError("disk_space_not_sufficient_install") raise YunohostValidationError("disk_space_not_sufficient_install")
# Check ID # Check ID