From 3a6f3c37323adbfdc8ed53dcbfde79f536a4da75 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 31 May 2018 09:32:29 +0200 Subject: [PATCH 01/11] [fix] check if log exists before tailing to avoid errors --- src/yunohost/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index b252f0873..743efa6da 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -298,7 +298,7 @@ def service_log(name, number=50): for log_path in log_list: # log is a file, read it if not os.path.isdir(log_path): - result[log_path] = _tail(log_path, int(number)) + result[log_path] = _tail(log_path, int(number)) if os.path.exists(log_path) else [] continue for log_file in os.listdir(log_path): @@ -310,7 +310,7 @@ def service_log(name, number=50): if not log_file.endswith(".log"): continue - result[log_file_path] = _tail(log_file_path, int(number)) + result[log_file_path] = _tail(log_file_path, int(number)) if os.path.exists(log_file_path) else [] return result From e05b8549b92b9887348420f8d8860b9af330530e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 5 Jun 2018 18:22:50 +0200 Subject: [PATCH 02/11] Update changelog --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index 60467eec7..9bd67a3f8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +yunohost (2.7.13.4) testing; urgency=low + + * Fix a bug for services with alternate names (mysql<->mariadb) + * Fix a bug in regen conf when computing diff with files that don't exists + * Increase backup filename length + + (Fixes by Bram <3) + + -- Alexandre Aubin Tue, 05 Jun 2018 18:22:00 +0000 + yunohost (2.7.13.3) testing; urgency=low * [enh] Add postgresql helpers (#238) From ffc773c856c6c5f23391203b73bc2c1b92d96df3 Mon Sep 17 00:00:00 2001 From: Bram Date: Thu, 7 Jun 2018 13:51:10 +0200 Subject: [PATCH 03/11] [mod] we moved away from redmine --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9aed880ac..4033bd6fb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository is the core of YunoHost code. ## Issues -- [Please report issues on YunoHost bugtracker](https://dev.yunohost.org/projects/yunohost/issues) (no registration needed). +- [Please report issues on YunoHost bugtracker](https://github.com/YunoHost/issues). ## Contribute - You can develop on this repository using [ynh-dev tool](https://github.com/YunoHost/ynh-dev) with `use-git` sub-command. From cc6819691f7866f3cba5cb370537ed2085168876 Mon Sep 17 00:00:00 2001 From: Bram Date: Thu, 7 Jun 2018 14:00:04 +0200 Subject: [PATCH 04/11] [mod] we moved away from redmine --- src/yunohost/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index a4ab8db7b..18a8be84b 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1746,7 +1746,7 @@ def _check_manifest_requirements(manifest, app_instance_name): # Validate multi-instance app if is_true(manifest.get('multi_instance', False)): # Handle backward-incompatible change introduced in yunohost >= 2.3.6 - # See https://dev.yunohost.org/issues/156 + # See https://github.com/YunoHost/issues/issues/156 yunohost_req = requirements.get('yunohost', None) if (not yunohost_req or not packages.SpecifierSet(yunohost_req) & '>= 2.3.6'): From 2adc80f8db5138e354fae509b24d837d170a67cf Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 11 Jun 2018 16:18:38 +0200 Subject: [PATCH 05/11] [fix] Microdecision : bug in get_file_diff following refactoring ... --- src/yunohost/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index b56c7ad20..0ce8073fa 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -733,9 +733,9 @@ def _get_files_diff(orig_file, new_file, as_string=False, skip_header=True): else: orig_file = [] - if not os.path.exists(new_file): + if os.path.exists(new_file): with open(new_file, 'r') as new_file: - new_file.readlines() + new_file = new_file.readlines() else: new_file = [] From 3681e6adfcf33b4a4643c310ac0891fe0d87d07f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 11 Jun 2018 17:45:17 +0200 Subject: [PATCH 06/11] Attempt to make postgresql not send an email about the 9.4->9.6 migration --- src/yunohost/data_migrations/0003_migrate_to_stretch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index b2fcd08ac..8b8d37447 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -228,6 +228,8 @@ class MyMigration(Migration): # Make apt-get happy os.system("echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections") + # Don't send an email to root about the postgresql migration. It should be handled automatically after. + os.system("echo 'postgresql-common postgresql-common/obsolete-major seen true' | debconf-set-selections") command = "" command += " DEBIAN_FRONTEND=noninteractive" From 0ebfa145b8ae7184cdc78638949013457803c39a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 11 Jun 2018 23:40:23 +0200 Subject: [PATCH 07/11] Close port 465, open 587 during migration according to SMTP port change --- locales/en.json | 2 +- src/yunohost/data_migrations/0003_migrate_to_stretch.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index e7bfd2ded..37160d403 100644 --- a/locales/en.json +++ b/locales/en.json @@ -235,7 +235,7 @@ "migration_0003_not_jessie": "The current debian distribution is not Jessie !", "migration_0003_system_not_fully_up_to_date": "Your system is not fully up to date. Please perform a regular upgrade before running the migration to stretch.", "migration_0003_still_on_jessie_after_main_upgrade": "Something wrong happened during the main upgrade : system is still on Jessie !? To investigate the issue, please look at {log} :s ...", - "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.", + "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app. More infos on https://yunohost.org/backup ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.\n\nAdditionally, the port for SMTP, used by external email clients like (Thunderbird or K9-Mail) was changed from 465 (SSL/TLS) to 587 (STARTTLS). The old port 465 will automatically be closed and the new port 587 will be opened in the firewall. You and your users *will* have to adapt the configuration of your email clients accordingly!", "migration_0003_problematic_apps_warning": "Please note that the following possibly problematic installed apps were detected. It looks like those were not installed from an applist or are not flagged as 'working'. Consequently, we cannot guarantee that they will still work after the upgrade : {problematic_apps}", "migration_0003_modified_files": "Please note that the following files were found to be manually modified and might be overwritten at the end of the upgrade : {manually_modified_files}", "migrations_backward": "Migrating backward.", diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 8b8d37447..6900b678a 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -15,6 +15,7 @@ from yunohost.service import (_run_service_command, manually_modified_files_compared_to_debian_default) from yunohost.utils.filesystem import free_space_in_directory from yunohost.utils.packages import get_installed_version +from yunohost.firewall import firewall_allow, firewall_disallow logger = getActionLogger('yunohost.migration') @@ -72,6 +73,11 @@ class MyMigration(Migration): os.system("apt autoremove --assume-yes") os.system("apt clean --assume-yes") + # We moved to port 587 for SMTP + # https://busylog.net/smtp-tls-ssl-25-465-587/ + firewall_allow("Both", 587) + firewall_disallow("Both", 465) + # Upgrade yunohost packages logger.warning(m18n.n("migration_0003_yunohost_upgrade")) self.restore_files_to_keep() From f96aa4450537dec77c4c1479bbdb1f36ad24d3c0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:05:47 +0200 Subject: [PATCH 08/11] Rely on the codename instead of release number because lsb_release is fokin stupid --- .../data_migrations/0003_migrate_to_stretch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 6900b678a..add511a81 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -55,7 +55,7 @@ class MyMigration(Migration): _run_service_command("stop", "mysql") self.apt_dist_upgrade(conf_flags=["old", "miss", "def"]) _run_service_command("start", "mysql") - if self.debian_major_version() == 8: + if self.debian_major_version() == "jessie": raise MoulinetteError(m18n.n("migration_0003_still_on_jessie_after_main_upgrade", log=self.logfile)) # Specific upgrade for fail2ban... @@ -89,7 +89,10 @@ class MyMigration(Migration): # because "platform" relies on uname, which on some weird setups does # not behave correctly (still says running Jessie when lsb_release says # Stretch...) - return int(check_output("lsb_release -r").split("\t")[1][0]) + # Also lsb_release is fucking stupid and sometimes return "Release: 8" + # and "Codename: stretch". So apparently the codename is more reliable + # than the release number :| + return check_output("lsb_release -c").split("\t")[1].strip() def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) @@ -100,7 +103,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == 8 \ + if not self.debian_major_version() == "jessie" \ and not self.yunohost_major_version() == 2: raise MoulinetteError(m18n.n("migration_0003_not_jessie")) @@ -125,7 +128,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == 8 \ + if not self.debian_major_version() == "jessie" \ and not self.yunohost_major_version() == 2: return None From 201edd8c38b7ab333f05e38ee00a3a1e4b517504 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:29:30 +0200 Subject: [PATCH 09/11] Revert "Rely on the codename instead of release number because lsb_release is fokin stupid" This reverts commit f96aa4450537dec77c4c1479bbdb1f36ad24d3c0. --- .../data_migrations/0003_migrate_to_stretch.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index add511a81..6900b678a 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -55,7 +55,7 @@ class MyMigration(Migration): _run_service_command("stop", "mysql") self.apt_dist_upgrade(conf_flags=["old", "miss", "def"]) _run_service_command("start", "mysql") - if self.debian_major_version() == "jessie": + if self.debian_major_version() == 8: raise MoulinetteError(m18n.n("migration_0003_still_on_jessie_after_main_upgrade", log=self.logfile)) # Specific upgrade for fail2ban... @@ -89,10 +89,7 @@ class MyMigration(Migration): # because "platform" relies on uname, which on some weird setups does # not behave correctly (still says running Jessie when lsb_release says # Stretch...) - # Also lsb_release is fucking stupid and sometimes return "Release: 8" - # and "Codename: stretch". So apparently the codename is more reliable - # than the release number :| - return check_output("lsb_release -c").split("\t")[1].strip() + return int(check_output("lsb_release -r").split("\t")[1][0]) def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) @@ -103,7 +100,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == "jessie" \ + if not self.debian_major_version() == 8 \ and not self.yunohost_major_version() == 2: raise MoulinetteError(m18n.n("migration_0003_not_jessie")) @@ -128,7 +125,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == "jessie" \ + if not self.debian_major_version() == 8 \ and not self.yunohost_major_version() == 2: return None From 1b55eacf9cd1e41f65e222d830ed760eba012b9c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:29:52 +0200 Subject: [PATCH 10/11] Rely on /etc/os-release to get the release number.. --- .../data_migrations/0003_migrate_to_stretch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 6900b678a..49e85a64e 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -85,11 +85,13 @@ class MyMigration(Migration): self.upgrade_yunohost_packages() def debian_major_version(self): - # We rely on lsb_release instead of the python module "platform", - # because "platform" relies on uname, which on some weird setups does - # not behave correctly (still says running Jessie when lsb_release says - # Stretch...) - return int(check_output("lsb_release -r").split("\t")[1][0]) + # The python module "platform" and lsb_release are not reliable because + # on some setup, they still return Release=8 even after upgrading to + # stretch ... (Apparently this is related to OVH overriding some stuff + # with /etc/lsb-release for instance -_-) + # Instead, we rely on /etc/os-release which should be the raw info from + # the distribution... + return int(check_output("grep VERSION_ID /etc/os-release | tr '\"' ' ' | cut -d ' ' -f2")) def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) From 98862ee25613f8d8aaf92b71e145de8692495c3c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 01:04:04 +0200 Subject: [PATCH 11/11] Update changelog --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9bd67a3f8..2c855eae1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +yunohost (2.7.13.5) testing; urgency=low + + * [fix] a bug when log to be fetched is empty + * [fix] a bug when computing diff in regen_conf + * [stretch-migration] Tell postgresql-common to not send an email about 9.4->9.6 migration + * [stretch-migration] Close port 465 / open port 587 during migration according to SMTP port change in postfix + * [stretch-migration] Rely on /etc/os-release to get debian release number + + Fixes by Bram and Aleks + + -- Alexandre Aubin Tue, 12 Jun 2018 01:00:00 +0000 + yunohost (2.7.13.4) testing; urgency=low * Fix a bug for services with alternate names (mysql<->mariadb)