From c5853ac1afe79c9b96a2c4cbd30069566ab12955 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 21 Nov 2017 09:44:42 -0800 Subject: [PATCH] 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 --- doc/source/plugins.rst | 25 +++++++++++++++++++++++++ functions-common | 29 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/doc/source/plugins.rst b/doc/source/plugins.rst index fae1a1d8f5..89b9381813 100644 --- a/doc/source/plugins.rst +++ b/doc/source/plugins.rst @@ -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 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 + + If your plugin depends on another plugin, indicate it in this file + with one or more lines like the following:: + + plugin_requires + + 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 well defined points during a ``stack.sh`` run. The plugin.sh internal structure is discussed below. diff --git a/functions-common b/functions-common index 6d565916fa..aee569bee2 100644 --- a/functions-common +++ b/functions-common @@ -1703,6 +1703,35 @@ function run_phase { fi } +# define_plugin +# +# 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 +# +# 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 # =================