From 625e87000867affe188b616346b54ae7a9753630 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 10 Aug 2018 00:52:46 +0200 Subject: [PATCH] Revert "[enh] Don't display log advertisement if not needed" This reverts commit 37c55477553f75e7ebb0ee808f02be19ae6010c7. --- src/yunohost/certificate.py | 16 ++++++---------- src/yunohost/utils/errors.py | 34 ---------------------------------- 2 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 src/yunohost/utils/errors.py diff --git a/src/yunohost/certificate.py b/src/yunohost/certificate.py index 4e40fe0f5..d530568dc 100644 --- a/src/yunohost/certificate.py +++ b/src/yunohost/certificate.py @@ -42,7 +42,6 @@ from moulinette.utils.log import getActionLogger import yunohost.domain from yunohost.utils.network import get_public_ip -from yunohost.utils.errors import YunoHostError from moulinette import m18n from yunohost.app import app_ssowatconf @@ -842,15 +841,13 @@ def _check_domain_is_ready_for_ACME(domain): # Check if IP from DNS matches public IP if not _dns_ip_match_public_ip(public_ip, domain): - raise YunoHostError(m18n.n( - 'certmanager_domain_dns_ip_differs_from_public_ip', domain=domain), - log_advertisement=False) + raise MoulinetteError(errno.EINVAL, m18n.n( + 'certmanager_domain_dns_ip_differs_from_public_ip', domain=domain)) # Check if domain seems to be accessible through HTTP? if not _domain_is_accessible_through_HTTP(public_ip, domain): - raise YunoHostError(m18n.n( - 'certmanager_domain_http_not_working', domain=domain), - log_advertisement=False) + raise MoulinetteError(errno.EINVAL, m18n.n( + 'certmanager_domain_http_not_working', domain=domain)) def _get_dns_ip(domain): @@ -859,9 +856,8 @@ def _get_dns_ip(domain): resolver.nameservers = DNS_RESOLVERS answers = resolver.query(domain, "A") except (dns.resolver.NoAnswer, dns.resolver.NXDOMAIN): - raise YunoHostError(m18n.n( - 'certmanager_error_no_A_record', domain=domain), - log_advertisement=False) + raise MoulinetteError(errno.EINVAL, m18n.n( + 'certmanager_error_no_A_record', domain=domain)) return str(answers[0]) diff --git a/src/yunohost/utils/errors.py b/src/yunohost/utils/errors.py deleted file mode 100644 index 9359c605b..000000000 --- a/src/yunohost/utils/errors.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -""" License - - Copyright (C) 2018 YUNOHOST.ORG - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program; if not, see http://www.gnu.org/licenses - -""" -import errno - -from moulinette.core import MoulinetteError - - -class YunoHostError(MoulinetteError): - """ - YunoHostError allows to indicate if we should or shouldn't display a message - to users about how to display logs about this error. - """ - - def __init__(self, message, log_advertisement=True): - self.log_advertisement = log_advertisement - super(YunoHostError, self).__init__(errno.EINVAL, message)