diff options
author | Kanagaraj Manickam <kanagaraj.manickam@hp.com> | 2015-01-09 15:18:34 +0530 |
---|---|---|
committer | Kanagaraj Manickam <kanagaraj.manickam@hp.com> | 2015-02-02 13:05:46 +0530 |
commit | 65134b8d9938a9eec984087f4fd9af95e1e2768c (patch) | |
tree | d0baaa65bdc49ebb5e149459487d3b76c0a0b8a6 /heat/cmd | |
parent | f299d0260e6bab6c83007672eb8acabb86eeb9e3 (diff) | |
download | heat-65134b8d9938a9eec984087f4fd9af95e1e2768c.tar.gz |
heat-manage service list
Adds required REST API, Db model and engine service
changes for reporting the heat engine service status.
Change-Id: I3ef29c1efd2015d62eec1033ed3a8c9f42e7a6e2
Implements: blueprint heat-manage-service-list
"DocImpact"
Diffstat (limited to 'heat/cmd')
-rw-r--r-- | heat/cmd/manage.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/heat/cmd/manage.py b/heat/cmd/manage.py index 71ca77690..1a189e07f 100644 --- a/heat/cmd/manage.py +++ b/heat/cmd/manage.py @@ -21,7 +21,9 @@ import sys from oslo.config import cfg +from heat.common import context from heat.common.i18n import _ +from heat.common import service_utils from heat.db import api from heat.db import utils from heat.openstack.common import log @@ -44,6 +46,39 @@ def do_db_sync(): api.db_sync(api.get_engine(), CONF.command.version) +class ServiceManageCommand(object): + def service_list(self): + ctxt = context.get_admin_context() + services = [service_utils.format_service(service) + for service in api.service_get_all(ctxt)] + + print_format = "%-16s %-16s %-36s %-10s %-10s %-10s %-10s" + print(print_format % (_('Hostname'), + _('Binary'), + _('Engine_Id'), + _('Host'), + _('Topic'), + _('Status'), + _('Updated At'))) + + for svc in services: + print(print_format % (svc['hostname'], + svc['binary'], + svc['engine_id'], + svc['host'], + svc['topic'], + svc['status'], + svc['updated_at'])) + + @staticmethod + def add_service_parsers(subparsers): + service_parser = subparsers.add_parser('service') + service_parser.set_defaults(command_object=ServiceManageCommand) + service_subparsers = service_parser.add_subparsers(dest='action') + list_parser = service_subparsers.add_parser('list') + list_parser.set_defaults(func=ServiceManageCommand().service_list) + + def purge_deleted(): """ Remove database records that have been previously soft deleted @@ -69,6 +104,8 @@ def add_command_parsers(subparsers): choices=['days', 'hours', 'minutes', 'seconds'], help=_('Granularity to use for age argument, defaults to days.')) + ServiceManageCommand.add_service_parsers(subparsers) + command_opt = cfg.SubCommandOpt('command', title='Commands', help='Show available commands.', |