Katello / katello-packaging

[DEPRECATED] Packaging for Katello
7 stars 33 forks source link

Added nicely formatted list of services #525

Closed lzap closed 6 years ago

lzap commented 7 years ago

We do print "Done!" string when all operations (start|stop|status) were successful and "Some services failed" in other case, but particularly the successful operation is not easily visible and I tend to scroll up through unreadable output from systemd statuses.

This patch adds nicely formatted output which is clear and improves UX with this script:

...
Redirecting to /bin/systemctl status goferd.service
● goferd.service - Gofer Agent
   Loaded: loaded (/usr/lib/systemd/system/goferd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-09-06 12:47:54 CEST; 14min ago
 Main PID: 16168 (python)
   CGroup: /system.slice/goferd.service
           └─16168 python /usr/bin/goferd --foreground

Sep 06 12:47:56 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][worker-0] gofer.messaging.adapter.connect:30 - connected: proton+amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:56 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][worker-0] root:512 - connected to sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:57 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][worker-0] gofer.messaging.adapter.proton.connection:131 - closed: proton+amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:57 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] gofer.messaging.adapter.connect:28 - connecting: proton+amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:57 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] gofer.messaging.adapter.proton.connection:87 - open: URL: amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647|SSL: ca: /etc/rhsm/ca/katello-default-ca.pem|key: None|certificate: /etc/pki/consumer/bundle.pem|host-validation: None
Sep 06 12:47:57 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] root:490 - connecting to sat-r220-02.lab.eng.rdu2.redhat.com:5647...
Sep 06 12:47:57 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][worker-0] gofer.agent.plugin:368 - plugin:katelloplugin, attached => pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5
Sep 06 12:47:58 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] gofer.messaging.adapter.proton.connection:92 - opened: proton+amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:58 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] gofer.messaging.adapter.connect:30 - connected: proton+amqps://sat-r220-02.lab.eng.rdu2.redhat.com:5647
Sep 06 12:47:58 zzzap.lab.eng.brq.redhat.com goferd[16168]: [INFO][pulp.agent.0d8f6f56-dfd4-4ea7-af6a-99a7248c1be5] root:512 - connected to sat-r220-02.lab.eng.rdu2.redhat.com:5647
Service mongod                                   [  OK  ]
Service postgresql                               [  OK  ]
Service qpidd                                    [ FAIL ]
Service qdrouterd                                [  OK  ]
Service squid                                    [  OK  ]
Service tomcat                                   [  OK  ]
Service tomcat6                                  [  OK  ]
Service pulp_workers                             [  OK  ]
Service pulp_celerybeat                          [  OK  ]
Service pulp_resource_manager                    [  OK  ]
Service pulp_streamer                            [  OK  ]
Service foreman-proxy                            [  OK  ]
Service smart_proxy_dynflow_core                 [  OK  ]
Service httpd                                    [  OK  ]
Service puppetserver                             [  OK  ]
Service foreman-tasks                            [  OK  ]
Service goferd                                   [  OK  ]
Some services failed to status: qpidd
theforeman-bot commented 7 years ago

There were the following issues with the commit message:

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

sean797 commented 7 years ago

I feel like this duplicates the last line, Some services failed to status: qpidd. I'm not sure it should print both?

lzap commented 6 years ago

I did not want to break existing scripts which hooked into this.

sean797 commented 6 years ago

What about making some of the output bold or a different colour? I dont feel like there's any benefit in printing the same info twice in different formats.

I see your problem as systemctl status foo prints too much information (e.g logs) and it's hard to read because this script calls so many services, forgive me if that's not accurate.

Maybe the solution is to create a katello.service unit that can replace this script or filter the systemctl status foo output ?

theforeman-bot commented 6 years ago

There were the following issues with the commit message:

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

lzap commented 6 years ago

You know what, there is an exit code available, I removed the now useless messages. The list is pretty clear. Please squash before merge.

ehelms commented 6 years ago

These packages and code have all moved to foreman-packaging rpm/develop under a katello subfolder. Please re-open your PR against it to ensure there is no data loss between the repositories. The code in this repository will be subsequently removed -- https://github.com/Katello/katello-packaging/pull/575