@@ -128,15 +128,42 @@ def _load_plugins(self):
128128 },
129129 )
130130
131- # Command groups deal only with major versions
132- version = '.v' + version_opt .replace ('.' , '_' ).split ('_' )[0 ]
133- cmd_group = 'openstack.' + api .replace ('-' , '_' ) + version
131+ # Build our command group which we expect to look like:
132+ #
133+ # openstack.<service>.vN
134+ #
135+ # Note that command groups deal only with major versions
136+ cmd_group = '.' .join (
137+ [
138+ 'openstack' ,
139+ api .replace ('-' , '_' ),
140+ 'v' + version_opt .replace ('.' , '_' ).split ('_' )[0 ],
141+ ]
142+ )
134143 self .command_manager .add_command_group (cmd_group )
135144 self .log .debug (
136145 '%(name)s API version %(version)s, cmd group %(group)s' ,
137146 {'name' : api , 'version' : version_opt , 'group' : cmd_group },
138147 )
139148
149+ mod_extensions = getattr (mod , 'API_EXTENSIONS' , None )
150+ if not mod_extensions :
151+ continue
152+
153+ for extension in mod_extensions :
154+ extension_cmd_group = '.' .join ([cmd_group , extension ])
155+ self .command_manager .add_command_group (extension_cmd_group )
156+ self .log .debug (
157+ '%(name)s API version %(version)s '
158+ '(%(extension)s extension), cmd group %(group)s' ,
159+ {
160+ 'name' : api ,
161+ 'version' : version_opt ,
162+ 'extension' : extension ,
163+ 'group' : cmd_group ,
164+ },
165+ )
166+
140167 def _load_commands (self ):
141168 """Load commands via cliff/stevedore
142169
0 commit comments