From 9cb8950edb0c196d8be20ebd9a48e5575ac136b6 Mon Sep 17 00:00:00 2001 From: int32bit Date: Thu, 27 Apr 2017 13:53:04 +0800 Subject: [PATCH] Change register report format --- README.md | 20 ++++++++++---------- action_catalog.md | 2 +- mistral_actions/client/shell.py | 5 ++++- update.sh | 4 +++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d45b6c5..a49092a 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ See "mistral-actions help COMMAND" for help on a specific command. #### 3. Discover New Actions -```sh +``` $ mistral-actions discover Follow actions discovered: +-----------------------------------------+--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+ @@ -72,17 +72,17 @@ Follow actions discovered: #### 4. Register New Actions: -```sh +``` $ mistral-actions register Follow actions have been registered: -int32bit.system.exec -int32bit.cinder.backups.assert_status -int32bit.cinder.backups.create -int32bit.cinder.volumes.assert_status -int32bit.cinder.snapshots.assert_status -int32bit.nova.servers.assert_status -int32bit.glance.images.assert_status -int32bit.glance.images.filter_by +int32bit.system.exec(cmd): Run command with arguments and return its output as a byte string. +int32bit.cinder.backups.assert_status(backup_id, status="available"): Assert a volume backup in special status. +int32bit.cinder.backups.create(volume_id, backup_name, snapshot_id=null, description=null, container=null, incremental=true, force=true): Creates a volume backup. +int32bit.cinder.volumes.assert_status(volume_id, status="available"): Assert a volume in special status. +int32bit.cinder.snapshots.assert_status(snapshot_id, status="available"): Assert a volume snapshot in special status. +int32bit.nova.servers.assert_status(server, status="ACTIVE"): Assert a server in special status. +int32bit.glance.images.assert_status(image_id, status="active"): Assert a image in special status. +int32bit.glance.images.filter_by(**kwargs): List image filtered by id, name, status, etc. ``` You need to restart mistral service before use new actions: diff --git a/action_catalog.md b/action_catalog.md index 2e0cf6e..bcd871d 100644 --- a/action_catalog.md +++ b/action_catalog.md @@ -11,4 +11,4 @@ |int32bit.nova.servers.assert_status|Assert a server in special status.|server, status="ACTIVE"| |int32bit.system.exec|Run command with arguments and return its output as a byte string.|cmd| -Update at 2017-04-27 05:13:57 UTC +Update at 2017-04-27 05:51:07 UTC diff --git a/mistral_actions/client/shell.py b/mistral_actions/client/shell.py index 6069cb6..6bf1708 100644 --- a/mistral_actions/client/shell.py +++ b/mistral_actions/client/shell.py @@ -40,7 +40,10 @@ def do_register(args): actions_cli.register_all(discovered_actions) print("Follow actions have been registered: ") for action in discovered_actions: - print(action['name']) + print("%(name)s(%(args)s): %(description)s" % + {'name':action['name'], + 'args': action['input_str'], + 'description': action['description'].split('\n')[0]}) except Exception as ex: print("Fail to register actions: %s" % ex) else: diff --git a/update.sh b/update.sh index 49ec44a..29d7d98 100755 --- a/update.sh +++ b/update.sh @@ -1,6 +1,8 @@ #!/bin/sh python setup.py install -mistral-actions register --override + +echo +mistral-actions register --override 2>/dev/null systemctl restart openstack-mistral-engine openstack-mistral-executor cat >action_catalog.md <