From: Frank Brehm Date: Mon, 7 Oct 2019 16:42:52 +0000 (+0200) Subject: Generation of a list of longer not updated modules X-Git-Tag: 1.7.4~1^2~3 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=7bc761a4d944c2956871192c2bfe6c28e5c9b505;p=pixelpark%2Fpuppetmaster-webhooks.git Generation of a list of longer not updated modules --- diff --git a/lib/webhooks/get_module_changes.py b/lib/webhooks/get_module_changes.py index 732e7a2..e9abb19 100644 --- a/lib/webhooks/get_module_changes.py +++ b/lib/webhooks/get_module_changes.py @@ -29,7 +29,7 @@ from . import __version__ from .errors import BaseHookError, UncriticalHookError from .base_app import BaseHookApp -from .xlate import XLATOR +from .xlate import XLATOR, format_timedelta_list LOG = logging.getLogger(__name__) @@ -147,7 +147,7 @@ class GetModuleChangesApp(BaseHookApp): w='warn_update_days', v=value) raise TypeError(msg) if value < 1: - msg = _("The value of {w} must be at leas one day: {v}").format( + msg = _("The value of {w} must be at least one day: {v}").format( w='warn_update_days', v=value) raise ValueError(msg) self._warn_update_days = value @@ -165,7 +165,7 @@ class GetModuleChangesApp(BaseHookApp): w='crit_update_days', v=value) raise TypeError(msg) if value < 1: - msg = _("The value of {w} must be at leas one day: {v}").format( + msg = _("The value of {w} must be at least one day: {v}").format( w='crit_update_days', v=value) raise ValueError(msg) self._crit_update_days = value @@ -289,6 +289,7 @@ class GetModuleChangesApp(BaseHookApp): self.generate_deprecation_msgs(depr_infos) update_infos = self.check_updates(module_infos) + self.generate_update_msgs(update_infos) self.error_data.append("\n" + _("Checked at: {}").format(self.check_date_str)) @@ -459,7 +460,8 @@ class GetModuleChangesApp(BaseHookApp): if module_info.forge_superseded_by: substitute = module_info.forge_superseded_by local_dt = module_info.forge_deprecated_at.replace(tzinfo=LOCALTZ) - local_dt_str = format_datetime(local_dt, 'yyyy-MM-dd HH:mm:ss z', tzinfo=LOCALTZ) + # local_dt_str = format_datetime(local_dt, 'yyyy-MM-dd HH:mm:ss z', tzinfo=LOCALTZ) + local_dt_str = format_datetime(local_dt, 'yyyy-MM-dd', tzinfo=LOCALTZ) LOG.info(_( "Module {m!r} is deprecated since {at} and should be substituted by {s!r}, " "reason: {r}.").format( @@ -542,7 +544,7 @@ class GetModuleChangesApp(BaseHookApp): env_found = False - LOG.info(_("Checking for last updets modules on Puppet forge ...")) + LOG.info(_("Checking for last updates of modules on Puppet forge ...")) infos = [] @@ -580,17 +582,22 @@ class GetModuleChangesApp(BaseHookApp): if mod_update_timediff < warn_update_timediff: continue + # local_dt_str = format_datetime( + # module_info.forge_updated_at, 'yyyy-MM-dd HH:mm:ss z', tzinfo=LOCALTZ) local_dt_str = format_datetime( - module_info.forge_updated_at, 'yyyy-MM-dd HH:mm:ss z', tzinfo=LOCALTZ) + module_info.forge_updated_at, 'yyyy-MM-dd', tzinfo=LOCALTZ) LOG.info(_( "Module {m!r} was last updated at {at}, {d} days ago ({t}).").format( m=module_info.full_name, at=local_dt_str, d=mod_update_timediff.days, t=tdiff)) + td_str = format_timedelta_list(mod_update_timediff, granularity='day') + info = { 'module': module_info.full_name, 'upd_date': module_info.forge_updated_at, 'upd_date_str': local_dt_str, 'timediff': mod_update_timediff, + 'timediff_str': td_str, } infos.append(info) @@ -598,6 +605,68 @@ class GetModuleChangesApp(BaseHookApp): LOG.debug("Modules with an update on Forge long time ago:\n" + pp(infos)) return infos + # ------------------------------------------------------------------------- + def generate_update_msgs(self, module_infos): + + msg = _( + "Results of checking for modules with a last update long time ago in " + "environment {!r}:").format( self.environment) + self.error_data.append('\n' + msg) + if not module_infos: + msg = _( + "Didn't found any modules with a last update long time ago in " + "environment {!r}.").format( self.environment) + "\n\n:-D" + self.error_data.append(msg) + return + + if self.verbose > 2: + LOG.debug("Modules with a last update long time ago:\n" + pp(module_infos)) + + msg = ngettext( + "Found one module with a last update long time ago in environment {e!r}.", + "Found {n} modules with a last update long time ago in environment {e!r}.", + len(module_infos)).format(n=len(module_infos), e=self.environment) + "\n\n:-(\n" + self.error_data.append(msg) + + label = { + 'module': _('Module'), + 'upd_date_str': _('Last Update'), + 'timediff_str': _("Time difference"), + } + width = {} + for key in label.keys(): + width[key] = len(label[key]) + + for info in module_infos: + for key in label.keys(): + if len(str(info[key])) > width[key]: + width[key] = len(str(info[key])) + + len_total = 0 + first = True + for key in width.keys(): + len_total += width[key] + if not first: + len_total += 3 + first = False + + template = "{{module:<{module}}} | " + template += "{{upd_date_str:<{upd_date_str}}} | " + template += "{{timediff_str:<{timediff_str}}}" + + template = template.format(**width) + + if self.verbose > 1: + LOG.debug("Zeilen-Template:\n{}".format(template)) + LOG.debug("Zeilen-Länge: {}".format(len_total)) + + title = template.format(**label) + self.error_data.append(title) + self.error_data.append('=' * len_total) + + for info in sorted(module_infos, key=lambda x: x['upd_date']): + self.error_data.append(template.format(**info)) + # ============================================================================= if __name__ == "__main__": diff --git a/lib/webhooks/xlate.py b/lib/webhooks/xlate.py index c7d82ec..eb1376a 100644 --- a/lib/webhooks/xlate.py +++ b/lib/webhooks/xlate.py @@ -17,16 +17,22 @@ import os from pathlib import Path +from datetime import date, datetime, time, timedelta + # Third party modules +from babel.core import default_locale, get_global, Locale from babel.support import Translations from webob.acceptparse import create_accept_language_header +from fb_tools.common import pp +from fb_tools.xlate import format_list + DOMAIN = 'puppetmaster_webhooks' LOG = logging.getLogger(__name__) -__version__ = '1.1.0' +__version__ = '1.2.0' __me__ = Path(__file__).resolve() __module_dir__ = __me__.parent @@ -38,11 +44,22 @@ if not LOCALE_DIR.is_dir(): if not LOCALE_DIR.is_dir(): LOCALE_DIR = None +LC_TIME = default_locale('LC_TIME') + SUPPORTED_LANGS = ( 'de_DE', 'en_US' ) +TIMEDELTA_UNITS = ( + ('second', 1), + ('minute', 60), + ('hour', 60), + ('day', 24), + ('month', 30), + ('year', 12), +) + __mo_file__ = gettext.find(DOMAIN, str(LOCALE_DIR)) if not __mo_file__: if 'HTTP_ACCEPT_LANGUAGE' in os.environ: @@ -65,9 +82,93 @@ else: XLATOR = gettext.NullTranslations() _ = XLATOR.gettext +ngettext = XLATOR.ngettext + # ============================================================================= +def format_timedelta_list(delta, granularity='second', locale=LC_TIME): + """Return a time delta according to the rules of the given locale.""" + + units = map(lambda x: x[0], TIMEDELTA_UNITS) + if granularity not in units: + msg = _("Wrong value {v!r} for parameter {p!r} of function {f}().").format( + v=granularity, p='granularity', f='format_timedelta_list') + raise ValueError(msg) + + if isinstance(delta, timedelta): + seconds = int((delta.days * 86400) + delta.seconds) + else: + seconds = delta + locale = Locale.parse(locale) + + part_list = [] + + def local_val(value, unit): + if unit == 'second': + unit_loc = ngettext('second', 'seconds', value) + elif unit == 'minute': + unit_loc = ngettext('minute', 'minutes', value) + elif unit == 'hour': + unit_loc = ngettext('hour', 'hours', value) + elif unit == 'day': + unit_loc = ngettext('day', 'days', value) + elif unit == 'month': + unit_loc = ngettext('month', 'months', value) + elif unit == 'year': + unit_loc = ngettext('year', 'years', value) + else: + msg = _("Wrong value {v!r} for parameter {p!r} of function {f}().").format( + v=unit, p='unit', f='local_val') + raise ValueError(msg) + return "{v} {u}".format(v=value, u=unit_loc) + + i = 0 + cur_value = seconds + include = False + seconds_per_year = 3600 * 24 * 365 +# LOG.debug("Seconds per year: {}".format(seconds_per_year)) + if cur_value >= seconds_per_year: +# LOG.debug("Balancing years ...") + years = int(seconds / seconds_per_year) + cur_value -= (3600 * 24 * 5 * years) +# LOG.debug("Balanced current value: {v}.".format(v=cur_value)) + for unit, subunits in TIMEDELTA_UNITS: + i += 1 +# LOG.debug("Unit: {u!r}, subunits: {s}, i: {i!r}, current value: {v}.".format( +# u=unit, s=subunits, i=i, v=cur_value)) + if i == 1: + if granularity == unit: + include = True + continue + value = int(abs(cur_value) / subunits) + rest = int(abs(cur_value) % subunits) +# LOG.debug("Value: {v!r}, rest: {r!r}.".format(v=value, r=rest)) + last_unit = TIMEDELTA_UNITS[i-2][0] +# LOG.debug("Last unit: {!r}".format(last_unit)) + cur_value = value + if granularity == unit: + include = True + if float(rest) / subunits >= 0.5: + cur_value = value + 1 +# LOG.debug("Rounding ...") + continue + if include and rest: + part = local_val(rest, last_unit) + part_list.append(part) + cur_value = value + continue +# LOG.debug("Current value: {v}.".format(v=cur_value)) + if cur_value: + part = local_val(cur_value, 'year') + part_list.append(part) + + if not part_list: + return '' + part_list.reverse() + return format_list(part_list) + +# ============================================================================= if __name__ == "__main__": print(_("Module directory: {!r}").format(__module_dir__)) @@ -78,4 +179,4 @@ if __name__ == "__main__": # ============================================================================= -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list diff --git a/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po b/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po index 560442f..a3f3a34 100644 --- a/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po +++ b/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: puppetmaster_webhooks 1.5.4\n" "Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n" -"POT-Creation-Date: 2019-10-04 12:32+0200\n" -"PO-Revision-Date: 2019-10-04 12:40+0100\n" +"POT-Creation-Date: 2019-10-07 17:17+0200\n" +"PO-Revision-Date: 2019-10-07 18:40+0100\n" "Last-Translator: Frank Brehm \n" "Language: de_DE\n" "Language-Team: Frank Brehm \n" @@ -138,7 +138,7 @@ msgstr "Python-CGI-Skript wird ausgeführt." msgid "Got a {cn} performing {a}: {e}" msgstr "Hab einen {cn} bei der Ausführung von {a} erhalten: {e}" -#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1458 +#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1459 msgid "Got a {cn} reading input data as JSON: {e}" msgstr "Hab einen {cn} beim Lesen der Eingabedaten als JSON erhalten: {e}" @@ -294,7 +294,7 @@ msgstr "Konnte {f!r} nicht als reguläre JSON-Datei interpretieren: {e}" msgid "Did not found any data in {!r}." msgstr "Keine Daten in {!r} gefunden." -#: lib/webhooks/base_app.py:1447 +#: lib/webhooks/base_app.py:1448 msgid "All modules infos:" msgstr "Alle Modul-Informationen:" @@ -557,65 +557,96 @@ msgstr "Bekam Modulinformationen von Forge für Modul {!r}." msgid "Got no module info for {!r} from Forge." msgstr "Erhielt keine Modulinformationen für {!r} von Forge." -#: lib/webhooks/get_module_changes.py:63 +#: lib/webhooks/get_module_changes.py:66 msgid "Puppet environment {!r} does not exists." msgstr "Die Puppet-Umgebung {!r} existiert nicht." -#: lib/webhooks/get_module_changes.py:82 +#: lib/webhooks/get_module_changes.py:90 msgid "" "Generates a list of all Puppets modules, which are newer in Puppet forge than in a defined " -"environment." +"environment. It also generates a list of deprecated module and a list of modules, their last " +"update on Forge was longer than a year ago." msgstr "" "Erstellt eine Liste mit allen Puppet-Modulen, die bei Puppet-Forge in einer neueren Version als " -"in der angegebenen Umgebung vorliegen." +"in der angegebenen Umgebung vorliegen. Es generiert außerdem eine Liste überholter Module sowie " +"eine Liste der Module, deren letztes Update bei Forge länger als ein Jahr zurück liegt." -#: lib/webhooks/get_module_changes.py:103 + +#: lib/webhooks/get_module_changes.py:113 msgid "An environment may not be None." msgstr "Eine Umgebung darf nicht None sein." -#: lib/webhooks/get_module_changes.py:106 lib/webhooks/get_module_changes.py:109 +#: lib/webhooks/get_module_changes.py:116 lib/webhooks/get_module_changes.py:119 msgid "Invalid environment name: {!r}." msgstr "Ungültiger Name für eine Umgebung: {!r}." -#: lib/webhooks/get_module_changes.py:151 +#: lib/webhooks/get_module_changes.py:146 lib/webhooks/get_module_changes.py:164 +msgid "The value of {w} must be a numeric value: {v!r}" +msgstr "Der Wert von {w} muss numerisch sein: {v!r}" + +#: lib/webhooks/get_module_changes.py:150 lib/webhooks/get_module_changes.py:168 +msgid "The value of {w} must be at least one day: {v}" +msgstr "Der Wert von {w} muss mindestens einen Tag betragen: {v}" + +#: lib/webhooks/get_module_changes.py:210 msgid "ENVIRONMENT" msgstr "UMGEBUNG" -#: lib/webhooks/get_module_changes.py:152 +#: lib/webhooks/get_module_changes.py:211 msgid "The Puppet environmment, which to compare with Puppet forge, default: {!r}." msgstr "Die Puppet-Umgebung, die mit Puppet-Forge verglichen werden soll. Vorgabe: {!r}." -#: lib/webhooks/get_module_changes.py:182 +#: lib/webhooks/get_module_changes.py:217 lib/webhooks/get_module_changes.py:224 +msgid "DAYS" +msgstr "TAGE" + +#: lib/webhooks/get_module_changes.py:218 +msgid "The warning level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "Das Warn-Level in Tagen, wenn das Puppet-Modul letztmals auf Puppet Forge aktualisiert wurde (Vorgabe: {})." + +#: lib/webhooks/get_module_changes.py:225 +msgid "The critical level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "Das Level für kritischen Alarm, wenn das Puppet-Modul letztmals auf Puppet Forge aktualisiert wurde (Vorgabe: {})." + +#: lib/webhooks/get_module_changes.py:232 +msgid "Work in Nagios mode instead of sending mails." +msgstr "Arbeit im Nagios-Modus, anstelle Mails zu versenden." + +#: lib/webhooks/get_module_changes.py:253 +msgid "The number of warning days {w} may not be greater than the number of critical days {c}." +msgstr "Die Anzahl der Tage für eine Warnung {w} darf nicht früßewr sein als die Anzahl der Tage für einen kritischen Alarm {c}." + +#: lib/webhooks/get_module_changes.py:277 msgid "Here I go. ..." msgstr "Und hier geht's los …" -#: lib/webhooks/get_module_changes.py:196 +#: lib/webhooks/get_module_changes.py:294 msgid "Checked at: {}" msgstr "Überprüft am: {}" -#: lib/webhooks/get_module_changes.py:203 +#: lib/webhooks/get_module_changes.py:301 msgid "Checking versions of modules ..." msgstr "Überprüfe Modul-Versionen …" -#: lib/webhooks/get_module_changes.py:233 +#: lib/webhooks/get_module_changes.py:331 msgid "Version of module {m!r} on Puppet forge {fv!r} is newer than the local version {lv!r}." msgstr "Die Version des Moduls {m!r} ist bei Puppet-Forge {fv!r} neuer als die lokale Version {lv!r}." -#: lib/webhooks/get_module_changes.py:238 +#: lib/webhooks/get_module_changes.py:336 msgid "Version of module {m!r} on Puppet forge {fv!r} is equal or older than the local version {lv!r}." msgstr "" "Die Version des Moduls {m!r} ist bei Puppet-Forge {fv!r} gleich oder älter als die lokale " "Version {lv!r}." -#: lib/webhooks/get_module_changes.py:263 +#: lib/webhooks/get_module_changes.py:361 msgid "Check for newer versions of Puppet modules in environment {!r}" msgstr "Überprüfen nach neueren Versionen von Puppet-Modulen in Umgebung {!r}" -#: lib/webhooks/get_module_changes.py:267 +#: lib/webhooks/get_module_changes.py:365 msgid "Results of checking for newer versions of Puppet modules in environment {!r}:" msgstr "Ergebnisse der Überprüfung nach neueren Versionen von Puppet-Modulen in Umgebung {!r}:" -#: lib/webhooks/get_module_changes.py:272 +#: lib/webhooks/get_module_changes.py:370 msgid "" "Didn't found any modules in environment {!r} with a\n" "newer version on Puppet Forge." @@ -623,111 +654,142 @@ msgstr "" "Keine Module in Umgebung {!r} gefunden,\n" "für die eine neuere Version bei Puppet-Forge vorliegt." -#: lib/webhooks/get_module_changes.py:281 +#: lib/webhooks/get_module_changes.py:379 msgid "Found one module in environment {e!r} with a newer version on Puppet Forge." msgid_plural "Found {n} modules in environment {e!r} with a newer version on Puppet Forge." msgstr[0] "Fand ein Modul in der Umgebung {e!r} mit einer neueren Version bei Puppet-Forge." msgstr[1] "Fand {n} Module in der Umgebung {e!r} mit einer neueren Version bei Puppet-Forge." -#: lib/webhooks/get_module_changes.py:285 lib/webhooks/get_module_changes.py:403 +#: lib/webhooks/get_module_changes.py:383 lib/webhooks/get_module_changes.py:502 +#: lib/webhooks/get_module_changes.py:631 msgid "Module" msgstr "Modul" -#: lib/webhooks/get_module_changes.py:286 +#: lib/webhooks/get_module_changes.py:384 msgid "Full Module name" msgstr "Vollständiger Modulname" -#: lib/webhooks/get_module_changes.py:287 +#: lib/webhooks/get_module_changes.py:385 msgid "Used Version" msgstr "Verwendete Version" -#: lib/webhooks/get_module_changes.py:288 +#: lib/webhooks/get_module_changes.py:386 msgid "Version on Puppet Forge" msgstr "Version bei Puppet-Forge" -#: lib/webhooks/get_module_changes.py:334 +#: lib/webhooks/get_module_changes.py:432 msgid "Checking for deprecate modules ..." msgstr "Suche nach überholten Modulen …" -#: lib/webhooks/get_module_changes.py:358 lib/webhooks/get_module_changes.py:359 +#: lib/webhooks/get_module_changes.py:456 lib/webhooks/get_module_changes.py:457 msgid "unknown" msgstr "unbekannt" -#: lib/webhooks/get_module_changes.py:366 +#: lib/webhooks/get_module_changes.py:465 msgid "Module {m!r} is deprecated since {at} and should be substituted by {s!r}, reason: {r}." msgstr "Das Modul {m!r} ist seit {at} überholt und sollte durch {s!r} ersetzt werden, Grund: {r}." -#: lib/webhooks/get_module_changes.py:384 +#: lib/webhooks/get_module_changes.py:483 msgid "Results of checking for deprecated modules in environment {!r}:" msgstr "Ergebnisse der Suche nach überholten Modulen in Umgebung {!r}:" -#: lib/webhooks/get_module_changes.py:388 +#: lib/webhooks/get_module_changes.py:487 msgid "Didn't found any deprecated modules in environment {!r}." msgstr "Keine überholten Module in Umgebung {!r} gefunden." -#: lib/webhooks/get_module_changes.py:399 +#: lib/webhooks/get_module_changes.py:498 msgid "Found one deprecated module in environment {e!r}." msgid_plural "Found {n} deprecated modules in environment {e!r}." msgstr[0] "Fand ein überholtes Modul in Umgebung {e!r}." msgstr[1] "Fand {n} überholte Module in Umgebung {e!r}." -#: lib/webhooks/get_module_changes.py:404 +#: lib/webhooks/get_module_changes.py:503 msgid "Since" msgstr "Seit" -#: lib/webhooks/get_module_changes.py:405 +#: lib/webhooks/get_module_changes.py:504 msgid "Substituted by" msgstr "Ersetzt durch" -#: lib/webhooks/get_module_changes.py:406 +#: lib/webhooks/get_module_changes.py:505 msgid "Reason" msgstr "Grund" -#: lib/webhooks/module_info.py:305 +#: lib/webhooks/get_module_changes.py:547 +msgid "Checking for last updates of modules on Puppet forge ..." +msgstr "Überprüfe nach den letzten Updates von Modulen auf Puppet Forge …" + +#: lib/webhooks/get_module_changes.py:589 +msgid "Module {m!r} was last updated at {at}, {d} days ago ({t})." +msgstr "Das Modul {m!r} wurde zuletzt {at} aktualisiert, vor {d} Tagen ({t})." + +#: lib/webhooks/get_module_changes.py:610 +msgid "Results of checking for modules with a last update long time ago in environment {!r}:" +msgstr "Resultate der Überprüfung nach Modulen mit einer Aktualisierung vor langer Zeit in Umgebung {!r}:" + +#: lib/webhooks/get_module_changes.py:615 +msgid "Didn't found any modules with a last update long time ago in environment {!r}." +msgstr "Keine Module mit einer Aktualisierung vor langer Zeit in Umgebung {!r} gefunden." + +#: lib/webhooks/get_module_changes.py:627 +msgid "Found one module with a last update long time ago in environment {e!r}." +msgid_plural "Found {n} modules with a last update long time ago in environment {e!r}." +msgstr[0] "Fand ein Modul mit einer Aktualisierung vor langer Zeit in Umgebung {e!r}." +msgstr[1] "Fand {n} Module mit einer Aktualisierung vor langer Zeit in Umgebung {e!r}." + +#: lib/webhooks/get_module_changes.py:632 +msgid "Last Update" +msgstr "Letzte Aktualisierung" + +#: lib/webhooks/get_module_changes.py:633 +msgid "Time difference" +msgstr "Zeitdifferenz" + +#: lib/webhooks/module_info.py:330 msgid "Parameter {p!r} is not of class {e}, but of class {c} instead." msgstr "Der Parameter {p!r} gehört nicht zur Klasse {e}, sondern ist statt dessen ein {c}-Objekt." -#: lib/webhooks/module_info.py:343 +#: lib/webhooks/module_info.py:371 msgid "Did not found module name in json." msgstr "Modulnamen nicht im JSON gefunden." -#: lib/webhooks/module_info.py:371 +#: lib/webhooks/module_info.py:399 msgid "Did not found module name in data." msgstr "Modulnamen nicht in den Daten gefunden." -#: lib/webhooks/module_info.py:485 +#: lib/webhooks/module_info.py:516 msgid "Could not analyze definitions in {!r}." msgstr "Konnte Definitionen in {!r} nicht analysieren." -#: lib/webhooks/module_info.py:498 +#: lib/webhooks/module_info.py:529 msgid "Could not analyze definition token {!r}." msgstr "Konnte Definitions-Token in {!r} nicht analysieren." -#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:514 +#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:545 msgid "Trying to get module {m!r} from Puppet forge {u!r} ..." msgstr "Versuche, das Module {m!r} von Puppet-Forge zu holen …" -#: lib/webhooks/module_info.py:534 lib/webhooks/r10k.py:299 +#: lib/webhooks/module_info.py:565 lib/webhooks/r10k.py:299 msgid "Got status code: {}." msgstr "Erhaltener Statuscode: {}" -#: lib/webhooks/module_info.py:536 +#: lib/webhooks/module_info.py:567 msgid "Did not found module {} on Puppet forge." msgstr "Modul {} nicht bei Puppet-Forge gefunden." -#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:540 +#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:571 msgid "No output for URL {!r}." msgstr "Keine Ausgabe unter der URL {!r}." -#: lib/webhooks/module_info.py:564 +#: lib/webhooks/module_info.py:595 msgid "Did not found version of current release of module {}." msgstr "Keine Versionsnummer für das aktuelle Release des Moduls {} gefunden." -#: lib/webhooks/module_info.py:571 +#: lib/webhooks/module_info.py:602 msgid "Did not found source information of module {}." msgstr "Keine Quell-Infformationen zu Modul {} gefunden." -#: lib/webhooks/module_info.py:573 +#: lib/webhooks/module_info.py:604 msgid "Did not found current release of module {}." msgstr "Kein aktuelles Release für Modul {} gefunden." @@ -925,23 +987,63 @@ msgid_plural "Found total {sb}{nr} modules{eb}." msgstr[0] "Insgesamt {sb}ein Modul{eb} gefunden." msgstr[1] "Insgesamt {sb}{nr} Module{eb} gefunden." -#: lib/webhooks/xlate.py:73 +#: lib/webhooks/xlate.py:94 lib/webhooks/xlate.py:120 +msgid "Wrong value {v!r} for parameter {p!r} of function {f}()." +msgstr "Falscher Wert {v!r} für Parameter {p!r} der Funktion {f}()." + +#: lib/webhooks/xlate.py:108 +msgid "second" +msgid_plural "seconds" +msgstr[0] "Sekunde" +msgstr[1] "Sekunden" + +#: lib/webhooks/xlate.py:110 +msgid "minute" +msgid_plural "minutes" +msgstr[0] "Minute" +msgstr[1] "Minuten" + +#: lib/webhooks/xlate.py:112 +msgid "hour" +msgid_plural "hours" +msgstr[0] "Stunde" +msgstr[1] "Stunden" + +#: lib/webhooks/xlate.py:114 +msgid "day" +msgid_plural "days" +msgstr[0] "Tag" +msgstr[1] "Tage" + +#: lib/webhooks/xlate.py:116 +msgid "month" +msgid_plural "months" +msgstr[0] "Monat" +msgstr[1] "Monate" + +#: lib/webhooks/xlate.py:118 +msgid "year" +msgid_plural "years" +msgstr[0] "Jahr" +msgstr[1] "Jahre" + +#: lib/webhooks/xlate.py:166 msgid "Module directory: {!r}" msgstr "Modul-Verzeichnis: {!r}" -#: lib/webhooks/xlate.py:74 +#: lib/webhooks/xlate.py:167 msgid "Base directory: {!r}" msgstr "Basis-Verzeichnis: {!r}" -#: lib/webhooks/xlate.py:75 +#: lib/webhooks/xlate.py:168 msgid "Locale directory: {!r}" msgstr "Verzeichnis für Locales: {!r}" -#: lib/webhooks/xlate.py:76 +#: lib/webhooks/xlate.py:169 msgid "Locale domain: {!r}" msgstr "Locale-Domäne: {!r}" -#: lib/webhooks/xlate.py:77 +#: lib/webhooks/xlate.py:170 msgid "Found .mo-file: {!r}" msgstr "Gefundene .mo-Datei: {!r}" diff --git a/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po b/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po index d962bd6..d5cdaba 100644 --- a/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po +++ b/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: puppetmaster_webhooks 1.3.1\n" "Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n" -"POT-Creation-Date: 2019-10-04 12:32+0200\n" +"POT-Creation-Date: 2019-10-07 17:17+0200\n" "PO-Revision-Date: 2019-04-30 11:40+0100\n" "Last-Translator: Frank Brehm \n" "Language: en_US\n" @@ -136,7 +136,7 @@ msgstr "" msgid "Got a {cn} performing {a}: {e}" msgstr "" -#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1458 +#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1459 msgid "Got a {cn} reading input data as JSON: {e}" msgstr "" @@ -284,7 +284,7 @@ msgstr "" msgid "Did not found any data in {!r}." msgstr "" -#: lib/webhooks/base_app.py:1447 +#: lib/webhooks/base_app.py:1448 msgid "All modules infos:" msgstr "" @@ -539,171 +539,231 @@ msgstr "" msgid "Got no module info for {!r} from Forge." msgstr "" -#: lib/webhooks/get_module_changes.py:63 +#: lib/webhooks/get_module_changes.py:66 msgid "Puppet environment {!r} does not exists." msgstr "" -#: lib/webhooks/get_module_changes.py:82 +#: lib/webhooks/get_module_changes.py:90 msgid "" "Generates a list of all Puppets modules, which are newer in Puppet forge than in a defined " -"environment." +"environment. It also generates a list of deprecated module and a list of modules, their last " +"update on Forge was longer than a year ago." msgstr "" -#: lib/webhooks/get_module_changes.py:103 +#: lib/webhooks/get_module_changes.py:113 msgid "An environment may not be None." msgstr "" -#: lib/webhooks/get_module_changes.py:106 lib/webhooks/get_module_changes.py:109 +#: lib/webhooks/get_module_changes.py:116 lib/webhooks/get_module_changes.py:119 msgid "Invalid environment name: {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:151 +#: lib/webhooks/get_module_changes.py:146 lib/webhooks/get_module_changes.py:164 +msgid "The value of {w} must be a numeric value: {v!r}" +msgstr "" + +#: lib/webhooks/get_module_changes.py:150 lib/webhooks/get_module_changes.py:168 +msgid "The value of {w} must be at leas one day: {v}" +msgstr "" + +#: lib/webhooks/get_module_changes.py:210 msgid "ENVIRONMENT" msgstr "" -#: lib/webhooks/get_module_changes.py:152 +#: lib/webhooks/get_module_changes.py:211 msgid "The Puppet environmment, which to compare with Puppet forge, default: {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:182 +#: lib/webhooks/get_module_changes.py:217 lib/webhooks/get_module_changes.py:224 +msgid "DAYS" +msgstr "" + +#: lib/webhooks/get_module_changes.py:218 +msgid "The warning level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:225 +msgid "The critical level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:232 +msgid "Work in Nagios mode instead of sending mails." +msgstr "" + +#: lib/webhooks/get_module_changes.py:253 +msgid "The number of warning days {w} may not be greater than the number of critical days {c}." +msgstr "" + +#: lib/webhooks/get_module_changes.py:277 msgid "Here I go. ..." msgstr "Here I go …" -#: lib/webhooks/get_module_changes.py:196 +#: lib/webhooks/get_module_changes.py:294 msgid "Checked at: {}" msgstr "" -#: lib/webhooks/get_module_changes.py:203 +#: lib/webhooks/get_module_changes.py:301 msgid "Checking versions of modules ..." msgstr "" -#: lib/webhooks/get_module_changes.py:233 +#: lib/webhooks/get_module_changes.py:331 msgid "Version of module {m!r} on Puppet forge {fv!r} is newer than the local version {lv!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:238 +#: lib/webhooks/get_module_changes.py:336 msgid "Version of module {m!r} on Puppet forge {fv!r} is equal or older than the local version {lv!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:263 +#: lib/webhooks/get_module_changes.py:361 msgid "Check for newer versions of Puppet modules in environment {!r}" msgstr "" -#: lib/webhooks/get_module_changes.py:267 +#: lib/webhooks/get_module_changes.py:365 msgid "Results of checking for newer versions of Puppet modules in environment {!r}:" msgstr "" -#: lib/webhooks/get_module_changes.py:272 +#: lib/webhooks/get_module_changes.py:370 msgid "" "Didn't found any modules in environment {!r} with a\n" "newer version on Puppet Forge." msgstr "" -#: lib/webhooks/get_module_changes.py:281 +#: lib/webhooks/get_module_changes.py:379 msgid "Found one module in environment {e!r} with a newer version on Puppet Forge." msgid_plural "Found {n} modules in environment {e!r} with a newer version on Puppet Forge." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/get_module_changes.py:285 lib/webhooks/get_module_changes.py:403 +#: lib/webhooks/get_module_changes.py:383 lib/webhooks/get_module_changes.py:502 +#: lib/webhooks/get_module_changes.py:631 msgid "Module" msgstr "" -#: lib/webhooks/get_module_changes.py:286 +#: lib/webhooks/get_module_changes.py:384 msgid "Full Module name" msgstr "" -#: lib/webhooks/get_module_changes.py:287 +#: lib/webhooks/get_module_changes.py:385 msgid "Used Version" msgstr "" -#: lib/webhooks/get_module_changes.py:288 +#: lib/webhooks/get_module_changes.py:386 msgid "Version on Puppet Forge" msgstr "" -#: lib/webhooks/get_module_changes.py:334 +#: lib/webhooks/get_module_changes.py:432 msgid "Checking for deprecate modules ..." msgstr "" -#: lib/webhooks/get_module_changes.py:358 lib/webhooks/get_module_changes.py:359 +#: lib/webhooks/get_module_changes.py:456 lib/webhooks/get_module_changes.py:457 msgid "unknown" msgstr "" -#: lib/webhooks/get_module_changes.py:366 +#: lib/webhooks/get_module_changes.py:465 msgid "Module {m!r} is deprecated since {at} and should be substituted by {s!r}, reason: {r}." msgstr "" -#: lib/webhooks/get_module_changes.py:384 +#: lib/webhooks/get_module_changes.py:483 msgid "Results of checking for deprecated modules in environment {!r}:" msgstr "" -#: lib/webhooks/get_module_changes.py:388 +#: lib/webhooks/get_module_changes.py:487 msgid "Didn't found any deprecated modules in environment {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:399 +#: lib/webhooks/get_module_changes.py:498 msgid "Found one deprecated module in environment {e!r}." msgid_plural "Found {n} deprecated modules in environment {e!r}." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/get_module_changes.py:404 +#: lib/webhooks/get_module_changes.py:503 msgid "Since" msgstr "" -#: lib/webhooks/get_module_changes.py:405 +#: lib/webhooks/get_module_changes.py:504 msgid "Substituted by" msgstr "" -#: lib/webhooks/get_module_changes.py:406 +#: lib/webhooks/get_module_changes.py:505 msgid "Reason" msgstr "" -#: lib/webhooks/module_info.py:305 +#: lib/webhooks/get_module_changes.py:547 +msgid "Checking for last updets modules on Puppet forge ..." +msgstr "" + +#: lib/webhooks/get_module_changes.py:589 +msgid "Module {m!r} was last updated at {at}, {d} days ago ({t})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:610 +msgid "Results of checking for modules with a last update long time ago in environment {!r}:" +msgstr "" + +#: lib/webhooks/get_module_changes.py:615 +msgid "Didn't found any modules with a last update long time ago in environment {!r}." +msgstr "" + +#: lib/webhooks/get_module_changes.py:627 +msgid "Found one module with a last update long time ago in environment {e!r}." +msgid_plural "Found {n} modules with a last update long time ago in environment {e!r}." +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/get_module_changes.py:632 +msgid "Last Update" +msgstr "" + +#: lib/webhooks/get_module_changes.py:633 +msgid "Time difference" +msgstr "" + +#: lib/webhooks/module_info.py:330 msgid "Parameter {p!r} is not of class {e}, but of class {c} instead." msgstr "" -#: lib/webhooks/module_info.py:343 +#: lib/webhooks/module_info.py:371 msgid "Did not found module name in json." msgstr "" -#: lib/webhooks/module_info.py:371 +#: lib/webhooks/module_info.py:399 msgid "Did not found module name in data." msgstr "" -#: lib/webhooks/module_info.py:485 +#: lib/webhooks/module_info.py:516 msgid "Could not analyze definitions in {!r}." msgstr "" -#: lib/webhooks/module_info.py:498 +#: lib/webhooks/module_info.py:529 msgid "Could not analyze definition token {!r}." msgstr "" -#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:514 +#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:545 msgid "Trying to get module {m!r} from Puppet forge {u!r} ..." msgstr "Trying to get module {m!r} from Puppet forge {u!r} …" -#: lib/webhooks/module_info.py:534 lib/webhooks/r10k.py:299 +#: lib/webhooks/module_info.py:565 lib/webhooks/r10k.py:299 msgid "Got status code: {}." msgstr "" -#: lib/webhooks/module_info.py:536 +#: lib/webhooks/module_info.py:567 msgid "Did not found module {} on Puppet forge." msgstr "" -#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:540 +#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:571 msgid "No output for URL {!r}." msgstr "" -#: lib/webhooks/module_info.py:564 +#: lib/webhooks/module_info.py:595 msgid "Did not found version of current release of module {}." msgstr "" -#: lib/webhooks/module_info.py:571 +#: lib/webhooks/module_info.py:602 msgid "Did not found source information of module {}." msgstr "" -#: lib/webhooks/module_info.py:573 +#: lib/webhooks/module_info.py:604 msgid "Did not found current release of module {}." msgstr "" @@ -899,23 +959,63 @@ msgid_plural "Found total {sb}{nr} modules{eb}." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/xlate.py:73 +#: lib/webhooks/xlate.py:94 lib/webhooks/xlate.py:120 +msgid "Wrong value {v!r} for parameter {p!r} of function {f}()." +msgstr "" + +#: lib/webhooks/xlate.py:108 +msgid "second" +msgid_plural "seconds" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:110 +msgid "minute" +msgid_plural "minutes" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:112 +msgid "hour" +msgid_plural "hours" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:114 +msgid "day" +msgid_plural "days" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:116 +msgid "month" +msgid_plural "months" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:118 +msgid "year" +msgid_plural "years" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:166 msgid "Module directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:74 +#: lib/webhooks/xlate.py:167 msgid "Base directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:75 +#: lib/webhooks/xlate.py:168 msgid "Locale directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:76 +#: lib/webhooks/xlate.py:169 msgid "Locale domain: {!r}" msgstr "" -#: lib/webhooks/xlate.py:77 +#: lib/webhooks/xlate.py:170 msgid "Found .mo-file: {!r}" msgstr "" diff --git a/locale/puppetmaster_webhooks.pot b/locale/puppetmaster_webhooks.pot index 42b2809..7cad0a5 100644 --- a/locale/puppetmaster_webhooks.pot +++ b/locale/puppetmaster_webhooks.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: puppetmaster_webhooks 1.7.1\n" +"Project-Id-Version: puppetmaster_webhooks 1.7.3\n" "Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n" -"POT-Creation-Date: 2019-10-04 12:32+0200\n" +"POT-Creation-Date: 2019-10-07 17:17+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -135,7 +135,7 @@ msgstr "" msgid "Got a {cn} performing {a}: {e}" msgstr "" -#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1458 +#: lib/webhooks/base_app.py:967 lib/webhooks/base_app.py:1459 msgid "Got a {cn} reading input data as JSON: {e}" msgstr "" @@ -283,7 +283,7 @@ msgstr "" msgid "Did not found any data in {!r}." msgstr "" -#: lib/webhooks/base_app.py:1447 +#: lib/webhooks/base_app.py:1448 msgid "All modules infos:" msgstr "" @@ -538,171 +538,231 @@ msgstr "" msgid "Got no module info for {!r} from Forge." msgstr "" -#: lib/webhooks/get_module_changes.py:63 +#: lib/webhooks/get_module_changes.py:66 msgid "Puppet environment {!r} does not exists." msgstr "" -#: lib/webhooks/get_module_changes.py:82 +#: lib/webhooks/get_module_changes.py:90 msgid "" "Generates a list of all Puppets modules, which are newer in Puppet forge than in a defined " -"environment." +"environment. It also generates a list of deprecated module and a list of modules, their last " +"update on Forge was longer than a year ago." msgstr "" -#: lib/webhooks/get_module_changes.py:103 +#: lib/webhooks/get_module_changes.py:113 msgid "An environment may not be None." msgstr "" -#: lib/webhooks/get_module_changes.py:106 lib/webhooks/get_module_changes.py:109 +#: lib/webhooks/get_module_changes.py:116 lib/webhooks/get_module_changes.py:119 msgid "Invalid environment name: {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:151 +#: lib/webhooks/get_module_changes.py:146 lib/webhooks/get_module_changes.py:164 +msgid "The value of {w} must be a numeric value: {v!r}" +msgstr "" + +#: lib/webhooks/get_module_changes.py:150 lib/webhooks/get_module_changes.py:168 +msgid "The value of {w} must be at leas one day: {v}" +msgstr "" + +#: lib/webhooks/get_module_changes.py:210 msgid "ENVIRONMENT" msgstr "" -#: lib/webhooks/get_module_changes.py:152 +#: lib/webhooks/get_module_changes.py:211 msgid "The Puppet environmment, which to compare with Puppet forge, default: {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:182 +#: lib/webhooks/get_module_changes.py:217 lib/webhooks/get_module_changes.py:224 +msgid "DAYS" +msgstr "" + +#: lib/webhooks/get_module_changes.py:218 +msgid "The warning level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:225 +msgid "The critical level in days, when the module was last updated on Puppet forge (default: {})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:232 +msgid "Work in Nagios mode instead of sending mails." +msgstr "" + +#: lib/webhooks/get_module_changes.py:253 +msgid "The number of warning days {w} may not be greater than the number of critical days {c}." +msgstr "" + +#: lib/webhooks/get_module_changes.py:277 msgid "Here I go. ..." msgstr "" -#: lib/webhooks/get_module_changes.py:196 +#: lib/webhooks/get_module_changes.py:294 msgid "Checked at: {}" msgstr "" -#: lib/webhooks/get_module_changes.py:203 +#: lib/webhooks/get_module_changes.py:301 msgid "Checking versions of modules ..." msgstr "" -#: lib/webhooks/get_module_changes.py:233 +#: lib/webhooks/get_module_changes.py:331 msgid "Version of module {m!r} on Puppet forge {fv!r} is newer than the local version {lv!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:238 +#: lib/webhooks/get_module_changes.py:336 msgid "Version of module {m!r} on Puppet forge {fv!r} is equal or older than the local version {lv!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:263 +#: lib/webhooks/get_module_changes.py:361 msgid "Check for newer versions of Puppet modules in environment {!r}" msgstr "" -#: lib/webhooks/get_module_changes.py:267 +#: lib/webhooks/get_module_changes.py:365 msgid "Results of checking for newer versions of Puppet modules in environment {!r}:" msgstr "" -#: lib/webhooks/get_module_changes.py:272 +#: lib/webhooks/get_module_changes.py:370 msgid "" "Didn't found any modules in environment {!r} with a\n" "newer version on Puppet Forge." msgstr "" -#: lib/webhooks/get_module_changes.py:281 +#: lib/webhooks/get_module_changes.py:379 msgid "Found one module in environment {e!r} with a newer version on Puppet Forge." msgid_plural "Found {n} modules in environment {e!r} with a newer version on Puppet Forge." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/get_module_changes.py:285 lib/webhooks/get_module_changes.py:403 +#: lib/webhooks/get_module_changes.py:383 lib/webhooks/get_module_changes.py:502 +#: lib/webhooks/get_module_changes.py:631 msgid "Module" msgstr "" -#: lib/webhooks/get_module_changes.py:286 +#: lib/webhooks/get_module_changes.py:384 msgid "Full Module name" msgstr "" -#: lib/webhooks/get_module_changes.py:287 +#: lib/webhooks/get_module_changes.py:385 msgid "Used Version" msgstr "" -#: lib/webhooks/get_module_changes.py:288 +#: lib/webhooks/get_module_changes.py:386 msgid "Version on Puppet Forge" msgstr "" -#: lib/webhooks/get_module_changes.py:334 +#: lib/webhooks/get_module_changes.py:432 msgid "Checking for deprecate modules ..." msgstr "" -#: lib/webhooks/get_module_changes.py:358 lib/webhooks/get_module_changes.py:359 +#: lib/webhooks/get_module_changes.py:456 lib/webhooks/get_module_changes.py:457 msgid "unknown" msgstr "" -#: lib/webhooks/get_module_changes.py:366 +#: lib/webhooks/get_module_changes.py:465 msgid "Module {m!r} is deprecated since {at} and should be substituted by {s!r}, reason: {r}." msgstr "" -#: lib/webhooks/get_module_changes.py:384 +#: lib/webhooks/get_module_changes.py:483 msgid "Results of checking for deprecated modules in environment {!r}:" msgstr "" -#: lib/webhooks/get_module_changes.py:388 +#: lib/webhooks/get_module_changes.py:487 msgid "Didn't found any deprecated modules in environment {!r}." msgstr "" -#: lib/webhooks/get_module_changes.py:399 +#: lib/webhooks/get_module_changes.py:498 msgid "Found one deprecated module in environment {e!r}." msgid_plural "Found {n} deprecated modules in environment {e!r}." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/get_module_changes.py:404 +#: lib/webhooks/get_module_changes.py:503 msgid "Since" msgstr "" -#: lib/webhooks/get_module_changes.py:405 +#: lib/webhooks/get_module_changes.py:504 msgid "Substituted by" msgstr "" -#: lib/webhooks/get_module_changes.py:406 +#: lib/webhooks/get_module_changes.py:505 msgid "Reason" msgstr "" -#: lib/webhooks/module_info.py:305 +#: lib/webhooks/get_module_changes.py:547 +msgid "Checking for last updets modules on Puppet forge ..." +msgstr "" + +#: lib/webhooks/get_module_changes.py:589 +msgid "Module {m!r} was last updated at {at}, {d} days ago ({t})." +msgstr "" + +#: lib/webhooks/get_module_changes.py:610 +msgid "Results of checking for modules with a last update long time ago in environment {!r}:" +msgstr "" + +#: lib/webhooks/get_module_changes.py:615 +msgid "Didn't found any modules with a last update long time ago in environment {!r}." +msgstr "" + +#: lib/webhooks/get_module_changes.py:627 +msgid "Found one module with a last update long time ago in environment {e!r}." +msgid_plural "Found {n} modules with a last update long time ago in environment {e!r}." +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/get_module_changes.py:632 +msgid "Last Update" +msgstr "" + +#: lib/webhooks/get_module_changes.py:633 +msgid "Time difference" +msgstr "" + +#: lib/webhooks/module_info.py:330 msgid "Parameter {p!r} is not of class {e}, but of class {c} instead." msgstr "" -#: lib/webhooks/module_info.py:343 +#: lib/webhooks/module_info.py:371 msgid "Did not found module name in json." msgstr "" -#: lib/webhooks/module_info.py:371 +#: lib/webhooks/module_info.py:399 msgid "Did not found module name in data." msgstr "" -#: lib/webhooks/module_info.py:485 +#: lib/webhooks/module_info.py:516 msgid "Could not analyze definitions in {!r}." msgstr "" -#: lib/webhooks/module_info.py:498 +#: lib/webhooks/module_info.py:529 msgid "Could not analyze definition token {!r}." msgstr "" -#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:514 +#: lib/webhooks/forge/mod_info.py:499 lib/webhooks/module_info.py:545 msgid "Trying to get module {m!r} from Puppet forge {u!r} ..." msgstr "" -#: lib/webhooks/module_info.py:534 lib/webhooks/r10k.py:299 +#: lib/webhooks/module_info.py:565 lib/webhooks/r10k.py:299 msgid "Got status code: {}." msgstr "" -#: lib/webhooks/module_info.py:536 +#: lib/webhooks/module_info.py:567 msgid "Did not found module {} on Puppet forge." msgstr "" -#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:540 +#: lib/webhooks/forge/mod_info.py:521 lib/webhooks/module_info.py:571 msgid "No output for URL {!r}." msgstr "" -#: lib/webhooks/module_info.py:564 +#: lib/webhooks/module_info.py:595 msgid "Did not found version of current release of module {}." msgstr "" -#: lib/webhooks/module_info.py:571 +#: lib/webhooks/module_info.py:602 msgid "Did not found source information of module {}." msgstr "" -#: lib/webhooks/module_info.py:573 +#: lib/webhooks/module_info.py:604 msgid "Did not found current release of module {}." msgstr "" @@ -898,23 +958,63 @@ msgid_plural "Found total {sb}{nr} modules{eb}." msgstr[0] "" msgstr[1] "" -#: lib/webhooks/xlate.py:73 +#: lib/webhooks/xlate.py:94 lib/webhooks/xlate.py:120 +msgid "Wrong value {v!r} for parameter {p!r} of function {f}()." +msgstr "" + +#: lib/webhooks/xlate.py:108 +msgid "second" +msgid_plural "seconds" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:110 +msgid "minute" +msgid_plural "minutes" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:112 +msgid "hour" +msgid_plural "hours" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:114 +msgid "day" +msgid_plural "days" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:116 +msgid "month" +msgid_plural "months" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:118 +msgid "year" +msgid_plural "years" +msgstr[0] "" +msgstr[1] "" + +#: lib/webhooks/xlate.py:166 msgid "Module directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:74 +#: lib/webhooks/xlate.py:167 msgid "Base directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:75 +#: lib/webhooks/xlate.py:168 msgid "Locale directory: {!r}" msgstr "" -#: lib/webhooks/xlate.py:76 +#: lib/webhooks/xlate.py:169 msgid "Locale domain: {!r}" msgstr "" -#: lib/webhooks/xlate.py:77 +#: lib/webhooks/xlate.py:170 msgid "Found .mo-file: {!r}" msgstr "" diff --git a/test/test_xlate.py b/test/test_xlate.py new file mode 100755 index 0000000..2dc931a --- /dev/null +++ b/test/test_xlate.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +@author: Frank Brehm +@contact: frank.brehm@pixlpark.com +@license: GPL3 +@summary: test script (and module) for unit tests on translation module +""" + +import os +import sys +import logging + +try: + import unittest2 as unittest +except ImportError: + import unittest + +libdir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', 'lib')) +sys.path.insert(0, libdir) + +# from fb_tools.common import to_utf8 + +from general import WebHooksTestcase, get_arg_verbose, init_root_logger + + +APPNAME = 'test_xlate' + +LOG = logging.getLogger(APPNAME) + +# ============================================================================= +class TestXlate(WebHooksTestcase): + + # ------------------------------------------------------------------------- + def setUp(self): + pass + + # ------------------------------------------------------------------------- + def tearDown(self): + pass + + # ------------------------------------------------------------------------- + def test_import(self): + + LOG.info("Testing import of webhooks.xlate ...") + import webhooks.xlate + LOG.debug("Module webhooks.xlate imported.") + + # ------------------------------------------------------------------------- + def test_format_timedelta_list(self): + + LOG.info("Testing function format_timedelta_list() ...") + + from webhooks.xlate import format_timedelta_list + + test_data = ( + (1, 'second', '1 Sekunde'), + (2, 'second', '2 Sekunden'), + (65, 'second', '1 Minute und 5 Sekunden'), + (3604, 'second', '1 Stunde und 4 Sekunden'), + (3674, 'second', '1 Stunde, 1 Minute und 14 Sekunden'), + ((3600 * 7) + 4, 'second', '7 Stunden und 4 Sekunden'), + (3604 + (24 * 3600), 'second', '1 Tag, 1 Stunde und 4 Sekunden'), + (3604 + (2 * 24 * 3600), 'second', '2 Tage, 1 Stunde und 4 Sekunden'), + (3604 + (2 * 24 * 3600), 'day', '2 Tage'), + ((3600 * 12) - 1 + (2 * 24 * 3600), 'day', '2 Tage'), + ((3600 * 12) + (2 * 24 * 3600), 'day', '3 Tage'), + ((3600 * 14) + 4 + (2 * 24 * 3600), 'day', '3 Tage'), + ((3600 * 24 * 30) + (2 * 24 * 3600), 'day', '1 Monat und 2 Tage'), + ((4 * 3600 * 24 * 30) + (5 * 24 * 3600), 'day', '4 Monate und 5 Tage'), + ((3600 * 24 * 365), 'day', '1 Jahr'), + ((3600 * 24 * 365) + (4 * 3600 * 24 * 30) + (5 * 24 * 3600), + 'day', '1 Jahr, 4 Monate und 5 Tage'), + ((6 * 3600 * 24 * 365) + (2 * 3600 * 24 * 30) + (5 * 24 * 3600), + 'day', '6 Jahre, 2 Monate und 5 Tage'), + ) + + for pair in test_data: + secs = pair[0] + gran = pair[1] + expected = pair[2] + + LOG.debug("Testing {s} secs, granularity {g!r} => {e!r}.".format( + s=secs, g=gran, e=expected)) + + result = format_timedelta_list(secs, granularity=gran, ) + self.assertEqual(expected, result) + + +# ============================================================================= + + +if __name__ == '__main__': + + verbose = get_arg_verbose() + if verbose is None: + verbose = 0 + init_root_logger(verbose) + + LOG.info("Starting tests ...") + + loader = unittest.TestLoader() + suite = unittest.TestSuite() + + suite.addTest(TestXlate('test_import', verbose)) + suite.addTest(TestXlate('test_format_timedelta_list', verbose)) + + runner = unittest.TextTestRunner(verbosity=verbose) + + result = runner.run(suite) + + +# ============================================================================= + +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list