mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
apps: tweaks to be more robust and prevent the stupid flood of 'sh: 0: getcwd() failed: No such file or directory' when running an app upgrade/remove from /var/www/$app, sometimes making it look like the upgrade failed when it didnt
This commit is contained in:
parent
3e1c9ebaf7
commit
a349fc0334
2 changed files with 5 additions and 3 deletions
|
@ -688,13 +688,15 @@ def _get_services():
|
||||||
]
|
]
|
||||||
for name in services_with_package_condition:
|
for name in services_with_package_condition:
|
||||||
package = services[name]["ignore_if_package_is_not_installed"]
|
package = services[name]["ignore_if_package_is_not_installed"]
|
||||||
if os.system(f"dpkg --list | grep -q 'ii *{package}'") != 0:
|
if check_output(f"dpkg-query --show --showformat='${{db:Status-Status}}' '{package}' 2>/dev/null || true") != "installed":
|
||||||
del services[name]
|
del services[name]
|
||||||
|
|
||||||
php_fpm_versions = check_output(
|
php_fpm_versions = check_output(
|
||||||
r"dpkg --list | grep -P 'ii php\d.\d-fpm' | awk '{print $2}' | grep -o -P '\d.\d' || true"
|
r"dpkg --list | grep -P 'ii php\d.\d-fpm' | awk '{print $2}' | grep -o -P '\d.\d' || true",
|
||||||
|
cwd="/tmp"
|
||||||
)
|
)
|
||||||
php_fpm_versions = [v for v in php_fpm_versions.split("\n") if v.strip()]
|
php_fpm_versions = [v for v in php_fpm_versions.split("\n") if v.strip()]
|
||||||
|
|
||||||
for version in php_fpm_versions:
|
for version in php_fpm_versions:
|
||||||
# Skip php 7.3 which is most likely dead after buster->bullseye migration
|
# Skip php 7.3 which is most likely dead after buster->bullseye migration
|
||||||
# because users get spooked
|
# because users get spooked
|
||||||
|
|
|
@ -159,7 +159,7 @@ def ynh_packages_version(*args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def dpkg_is_broken():
|
def dpkg_is_broken():
|
||||||
if check_output("dpkg --audit") != "":
|
if check_output("dpkg --audit", cwd="/tmp/") != "":
|
||||||
return True
|
return True
|
||||||
# If dpkg is broken, /var/lib/dpkg/updates
|
# If dpkg is broken, /var/lib/dpkg/updates
|
||||||
# will contains files like 0001, 0002, ...
|
# will contains files like 0001, 0002, ...
|
||||||
|
|
Loading…
Add table
Reference in a new issue