Skip to content

Commit c5853ac

Browse files
author
James E. Blair
committed
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
1 parent e03b6bd commit c5853ac

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

doc/source/plugins.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,31 @@ directory. Inside this directory there can be 3 files.
5454
default value only if the variable is unset or empty; e.g. in bash
5555
syntax ``FOO=${FOO:-default}``.
5656

57+
The file should include a ``define_plugin`` line to indicate the
58+
plugin's name, which is the name that should be used by users on
59+
"enable_plugin" lines. It should generally be the last component of
60+
the git repo path (e.g., if the plugin's repo is
61+
openstack/devstack-foo, then the name here should be "foo") ::
62+
63+
define_plugin <YOUR PLUGIN>
64+
65+
If your plugin depends on another plugin, indicate it in this file
66+
with one or more lines like the following::
67+
68+
plugin_requires <YOUR PLUGIN> <OTHER PLUGIN>
69+
70+
For a complete example, if the plugin "foo" depends on "bar", the
71+
``settings`` file should include::
72+
73+
define_plugin foo
74+
plugin_requires foo bar
75+
76+
Devstack does not currently use this dependency information, so it's
77+
important that users continue to add enable_plugin lines in the
78+
correct order in ``local.conf``, however adding this information
79+
allows other tools to consider dependency information when
80+
automatically generating ``local.conf`` files.
81+
5782
- ``plugin.sh`` - the actual plugin. It is executed by devstack at
5883
well defined points during a ``stack.sh`` run. The plugin.sh
5984
internal structure is discussed below.

functions-common

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,35 @@ function run_phase {
17031703
fi
17041704
}
17051705

1706+
# define_plugin <name>
1707+
#
1708+
# This function is a no-op. It allows a plugin to define its name So
1709+
# that other plugins may reference it by name. It should generally be
1710+
# the last component of the canonical git repo name. E.g.,
1711+
# openstack/devstack-foo should use "devstack-foo" as the name here.
1712+
#
1713+
# This function is currently a noop, but the value may still be used
1714+
# by external tools (as in plugin_requires) and may be used by
1715+
# devstack in the future.
1716+
#
1717+
# ``name`` is an arbitrary name - (aka: glusterfs, nova-docker, zaqar)
1718+
function define_plugin {
1719+
:
1720+
}
1721+
1722+
# plugin_requires <name> <other>
1723+
#
1724+
# This function is a no-op. It is currently used by external tools
1725+
# (such as the devstack module for Ansible) to automatically generate
1726+
# local.conf files. It is not currently used by devstack itself to
1727+
# resolve dependencies.
1728+
#
1729+
# ``name`` is an arbitrary name - (aka: glusterfs, nova-docker, zaqar)
1730+
# ``other`` is the name of another plugin
1731+
function plugin_requires {
1732+
:
1733+
}
1734+
17061735

17071736
# Service Functions
17081737
# =================

0 commit comments

Comments
 (0)