Merge "Use $() instead of ``"
diff --git a/.gitignore b/.gitignore
index b0a65f5..67ab722 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,8 @@
 .tox
 .stackenv
 accrc
-docs/files
-docs/html
+doc/files
+doc/build
 files/*.gz
 files/*.qcow2
 files/images
diff --git a/docs/source/assets/css/bootstrap.css b/doc/source/assets/css/bootstrap.css
similarity index 100%
rename from docs/source/assets/css/bootstrap.css
rename to doc/source/assets/css/bootstrap.css
diff --git a/docs/source/assets/css/local.css b/doc/source/assets/css/local.css
similarity index 100%
rename from docs/source/assets/css/local.css
rename to doc/source/assets/css/local.css
diff --git a/docs/source/assets/images/devstack.png b/doc/source/assets/images/devstack.png
similarity index 100%
rename from docs/source/assets/images/devstack.png
rename to doc/source/assets/images/devstack.png
Binary files differ
diff --git a/docs/source/assets/images/header_bg.png b/doc/source/assets/images/header_bg.png
similarity index 100%
rename from docs/source/assets/images/header_bg.png
rename to doc/source/assets/images/header_bg.png
Binary files differ
diff --git a/docs/source/assets/images/logo.png b/doc/source/assets/images/logo.png
similarity index 100%
rename from docs/source/assets/images/logo.png
rename to doc/source/assets/images/logo.png
Binary files differ
diff --git a/docs/source/assets/images/quickstart.png b/doc/source/assets/images/quickstart.png
similarity index 100%
rename from docs/source/assets/images/quickstart.png
rename to doc/source/assets/images/quickstart.png
Binary files differ
diff --git a/docs/source/assets/images/small_logo.png b/doc/source/assets/images/small_logo.png
similarity index 100%
rename from docs/source/assets/images/small_logo.png
rename to doc/source/assets/images/small_logo.png
Binary files differ
diff --git a/docs/source/assets/js/bootstrap.js b/doc/source/assets/js/bootstrap.js
similarity index 100%
rename from docs/source/assets/js/bootstrap.js
rename to doc/source/assets/js/bootstrap.js
diff --git a/docs/source/assets/js/bootstrap.min.js b/doc/source/assets/js/bootstrap.min.js
similarity index 100%
rename from docs/source/assets/js/bootstrap.min.js
rename to doc/source/assets/js/bootstrap.min.js
diff --git a/docs/source/assets/js/jquery-1.7.1.min.js b/doc/source/assets/js/jquery-1.7.1.min.js
similarity index 100%
rename from docs/source/assets/js/jquery-1.7.1.min.js
rename to doc/source/assets/js/jquery-1.7.1.min.js
diff --git a/docs/source/changes.html b/doc/source/changes.html
similarity index 100%
rename from docs/source/changes.html
rename to doc/source/changes.html
diff --git a/docs/source/configuration.html b/doc/source/configuration.html
similarity index 100%
rename from docs/source/configuration.html
rename to doc/source/configuration.html
diff --git a/docs/source/contributing.html b/doc/source/contributing.html
similarity index 100%
rename from docs/source/contributing.html
rename to doc/source/contributing.html
diff --git a/docs/source/eucarc.html b/doc/source/eucarc.html
similarity index 100%
rename from docs/source/eucarc.html
rename to doc/source/eucarc.html
diff --git a/docs/source/exerciserc.html b/doc/source/exerciserc.html
similarity index 100%
rename from docs/source/exerciserc.html
rename to doc/source/exerciserc.html
diff --git a/docs/source/faq.html b/doc/source/faq.html
similarity index 100%
rename from docs/source/faq.html
rename to doc/source/faq.html
diff --git a/docs/source/guides/multinode-lab.html b/doc/source/guides/multinode-lab.html
similarity index 100%
rename from docs/source/guides/multinode-lab.html
rename to doc/source/guides/multinode-lab.html
diff --git a/docs/source/guides/pxe-boot.html b/doc/source/guides/pxe-boot.html
similarity index 100%
rename from docs/source/guides/pxe-boot.html
rename to doc/source/guides/pxe-boot.html
diff --git a/docs/source/guides/ramdisk.html b/doc/source/guides/ramdisk.html
similarity index 100%
rename from docs/source/guides/ramdisk.html
rename to doc/source/guides/ramdisk.html
diff --git a/docs/source/guides/single-machine.html b/doc/source/guides/single-machine.html
similarity index 100%
rename from docs/source/guides/single-machine.html
rename to doc/source/guides/single-machine.html
diff --git a/docs/source/guides/single-vm.html b/doc/source/guides/single-vm.html
similarity index 100%
rename from docs/source/guides/single-vm.html
rename to doc/source/guides/single-vm.html
diff --git a/docs/source/guides/usb-boot.html b/doc/source/guides/usb-boot.html
similarity index 100%
rename from docs/source/guides/usb-boot.html
rename to doc/source/guides/usb-boot.html
diff --git a/docs/source/index.html b/doc/source/index.html
similarity index 100%
rename from docs/source/index.html
rename to doc/source/index.html
diff --git a/docs/source/local.conf.html b/doc/source/local.conf.html
similarity index 100%
rename from docs/source/local.conf.html
rename to doc/source/local.conf.html
diff --git a/docs/source/localrc.html b/doc/source/localrc.html
similarity index 100%
rename from docs/source/localrc.html
rename to doc/source/localrc.html
diff --git a/docs/source/openrc.html b/doc/source/openrc.html
similarity index 100%
rename from docs/source/openrc.html
rename to doc/source/openrc.html
diff --git a/docs/source/overview.html b/doc/source/overview.html
similarity index 100%
rename from docs/source/overview.html
rename to doc/source/overview.html
diff --git a/docs/source/plugins.html b/doc/source/plugins.html
similarity index 100%
rename from docs/source/plugins.html
rename to doc/source/plugins.html
diff --git a/docs/source/stackrc.html b/doc/source/stackrc.html
similarity index 100%
rename from docs/source/stackrc.html
rename to doc/source/stackrc.html
diff --git a/functions-common b/functions-common
index 1f90da7..333f31d 100644
--- a/functions-common
+++ b/functions-common
@@ -549,8 +549,7 @@
 # ``get_release_name_from_branch branch-name``
 function get_release_name_from_branch {
     local branch=$1
-
-    if [[ $branch =~ "stable/" ]]; then
+    if [[ $branch =~ "stable/" || $branch =~ "proposed/" ]]; then
         echo ${branch#*/}
     else
         echo "master"
diff --git a/lib/ceilometer b/lib/ceilometer
index 26c698c..db0c457 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -73,13 +73,12 @@
 }
 
 # create_ceilometer_accounts() - Set up common required ceilometer accounts
-
+#
 # Project              User         Roles
 # ------------------------------------------------------------------
 # SERVICE_TENANT_NAME  ceilometer   admin
 # SERVICE_TENANT_NAME  ceilometer   ResellerAdmin (if Swift is enabled)
-
-create_ceilometer_accounts() {
+function create_ceilometer_accounts {
 
     local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
     local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
diff --git a/lib/config b/lib/config
index 6e8219c..a4d59a3 100644
--- a/lib/config
+++ b/lib/config
@@ -112,7 +112,7 @@
             sub(/[ \t]*$/, "", value)
 
             # cfg_attr_count: number of config lines per [section, attr]
-            # cfg_attr: two dimensional array to keep all the config lines per [section, attr]
+            # cfg_attr: three dimensional array to keep all the config lines per [section, attr]
             # cfg_section: keep the section names in the same order as they appear in local.conf
             # cfg_sec_attr_name: keep the attr names in the same order as they appear in local.conf
             if (! (section, attr) in cfg_attr_count) {
@@ -121,13 +121,13 @@
                     last_section = section
                 }
                 attr_count = cfg_sec_attr_count[section_count - 1]++
-                cfg_sec_attr_name[section_count - 1][attr_count] = attr
+                cfg_sec_attr_name[section_count - 1, attr_count] = attr
 
-                cfg_attr[section, attr][0] = value
+                cfg_attr[section, attr, 0] = value
                 cfg_attr_count[section, attr] = 1
             } else {
                 lno = cfg_attr_count[section, attr]++
-                cfg_attr[section, attr][lno] = value
+                cfg_attr[section, attr, lno] = value
             }
         }
         END {
@@ -138,15 +138,15 @@
                 # after the section header. To keep the same order as defined
                 # in local.conf, invoke the ini routines in the reverse order
                 for (attr_no = cfg_sec_attr_count[sno] - 1; attr_no >=0; attr_no--) {
-                    attr = cfg_sec_attr_name[sno][attr_no]
+                    attr = cfg_sec_attr_name[sno, attr_no]
                     if (cfg_attr_count[section, attr] == 1)
-                        print "iniset " configfile " " section " " attr " \x27" cfg_attr[section, attr][0] "\x27"
+                        print "iniset " configfile " " section " " attr " \x27" cfg_attr[section, attr, 0] "\x27"
                     else {
                         # For multiline, invoke the ini routines in the reverse order
                         count = cfg_attr_count[section, attr]
-                        print "iniset " configfile " " section " " attr " \x27" cfg_attr[section, attr][count - 1] "\x27"
+                        print "iniset " configfile " " section " " attr " \x27" cfg_attr[section, attr, count - 1] "\x27"
                         for (l = count -2; l >= 0; l--)
-                            print "iniadd_literal " configfile " " section " " attr " \x27" cfg_attr[section, attr][l] "\x27"
+                            print "iniadd_literal " configfile " " section " " attr " \x27" cfg_attr[section, attr, l] "\x27"
                     }
                 }
             }
diff --git a/lib/nova b/lib/nova
index 122f17e..f47dc97 100644
--- a/lib/nova
+++ b/lib/nova
@@ -330,14 +330,12 @@
 }
 
 # create_nova_accounts() - Set up common required nova accounts
-
+#
 # Project              User         Roles
 # ------------------------------------------------------------------
 # SERVICE_TENANT_NAME  nova         admin
 # SERVICE_TENANT_NAME  nova         ResellerAdmin (if Swift is enabled)
-
-# Migrated from keystone_data.sh
-create_nova_accounts() {
+function create_nova_accounts {
 
     local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
     local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
diff --git a/tests/test_config.sh b/tests/test_config.sh
index 696e57f..cd74cee 100755
--- a/tests/test_config.sh
+++ b/tests/test_config.sh
@@ -103,7 +103,11 @@
 [[test6|test-strip.conf]]
 [DEFAULT]
 # next line has trailing space
-attr = strip_trailing_space 
+attr = strip_trailing_space
+
+[[test7|test-colon.conf]]
+[DEFAULT]
+servers=10.11.12.13:80
 
 [[test-multi-sections|test-multi-sections.conf]]
 [sec-1]
@@ -319,6 +323,15 @@
 attr = strip_trailing_space"
 check_result "$VAL" "$EXPECT_VAL"
 
-rm -f test.conf test1c.conf test2a.conf test-quote.conf test-space.conf test-equals.conf test-strip.conf
+echo -n "merge_config_file test7 colon in value: "
+rm -f test-colon.conf
+merge_config_file test.conf test7 test-colon.conf
+VAL=$(cat test-colon.conf)
+EXPECT_VAL="
+[DEFAULT]
+servers = 10.11.12.13:80"
+check_result "$VAL" "$EXPECT_VAL"
+
+rm -f test.conf test1c.conf test2a.conf test-quote.conf test-space.conf test-equals.conf test-strip.conf test-colon.conf
 rm -f test-multiline.conf test-multi-sections.conf
 rm -rf test-etc
diff --git a/tools/build_docs.sh b/tools/build_docs.sh
index 96bd892..f52b179 100755
--- a/tools/build_docs.sh
+++ b/tools/build_docs.sh
@@ -4,7 +4,7 @@
 #
 # - Install shocco if not found on PATH and INSTALL_SHOCCO is set
 # - Clone MASTER_REPO branch MASTER_BRANCH
-# - Re-creates ``docs/html`` directory from existing repo + new generated script docs
+# - Re-creates ``doc/build/html`` directory from existing repo + new generated script docs
 
 # Usage:
 ## build_docs.sh [-o <out-dir>] [-g] [master|<repo> [<branch>]]
@@ -29,8 +29,8 @@
 # http://devstack.org is a GitHub gh-pages site in the https://github.com/cloudbuilders/devtack.git repo
 GH_PAGES_REPO=git@github.com:cloudbuilders/devstack.git
 
-DOCS_SOURCE=docs/source
-HTML_BUILD=docs/html
+DOCS_SOURCE=doc/source
+HTML_BUILD=doc/build/html
 
 # Keep track of the devstack directory
 TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
@@ -136,7 +136,7 @@
     mkdir -p $FQ_HTML_BUILD/`dirname $f`;
     $SHOCCO $f > $FQ_HTML_BUILD/$f.html
 done
-echo "$FILES" >docs/files
+echo "$FILES" >doc/files
 
 if [[ -n $GH_UPDATE ]]; then
     GH_ROOT=$(mktemp -d work-gh-XXXX)
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 75d56a8..439db68 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -244,6 +244,11 @@
     vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
 fi
 
+if [ -n "${EXIT_AFTER_JEOS_INSTALLATION:-}" ]; then
+    echo "User requested to quit after JEOS instalation"
+    exit 0
+fi
+
 #
 # Prepare VM for DevStack
 #
diff --git a/tools/xen/prepare_guest.sh b/tools/xen/prepare_guest.sh
index cd189db..7383c91 100755
--- a/tools/xen/prepare_guest.sh
+++ b/tools/xen/prepare_guest.sh
@@ -114,7 +114,6 @@
     if [ ! -e $1 ]; then
         # Simple but usable vimrc
         cat > $1 <<EOF
-syntax on
 se ts=4
 se expandtab
 se shiftwidth=4
diff --git a/tools/xen/prepare_guest_template.sh b/tools/xen/prepare_guest_template.sh
index e6a7e02..2d3b898 100755
--- a/tools/xen/prepare_guest_template.sh
+++ b/tools/xen/prepare_guest_template.sh
@@ -93,3 +93,28 @@
 # Need to set barrier=0 to avoid a Xen bug
 # https://bugs.launchpad.net/ubuntu/+source/linux/+bug/824089
 sed -i -e 's/errors=/barrier=0,errors=/' $STAGING_DIR/etc/fstab
+
+# Update ubuntu repositories
+cat > $STAGING_DIR/etc/apt/sources.list << EOF
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} main restricted
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} main restricted
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates main restricted
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates main restricted
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} universe
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} universe
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates universe
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates universe
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} multiverse
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} multiverse
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates multiverse
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates multiverse
+deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-backports main restricted universe multiverse
+deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-backports main restricted universe multiverse
+
+deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security main restricted
+deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security main restricted
+deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security universe
+deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security universe
+deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security multiverse
+deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security multiverse
+EOF
diff --git a/tox.ini b/tox.ini
index 325adae..3677631 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,4 +13,11 @@
 commands = bash -c "find {toxinidir} -not -wholename \*.tox/\* -and \( -name \*.sh -or -name \*rc -or -name functions\* -or \( -wholename lib/\* -and -not -name \*.md \) \) -print0 | xargs -0 bashate -v"
 
 [testenv:docs]
-commands = python setup.py build_sphinx
+deps =
+   Pygments
+   docutils
+whitelist_externals = bash
+setenv =
+  TOP_DIR={toxinidir}
+  INSTALL_SHOCCO=true
+commands = bash tools/build_docs.sh