Browse code

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

James E. Blair authored on 2017/11/22 02:44:42
Showing 2 changed files
... ...
@@ -54,6 +54,31 @@ directory. Inside this directory there can be 3 files.
54 54
   default value only if the variable is unset or empty; e.g. in bash
55 55
   syntax ``FOO=${FOO:-default}``.
56 56
 
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
+
57 82
 - ``plugin.sh`` - the actual plugin. It is executed by devstack at
58 83
   well defined points during a ``stack.sh`` run. The plugin.sh
59 84
   internal structure is discussed below.
... ...
@@ -1703,6 +1703,35 @@ function run_phase {
1703 1703
     fi
1704 1704
 }
1705 1705
 
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
+
1706 1735
 
1707 1736
 # Service Functions
1708 1737
 # =================