5 Commits

Author SHA1 Message Date
Jenkins
465a89246f Merge "Fixed a bunch of spacing" 2017-03-05 22:22:31 +00:00
Akihiro Motoki
6f2963d752 refactor: Avoid overriding run() in cliff command
cliff Command subclasses are suggested to override take_action.
run() method is reserved for extending base classes.
Thus, this commit changes to implement take_action() instead of run().

Closes-Bug: #1532258
Change-Id: Id845a80dbad2f436df5a55c9be502068e6f7b291
2016-03-03 03:30:07 +09:00
Brandon Palm
1b765bda39 Fixed a bunch of spacing
Nothing too crazy here.  Just changed some spacing problems that
I encounted in the neutronclient.

Change-Id: I236a4af738851508681f595cb9233c2cfbc52899
2016-02-29 08:56:22 -06:00
Akihiro Motoki
131160ed56 refactor: Get rid of usage of get_data in favor of take_action
Previously the dropped OpenStackCommand uses get_data()
as an interface which subclasses should implement.
On the other hand, cliff Command recommends to implement
take_action() in subclasses and there is no reason not to
follow this convention.

Partial-Bug: #1532258
Change-Id: I164d6f31152df621611985a84eef76e7dfa54d44
2016-01-18 13:01:57 +09:00
Justin Hammond
779b02e480 Client command extension support
Adds extension support with emphasis on ease of extension creation. Extensions
strongly conform to preexisting neutron commands (/neutron/v2_0/*). A sample
extension has been included (/neutron/v2_0/contrib/_fox_sockets.py). As it is
assumed that the sample extension will be packaged with the client, small
changes were required to include it with the unit tests.

It is also possible to install a module with a 'neutronclient.extension' entry-
point defined. More information on this can be found in the stevedore docs
under the section "Loading the Plugins". Extension discovery is modeled after
nova's module discovery but deviates strongly beyond that.

A conforming module, at a minimum:
* Will have a class that subclasses NeutronClientExtension to provide the
  requisite version support, paths, and variable names for the client.
  Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocket
* Will have at least one class that subclasses from the ClientExtension*
  classes to provide the new functionality to the client
  Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocketsList
* ClientExtension* subclasses must have a shell_command class variable if the
  command is to be available to the CLI (shell.py)
  Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocketsList

Provides client command extensions through new classes: NeutronClientExtension,
and ClientExtension<Action>.
The precedence of command loading are as follows:
* hard coded commands are loaded first
* contribued commands (those in /contrib)
* external commands (installed in the environment) are loaded last

Commands that have the same name will be overwritten by commands that are
loaded later. To greatly change the execution of a command for your particular
extension you only need to override the execute method.

Currently this extension support is limited to top-level resources. Parent/
child relationships may be added if desired.

Change-Id: I5b2fe530c90b5ce1243fc10341d6d434a1ecea7a
Implements: blueprint extensible-neutronclient
2015-02-24 14:57:10 -06:00