]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Adding info about deprecation to show-modules-txt.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 19 Mar 2019 15:28:26 +0000 (16:28 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 19 Mar 2019 15:28:26 +0000 (16:28 +0100)
lib/webhooks/show_modules.py

index ac3ee780297f03cf9eb592c5060f89cd22cf6f63..b69b6d7e9ba757ed1c71882403d04ab8961900d4 100644 (file)
@@ -380,6 +380,8 @@ class ShowModulesApp(BaseHookApp):
         for key in label.keys():
             width[key] = len(label[key])
 
+        with_superseded_name = 5
+
         if self.verbose > 2:
             LOG.debug("Breiten vor Ermittlung:\n{}".format(pp(width)))
 
@@ -408,9 +410,11 @@ class ShowModulesApp(BaseHookApp):
         tpl += "{{date_checked:<{date_checked}}}"
 
         tpl = tpl.format(**width)
+        tpl_superseded = "{{empty:{}}} | {{txt}}".format(width['name'])
 
-        if self.verbose > 2:
+        if self.verbose > 1:
             LOG.debug("Zeilen-Template:\n{}".format(tpl))
+            LOG.debug("Superseeded-Template:\n{}".format(tpl_superseded))
 
         msg = "\n" + ngettext(
             "Found total {sb}one module{eb}.",
@@ -424,8 +428,10 @@ class ShowModulesApp(BaseHookApp):
         self.print_out('=' * len(header))
 
         for full_name in module_infos.keys():
+
             module_info = module_infos[full_name]
             nr_modules += 1
+
             output_data = self.get_output_data(module_info)
             if not output_data['forge_version']:
                 output_data['forge_version'] = '~'
@@ -437,7 +443,12 @@ class ShowModulesApp(BaseHookApp):
                 output_data['date_checked'] = '~'
             if self.verbose > 3:
                 LOG.debug("Output data:\n" + pp(output_data))
+
             self.print_out(tpl.format(**output_data))
+            if module_info.forge_superseded_by:
+                txt = _("Module {o!r} is deprecated and should be substituted by {n!r}.").format(
+                    o=module_info.full_name, n=module_info.forge_superseded_by)
+                self.print_out(tpl_superseded.format(empty='', txt=txt))
 
         self.print_out()