Generate plugins list through https requests
The devstack plugins list can be generated through web requests in
environments (such as the proposal slave) that lack copies of all
the relevant git repositories.
One downside to this is that there is no way of getting the last
modification time of the plugin.
Change-Id: I2c5c9282a8ad80014cad171a4dfbdc8f26044cd1
diff --git a/tools/generate-devstack-plugins-list.sh b/tools/generate-devstack-plugins-list.sh
index 6e9e828..0176785 100644
--- a/tools/generate-devstack-plugins-list.sh
+++ b/tools/generate-devstack-plugins-list.sh
@@ -19,11 +19,19 @@
#
# In order to function correctly, the environment in which the
# script runs must have
+# * a writable doc/source directory relative to the current
+# working directory
+# AND ( (
# * git
# * all git repos meant to be searched for plugins cloned and
# at the desired level of up-to-datedness
-# * a writable doc/source directory relative to the current
+# * the environment variable git_dir pointing to the location
+# * of said git repositories
+# ) OR (
+# * network access to the review.openstack.org Gerrit API
# working directory
+# * network access to https://git.openstack.org/cgit
+# ))
#
# If a file named data/devstack-plugins-registry.header or
# data/devstack-plugins-registry.footer is found relative to the
@@ -35,25 +43,38 @@
test -r data/devstack-plugins-registry.header && cat data/devstack-plugins-registry.header
-pushd ${git_dir:-/opt/openstack} >/dev/null
-for i in *; do
- pushd ${i} >/dev/null
- if output="$(git log --diff-filter=A --format='%cd' --date=short -1 -- devstack/plugin.sh)"; then
- test -n "$output" && plugins[$i]=${output}
- fi
+if test -n "$git_dir"; then
+ pushd ${git_dir} >/dev/null
+ for i in *; do
+ pushd ${i} >/dev/null
+ if output="$(git log --diff-filter=A --format='%cd' --date=short -1 -- devstack/plugin.sh)"; then
+ test -n "$output" && plugins[$i]=${output}
+ fi
+ popd >/dev/null
+ done
popd >/dev/null
-done
-popd >/dev/null
-sorted_plugins=( $(for k in "${!plugins[@]}"; do echo "$k"; done | sort))
+ sorted_plugins=( $(for k in "${!plugins[@]}"; do echo "$k"; done | sort))
-for k in "${sorted_plugins[@]}"; do
- project=${k:0:18}
- giturl="git://git.openstack.org/openstack/${k:0:26}"
- pdate="${plugins[$k]}"
- printf "|%-18s|%-60s|%-12s|\n" "${project}" "${giturl}" "${pdate}"
- printf "+------------------+------------------------------------------------------------+------------+\n"
-done
+ for k in "${sorted_plugins[@]}"; do
+ project=${k:0:18}
+ giturl="git://git.openstack.org/openstack/${k:0:26}"
+ pdate="${plugins[$k]}"
+ printf "|%-18s|%-60s (%-10s)|\n" "${project}" "${giturl}" "${pdate}"
+ printf "+------------------+-------------------------------------------------------------------------+\n"
+ done
+
+else
+ sorted_plugins=$(python tools/generate-devstack-plugins-list.py)
+
+ for k in ${sorted_plugins}; do
+ project=${k:0:18}
+ giturl="git://git.openstack.org/openstack/${k:0:26}"
+ printf "|%-18s|%-73s|\n" "${project}" "${giturl}"
+ printf "+------------------+-------------------------------------------------------------------------+\n"
+ done
+
+fi
test -r data/devstack-plugins-registry.footer && cat data/devstack-plugins-registry.footer
) > doc/source/plugin-registry.rst