Merge "Add Glance Artifact API in devstack installation"
diff --git a/data/devstack-plugins-registry.header b/data/devstack-plugins-registry.header
index 9f8a994..c46ed97 100644
--- a/data/devstack-plugins-registry.header
+++ b/data/devstack-plugins-registry.header
@@ -1,3 +1,8 @@
+..
+  Note to patch submitters: this file is covered by a periodic proposal
+  job.  You should edit the files data/devstack-plugins-registry.footer
+  data/devstack-plugins-registry.header instead of this one.
+
 ==========================
  DevStack Plugin Registry
 ==========================
@@ -14,6 +19,6 @@
 namespace, which includes but is not limited to official OpenStack
 projects.
 
-+------------------+------------------------------------------------------------+------------+
-|Plugin Name       |URL                                                         |Date        |
-+------------------+------------------------------------------------------------+------------+
++------------------+-------------------------------------------------------------------------+
+|Plugin Name       |URL                                                                      |
++------------------+-------------------------------------------------------------------------+
diff --git a/lib/cinder_backends/solidfire b/lib/cinder_backends/solidfire
deleted file mode 100644
index 16bc527..0000000
--- a/lib/cinder_backends/solidfire
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-#
-# lib/cinder_backends/solidfire
-# Configure the solidfire driver
-
-# Enable with:
-#
-#   CINDER_ENABLED_BACKENDS+=,solidfire:<volume-type-name>
-
-# Dependencies:
-#
-# - ``functions`` file
-# - ``cinder`` configurations
-
-# CINDER_CONF
-
-# configure_cinder_driver - make configuration changes, including those to other services
-
-# Save trace setting
-_XTRACE_CINDER_SOLIDFIRE=$(set +o | grep xtrace)
-set +o xtrace
-
-
-# Entry Points
-# ------------
-
-# configure_cinder_backend_solidfire - Set config files, create data dirs, etc
-function configure_cinder_backend_solidfire {
-    # To use SolidFire, set the following in local.conf:
-    # CINDER_ENABLED_BACKENDS+=,solidfire:<volume-type-name>
-    # SAN_IP=<mvip>
-    # SAN_LOGIN=<cluster-admin-account>
-    # SAN_PASSWORD=<cluster-admin-password>
-
-    local be_name=$1
-    iniset $CINDER_CONF $be_name volume_backend_name $be_name
-    iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.solidfire.SolidFireDriver"
-    iniset $CINDER_CONF $be_name san_ip $SAN_IP
-    iniset $CINDER_CONF $be_name san_login $SAN_LOGIN
-    iniset $CINDER_CONF $be_name san_password $SAN_PASSWORD
-}
-
-
-# Restore xtrace
-$_XTRACE_CINDER_SOLIDFIRE
-
-# Local variables:
-# mode: shell-script
-# End:
diff --git a/lib/tempest b/lib/tempest
index caf8f11..8d3bf7c 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -322,7 +322,9 @@
     local tmp_cfg_file
     tmp_cfg_file=$(mktemp)
     cd $TEMPEST_DIR
-    tox -revenv --notest
+    if [[ "$OFFLINE" != "True" ]]; then
+        tox -revenv --notest
+    fi
     # NOTE(mtreinish): Respect constraints on tempest verify-config venv
     tox -evenv -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
     tox -evenv -- tempest verify-config -uro $tmp_cfg_file
diff --git a/rejoin-stack.sh b/rejoin-stack.sh
index 30b7bab..7048865 100755
--- a/rejoin-stack.sh
+++ b/rejoin-stack.sh
@@ -11,14 +11,15 @@
 
 source $TOP_DIR/stackrc
 
+SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
 # if screenrc exists, run screen
-if [[ -e $TOP_DIR/stack-screenrc ]]; then
-    if screen -ls | egrep -q "[0-9].stack"; then
+if [[ -e $SCREENRC ]]; then
+    if screen -ls | egrep -q "[0-9]+.${SCREEN_NAME}"; then
         echo "Attaching to already started screen session.."
-        exec screen -r stack
+        exec screen -r $SCREEN_NAME
     fi
-    exec screen -c $TOP_DIR/stack-screenrc
+    exec screen -c $SCREENRC
 fi
 
-echo "Couldn't find $TOP_DIR/stack-screenrc file; have you run stack.sh yet?"
+echo "Couldn't find $SCREENRC file; have you run stack.sh yet?"
 exit 1
diff --git a/tools/generate-devstack-plugins-list.py b/tools/generate-devstack-plugins-list.py
new file mode 100644
index 0000000..1fa5501
--- /dev/null
+++ b/tools/generate-devstack-plugins-list.py
@@ -0,0 +1,59 @@
+#! /usr/bin/env python
+
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# This script is intended to be run as part of a periodic proposal bot
+# job in OpenStack infrastructure.
+#
+# In order to function correctly, the environment in which the
+# script runs must have
+#   * network access to the review.openstack.org Gerrit API
+#     working directory
+#   * network access to https://git.openstack.org/cgit
+
+import json
+import requests
+
+url = 'https://review.openstack.org/projects/'
+
+# This is what a project looks like
+'''
+  "openstack-attic/akanda": {
+    "id": "openstack-attic%2Fakanda",
+    "state": "READ_ONLY"
+  },
+'''
+
+def is_in_openstack_namespace(proj):
+    return proj.startswith('openstack/')
+
+# Rather than returning a 404 for a nonexistent file, cgit delivers a
+# 0-byte response to a GET request.  It also does not provide a
+# Content-Length in a HEAD response, so the way we tell if a file exists
+# is to check the length of the entire GET response body.
+def has_devstack_plugin(proj):
+    r = requests.get("https://git.openstack.org/cgit/%s/plain/devstack/plugin.sh" % proj)
+    if len(r.text) > 0:
+        return True
+    else:
+        False
+
+r = requests.get(url)
+projects = sorted(filter(is_in_openstack_namespace, json.loads(r.text[4:])))
+
+found_plugins = filter(has_devstack_plugin, projects)
+
+for project in found_plugins:
+    print project[10:]
diff --git a/tools/generate-devstack-plugins-list.sh b/tools/generate-devstack-plugins-list.sh
index 6e9e828..b7817a0 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,18 @@
 
 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
-    popd >/dev/null
-done
-popd >/dev/null
+sorted_plugins=$(python tools/generate-devstack-plugins-list.py)
 
-sorted_plugins=( $(for k in "${!plugins[@]}"; do echo "$k"; done | sort))
-
-for k in "${sorted_plugins[@]}"; do
+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"
+    printf "|%-18s|%-73s|\n" "${project}" "${giturl}"
+    printf "+------------------+-------------------------------------------------------------------------+\n"
 done
 
 test -r data/devstack-plugins-registry.footer && cat data/devstack-plugins-registry.footer
 ) > doc/source/plugin-registry.rst
+
+if [[ -n ${1} ]]; then
+    cp doc/source/plugin-registry.rst ${1}/doc/source/plugin-registry.rst
+fi
diff --git a/unstack.sh b/unstack.sh
index d7670e3..7a7c945 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -182,7 +182,7 @@
 # Clean up the remainder of the screen processes
 SCREEN=$(which screen)
 if [[ -n "$SCREEN" ]]; then
-    SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
+    SESSION=$(screen -ls | awk "/[0-9]+.${SCREEN_NAME}/"'{ print $1 }')
     if [[ -n "$SESSION" ]]; then
         screen -X -S $SESSION quit
     fi