Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Better katello-service list output #238

Open
ericzolf opened this issue Jun 16, 2016 · 2 comments
Open

Better katello-service list output #238

ericzolf opened this issue Jun 16, 2016 · 2 comments

Comments

@ericzolf
Copy link

The current output of the 'list' command just tells if the unit exists and is enabled, it doesn't tell if the service is running or not (whereas the output of 'status' is unreadable).

I suggest the following slight change to the list_services function:

    regex = services_by_priority.map { |service| "^[^a-z_-]*#{service}.service" }.join('\|')
    puts `systemctl list-units --all \*.service | grep -e '#{regex}' -e '^ *UNIT'`

The output then looks as follows (with systemctl), which is much more informative while remaining readable:

# katello-service list
  UNIT                                   LOAD      ACTIVE   SUB     DESCRIPTION
  foreman-proxy.service                  loaded    inactive dead    Foreman Proxy
  foreman-tasks.service                  loaded    inactive dead    Foreman jobs daemon
  httpd.service                          loaded    active   running The Apache HTTP Server
  mongod.service                         loaded    active   running High-performance, schema-free document-oriented database
  postgresql.service                     loaded    active   running PostgreSQL database server
  pulp_celerybeat.service                loaded    active   running Pulp's Celerybeat
  pulp_resource_manager.service          loaded    active   running Pulp Resource Manager
  pulp_workers.service                   loaded    active   exited  Pulp Celery Workers
  qdrouterd.service                      loaded    active   running Qpid Dispatch router daemon
  qpidd.service                          loaded    active   running An AMQP message broker daemon.
  tomcat.service                         loaded    active   running Apache Tomcat Web Application Container
@ehelms
Copy link
Member

ehelms commented Aug 26, 2016

@ericzolf would you like to open a PR with your proposed changes? We are happy to open a PR with the patch ourselves, however, this gives you an opportunity to author and own a change within the project!

@fftux
Copy link
Contributor

fftux commented Feb 22, 2017

Created PR.

#384

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants