summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2013-03-08 15:39:48 -0600
committerDean Troyer <dtroyer@gmail.com>2013-03-15 15:18:22 -0500
commit4fd5dd3b1afca700073affe313732c1d0540215e (patch)
treeb82a83fc98a4c6d034803c7cbcbff1ed5853d7d9 /openstackclient/shell.py
parent6fae83b935d36adc6d2accc4f44e498cef5b9848 (diff)
downloadpython-openstackclient-4fd5dd3b1afca700073affe313732c1d0540215e.tar.gz
Add a simple extension hook
This enables stand-alone modules to hook in to the command-line handler in a dedicated API namespace. These extensions have access to the existing clients via the client manager but no way to add another client to the manager is provided.. blueprint client-extensions Change-Id: I4b2eaa780d8ba881db23d950d09b8702e9e314ef
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 29f9f70a..eef2d061 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -298,7 +298,6 @@ class OpenStackShell(App):
super(OpenStackShell, self).initialize_app(argv)
# stash selected API versions for later
- # TODO(dtroyer): how do extenstions add their version requirements?
self.api_version = {
'compute': self.options.os_compute_api_version,
'identity': self.options.os_identity_api_version,
@@ -312,6 +311,19 @@ class OpenStackShell(App):
self.command_manager.add_command_group(
'openstack.' + api + version)
+ # This is the naive extension implementation referred to in
+ # blueprint 'client-extensions'
+ # Extension modules can register their commands in an
+ # 'openstack.extension' entry point group:
+ # entry_points={
+ # 'openstack.extension': [
+ # 'list_repo=qaz.github.repo:ListRepo',
+ # 'show_repo=qaz.github.repo:ShowRepo',
+ # ],
+ # }
+ self.command_manager.add_command_group(
+ 'openstack.extension')
+
# Handle deferred help and exit
if self.options.deferred_help:
self.DeferredHelpAction(self.parser, self.parser, None, None)