Browse code

Add script to autogenerate doc/source/plugin-registry.rst

This generates the plugin-registry document from a static header,
a scan of openstack/ git repositories, and a static footer. It
is intended to be run by a periodic job proposal bot to keep the
list of plugins current.

Change-Id: Ia04ab72900c8efd5d5289fbd7632201dcaa3e5d9

Clint Adams authored on 2016/01/20 08:17:49
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,28 @@
0
+
1
+Drivers
2
+=======
3
+
4
++--------------------+-------------------------------------------------+------------------+
5
+|Plugin Name         |URL                                              |Comments          |
6
++--------------------+-------------------------------------------------+------------------+
7
+|dragonflow          |git://git.openstack.org/openstack/dragonflow     |[d1]_             |
8
++--------------------+-------------------------------------------------+------------------+
9
+|odl                 |git://git.openstack.org/openstack/networking-odl |[d2]_             |
10
++--------------------+-------------------------------------------------+------------------+
11
+
12
+.. [d1] demonstrates example of installing 3rd party SDN controller
13
+.. [d2] demonstrates a pretty advanced set of modes that that allow
14
+        one to run OpenDayLight either from a pre-existing install, or
15
+        also from source
16
+
17
+Alternate Configs
18
+=================
19
+
20
++-------------+------------------------------------------------------------+------------+
21
+| Plugin Name | URL                                                        | Comments   |
22
+|             |                                                            |            |
23
++-------------+------------------------------------------------------------+------------+
24
+|glusterfs    |git://git.openstack.org/openstack/devstack-plugin-glusterfs |            |
25
++-------------+------------------------------------------------------------+------------+
26
+|             |                                                            |            |
27
++-------------+------------------------------------------------------------+------------+
0 28
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+==========================
1
+ DevStack Plugin Registry
2
+==========================
3
+
4
+Since we've created the external plugin mechanism, it's gotten used by
5
+a lot of projects. The following is a list of plugins that currently
6
+exist. Any project that wishes to list their plugin here is welcomed
7
+to.
8
+
9
+Detected Plugins
10
+================
11
+
12
+The following are plugins that a script has found in the openstack/
13
+namespace, which includes but is not limited to official OpenStack
14
+projects.
15
+
16
++------------------+------------------------------------------------------------+------------+
17
+|Plugin Name       |URL                                                         |Date        |
18
++------------------+------------------------------------------------------------+------------+
0 19
new file mode 100644
... ...
@@ -0,0 +1,59 @@
0
+#!/bin/bash -ex
1
+
2
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+# not use this file except in compliance with the License. You may obtain
6
+# a copy of the License at
7
+#
8
+#    http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+# License for the specific language governing permissions and limitations
14
+# under the License.
15
+
16
+# This script is intended to be run as a periodic proposal bot job
17
+# in OpenStack infrastructure, though you can run it as a one-off.
18
+#
19
+# In order to function correctly, the environment in which the
20
+# script runs must have
21
+#   * git
22
+#   * all git repos meant to be searched for plugins cloned and
23
+#     at the desired level of up-to-datedness
24
+#   * a writable doc/source directory relative to the current
25
+#     working directory
26
+#
27
+# If a file named data/devstack-plugins-registry.header or
28
+# data/devstack-plugins-registry.footer is found relative to the
29
+# current working directory, it will be prepended or appended to
30
+# the generated reStructuredText plugins table respectively.
31
+
32
+(
33
+declare -A plugins
34
+
35
+test -r data/devstack-plugins-registry.header && cat data/devstack-plugins-registry.header
36
+
37
+pushd ${git_dir:-/opt/openstack} >/dev/null
38
+for i in *; do
39
+    pushd ${i} >/dev/null
40
+    if output="$(git log --diff-filter=A --format='%cd' --date=short -1 -- devstack/plugin.sh)"; then
41
+        test -n "$output" && plugins[$i]=${output}
42
+    fi
43
+    popd >/dev/null
44
+done
45
+popd >/dev/null
46
+
47
+sorted_plugins=( $(for k in "${!plugins[@]}"; do echo "$k"; done | sort))
48
+
49
+for k in "${sorted_plugins[@]}"; do
50
+    project=${k:0:18}
51
+    giturl="git://git.openstack.org/openstack/${k:0:26}"
52
+    pdate="${plugins[$k]}"
53
+    printf "|%-18s|%-60s|%-12s|\n" "${project}" "${giturl}" "${pdate}"
54
+    printf "+------------------+------------------------------------------------------------+------------+\n"
55
+done
56
+
57
+test -r data/devstack-plugins-registry.footer && cat data/devstack-plugins-registry.footer
58
+) > doc/source/plugin-registry.rst