/usr/share/doc/python-openstackclient-doc/html/plugins.html is in python-openstackclient-doc 2.3.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Plugins — OpenStack Command Line Client 2.3.0 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/tweaks.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '2.3.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="OpenStack Command Line Client 2.3.0 documentation" href="index.html" />
<link rel="next" title="Plugin Commands" href="plugin-commands.html" />
<link rel="prev" title="Configuration" href="configuration.html" />
</head>
<body role="document">
<div id="header">
<h1 id="logo"><a href="http://www.openstack.org/">OpenStack</a></h1>
<ul id="navigation">
<li><a href="http://www.openstack.org/" title="Go to the Home page" class="link">Home</a></li>
<li><a href="http://www.openstack.org/projects/" title="Go to the OpenStack Projects page">Projects</a></li>
<li><a href="http://www.openstack.org/user-stories/" title="Go to the User Stories page" class="link">User Stories</a></li>
<li><a href="http://www.openstack.org/community/" title="Go to the Community page" class="link">Community</a></li>
<li><a href="http://www.openstack.org/blog/" title="Go to the OpenStack Blog">Blog</a></li>
<li><a href="http://wiki.openstack.org/" title="Go to the OpenStack Wiki">Wiki</a></li>
<li><a href="http://docs.openstack.org/" title="Go to OpenStack Documentation" class="current">Documentation</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="plugins">
<h1>Plugins<a class="headerlink" href="#plugins" title="Permalink to this headline">¶</a></h1>
<p>The OpenStackClient plugin system is designed so that the plugin need only be
properly installed for OSC to find and use it. It utilizes the
<code class="docutils literal"><span class="pre">setuptools</span></code> entry points mechanism to advertise to OSC the
plugin module and supported commands.</p>
<div class="section" id="adoption">
<h2>Adoption<a class="headerlink" href="#adoption" title="Permalink to this headline">¶</a></h2>
<p>OpenStackClient promises to provide first class support for the following
OpenStack services: Compute, Identity, Image, Object Storage, Block Storage
and Network. These services are considered essential to any OpenStack
deployment.</p>
<p>Other OpenStack services, such as Orchestration or Telemetry may create an
OpenStackClient plugin. The source code will not be hosted by
OpenStackClient.</p>
<p>The following is a list of projects and their status as an OpenStackClient
plugin.</p>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
<col width="57%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">project</th>
<th class="head">notes</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>python-barbicanclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-odd"><td>python-ceilometerclient</td>
<td>using argparse</td>
</tr>
<tr class="row-even"><td>python-congressclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-odd"><td>python-cueclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-even"><td>python-designateclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-odd"><td>python-heatclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-even"><td>python-ironicclient</td>
<td>Using OpenStackClient</td>
</tr>
<tr class="row-odd"><td>python-magnumclient</td>
<td>using argparse</td>
</tr>
<tr class="row-even"><td>python-manilaclient</td>
<td>using argparse</td>
</tr>
<tr class="row-odd"><td>python-mistralclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-even"><td>python-muranoclient</td>
<td>using argparse</td>
</tr>
<tr class="row-odd"><td>python-saharaclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-even"><td>python-searchlightclient</td>
<td>using OpenStackClient</td>
</tr>
<tr class="row-odd"><td>python-troveclient</td>
<td>using argparse</td>
</tr>
<tr class="row-even"><td>python-zaqarclient</td>
<td>using OpenStackClient</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="implementation">
<h2>Implementation<a class="headerlink" href="#implementation" title="Permalink to this headline">¶</a></h2>
<p>Plugins are discovered by enumerating the entry points
found under <code class="xref py py-mod docutils literal"><span class="pre">openstack.cli.extension</span></code> and initializing the specified
client module.</p>
<div class="highlight-ini"><div class="highlight"><pre><span class="k">[entry_points]</span>
<span class="na">openstack.cli.extension</span> <span class="o">=</span><span class="s"></span>
<span class="s"> oscplugin = oscplugin.client</span>
</pre></div>
</div>
<p>The client module must define the following top-level variables:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">API_NAME</span></code> - A string containing the plugin API name; this is
the name of the entry point declaring the plugin client module
(<code class="docutils literal"><span class="pre">oscplugin</span> <span class="pre">=</span> <span class="pre">...</span></code> in the example above) and the group name for
the plugin commands (<code class="docutils literal"><span class="pre">openstack.oscplugin.v1</span> <span class="pre">=</span></code> in the example below)</li>
<li><code class="docutils literal"><span class="pre">API_VERSION_OPTION</span></code> (optional) - If set, the name of the API
version attribute; this must be a valid Python identifier and
match the destination set in <code class="docutils literal"><span class="pre">build_option_parser()</span></code>.</li>
<li><code class="docutils literal"><span class="pre">API_VERSIONS</span></code> - A dict mapping a version string to the client class</li>
</ul>
<p>The client module must implement the following interface functions:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">build_option_parser(parser)</span></code> - Hook to add global options to the parser</li>
<li><code class="docutils literal"><span class="pre">make_client(instance)</span></code> - Hook to create the client object</li>
</ul>
<p>OSC enumerates the plugin commands from the entry points in the usual manner
defined for the API version:</p>
<div class="highlight-ini"><div class="highlight"><pre><span class="na">openstack.oscplugin.v1</span> <span class="o">=</span><span class="s"></span>
<span class="s"> plugin_list = oscplugin.v1.plugin:ListPlugin</span>
<span class="s"> plugin_show = oscplugin.v1.plugin:ShowPlugin</span>
</pre></div>
</div>
<p>Note that OSC defines the group name as <code class="xref py py-mod docutils literal"><span class="pre">openstack.</span></code>
so the version should not contain the leading ‘v’ character.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">DEFAULT_API_VERSION</span> <span class="o">=</span> <span class="s1">'1'</span>
<span class="c1"># Required by the OSC plugin interface</span>
<span class="n">API_NAME</span> <span class="o">=</span> <span class="s1">'oscplugin'</span>
<span class="n">API_VERSION_OPTION</span> <span class="o">=</span> <span class="s1">'os_oscplugin_api_version'</span>
<span class="n">API_VERSIONS</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">'1'</span><span class="p">:</span> <span class="s1">'oscplugin.v1.client.Client'</span><span class="p">,</span>
<span class="p">}</span>
<span class="c1"># Required by the OSC plugin interface</span>
<span class="k">def</span> <span class="nf">make_client</span><span class="p">(</span><span class="n">instance</span><span class="p">):</span>
<span class="sd">"""Returns a client to the ClientManager</span>
<span class="sd"> Called to instantiate the requested client version. instance has</span>
<span class="sd"> any available auth info that may be required to prepare the client.</span>
<span class="sd"> :param ClientManager instance: The ClientManager that owns the new client</span>
<span class="sd"> """</span>
<span class="n">plugin_client</span> <span class="o">=</span> <span class="n">utils</span><span class="o">.</span><span class="n">get_client_class</span><span class="p">(</span>
<span class="n">API_NAME</span><span class="p">,</span>
<span class="n">instance</span><span class="o">.</span><span class="n">_api_version</span><span class="p">[</span><span class="n">API_NAME</span><span class="p">],</span>
<span class="n">API_VERSIONS</span><span class="p">)</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">plugin_client</span><span class="p">()</span>
<span class="k">return</span> <span class="n">client</span>
<span class="c1"># Required by the OSC plugin interface</span>
<span class="k">def</span> <span class="nf">build_option_parser</span><span class="p">(</span><span class="n">parser</span><span class="p">):</span>
<span class="sd">"""Hook to add global options</span>
<span class="sd"> Called from openstackclient.shell.OpenStackShell.__init__()</span>
<span class="sd"> after the builtin parser has been initialized. This is</span>
<span class="sd"> where a plugin can add global options such as an API version setting.</span>
<span class="sd"> :param argparse.ArgumentParser parser: The parser object that has been</span>
<span class="sd"> initialized by OpenStackShell.</span>
<span class="sd"> """</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span>
<span class="s1">'--os-oscplugin-api-version'</span><span class="p">,</span>
<span class="n">metavar</span><span class="o">=</span><span class="s1">'<oscplugin-api-version>'</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s1">'OSC Plugin API version, default='</span> <span class="o">+</span>
<span class="n">DEFAULT_API_VERSION</span> <span class="o">+</span>
<span class="s1">' (Env: OS_OSCPLUGIN_API_VERSION)'</span><span class="p">)</span>
<span class="k">return</span> <span class="n">parser</span>
</pre></div>
</div>
</div>
<div class="section" id="checklist-for-adding-new-openstack-plugins">
<h2>Checklist for adding new OpenStack plugins<a class="headerlink" href="#checklist-for-adding-new-openstack-plugins" title="Permalink to this headline">¶</a></h2>
<p>Creating the initial plugin described above is the first step. There are a few
more steps needed to fully integrate the client with openstackclient.</p>
<div class="section" id="add-the-command-checker-to-your-ci">
<h3>Add the command checker to your CI<a class="headerlink" href="#add-the-command-checker-to-your-ci" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>Modify the section of <code class="docutils literal"><span class="pre">zuul/layout.yaml</span></code> related to your repository to
add <code class="docutils literal"><span class="pre">osc-plugin-jobs</span></code> to the list of job templates for your project.
This job checks that to see if any new commands are: duplicated, missing
entry points, or have overlap; across all openstackclient plugins.</li>
<li>Update <code class="docutils literal"><span class="pre">jenkins/scripts/check-osc-plugins.sh</span></code> to include your new
library to be installed from source. This is essential in running the
previously mentioned check job. Simply add
<code class="docutils literal"><span class="pre">install_from_source</span> <span class="pre">python-fooclient</span></code> to the block of code where all
other clients are installed.</li>
</ol>
</div>
<div class="section" id="changes-to-python-openstackclient">
<h3>Changes to python-openstackclient<a class="headerlink" href="#changes-to-python-openstackclient" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>In <code class="docutils literal"><span class="pre">doc/source/plugins.rst</span></code>, update the <cite>Adoption</cite> section to reflect the
status of the project.</li>
<li>Update <code class="docutils literal"><span class="pre">doc/source/commands.rst</span></code> to include objects that are defined by
fooclient’s new plugin.</li>
<li>Update <code class="docutils literal"><span class="pre">doc/source/plugin-commands.rst</span></code> to include the entry point defined
in fooclient. We use <a class="reference external" href="http://docs.openstack.org/developer/stevedore/sphinxext.html">sphinxext</a> to automatically document commands that
are used.</li>
<li>Update <code class="docutils literal"><span class="pre">test-requirements.txt</span></code> to include fooclient. This is necessary
to auto-document the commands in the previous step.</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Plugins</a><ul>
<li><a class="reference internal" href="#adoption">Adoption</a></li>
<li><a class="reference internal" href="#implementation">Implementation</a></li>
<li><a class="reference internal" href="#checklist-for-adding-new-openstack-plugins">Checklist for adding new OpenStack plugins</a><ul>
<li><a class="reference internal" href="#add-the-command-checker-to-your-ci">Add the command checker to your CI</a></li>
<li><a class="reference internal" href="#changes-to-python-openstackclient">Changes to python-openstackclient</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="configuration.html"
title="previous chapter">Configuration</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="plugin-commands.html"
title="next chapter">Plugin Commands</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/plugins.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="plugin-commands.html" title="Plugin Commands"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="configuration.html" title="Configuration"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">OpenStack Command Line Client 2.3.0 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2012-2013 OpenStack Foundation.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.6.
</div>
<script type="text/javascript">
try {
//Tracking docs.openstack.org/developer/<projectname> only
//The URL is built from the project variable in conf.py
var pageTracker = _gat._getTracker("UA-17511903-1");
pageTracker._setCookiePath("/developer/OpenStack Command Line Client");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
|