Allow plugins to express dependency info

Add a no-op function, "plugin_requires" to allow plugins to indicate
their dependencies on each other.  This will be used by the Devstack
Ansible module when writing local.conf files.

Also add define_plugin to allow plugins to indicate their canonical
names.

Change-Id: Ibd8c7222ed7dfb08d7ea821d871fc6f3b88de24b
This commit is contained in:
James E. Blair 2017-11-21 09:44:42 -08:00
parent e03b6bd8f8
commit c5853ac1af
2 changed files with 54 additions and 0 deletions

View File

@ -54,6 +54,31 @@ directory. Inside this directory there can be 3 files.
default value only if the variable is unset or empty; e.g. in bash default value only if the variable is unset or empty; e.g. in bash
syntax ``FOO=${FOO:-default}``. syntax ``FOO=${FOO:-default}``.
The file should include a ``define_plugin`` line to indicate the
plugin's name, which is the name that should be used by users on
"enable_plugin" lines. It should generally be the last component of
the git repo path (e.g., if the plugin's repo is
openstack/devstack-foo, then the name here should be "foo") ::
define_plugin <YOUR PLUGIN>
If your plugin depends on another plugin, indicate it in this file
with one or more lines like the following::
plugin_requires <YOUR PLUGIN> <OTHER PLUGIN>
For a complete example, if the plugin "foo" depends on "bar", the
``settings`` file should include::
define_plugin foo
plugin_requires foo bar
Devstack does not currently use this dependency information, so it's
important that users continue to add enable_plugin lines in the
correct order in ``local.conf``, however adding this information
allows other tools to consider dependency information when
automatically generating ``local.conf`` files.
- ``plugin.sh`` - the actual plugin. It is executed by devstack at - ``plugin.sh`` - the actual plugin. It is executed by devstack at
well defined points during a ``stack.sh`` run. The plugin.sh well defined points during a ``stack.sh`` run. The plugin.sh
internal structure is discussed below. internal structure is discussed below.

View File

@ -1703,6 +1703,35 @@ function run_phase {
fi fi
} }
# define_plugin <name>
#
# This function is a no-op. It allows a plugin to define its name So
# that other plugins may reference it by name. It should generally be
# the last component of the canonical git repo name. E.g.,
# openstack/devstack-foo should use "devstack-foo" as the name here.
#
# This function is currently a noop, but the value may still be used
# by external tools (as in plugin_requires) and may be used by
# devstack in the future.
#
# ``name`` is an arbitrary name - (aka: glusterfs, nova-docker, zaqar)
function define_plugin {
:
}
# plugin_requires <name> <other>
#
# This function is a no-op. It is currently used by external tools
# (such as the devstack module for Ansible) to automatically generate
# local.conf files. It is not currently used by devstack itself to
# resolve dependencies.
#
# ``name`` is an arbitrary name - (aka: glusterfs, nova-docker, zaqar)
# ``other`` is the name of another plugin
function plugin_requires {
:
}
# Service Functions # Service Functions
# ================= # =================