From 557e116e40fe79878963ef41a4436ae786a440c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Andr=C3=A9?= <m.andre@redhat.com>
Date: Thu, 17 Sep 2015 15:01:25 +0900
Subject: [PATCH] Set namespace to point to local registry

`kolla-build --push` will push to local registry.

Partially-Implements: blueprint vagrant-improvements
Change-Id: Id841ad9845db6270b6051f7e0a1f93bccbf686fe
---
 vagrant/bootstrap.sh | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh
index ca3e75939a..ef76b25ee0 100644
--- a/vagrant/bootstrap.sh
+++ b/vagrant/bootstrap.sh
@@ -81,6 +81,7 @@ EOF
 
 function configure_kolla {
     # Use local docker registry
+    sed -i -r "s,^[# ]*namespace.+$,namespace = \"${REGISTRY}/lokolla\"," /etc/kolla/kolla-build.conf
     sed -i -r "s,^[# ]*docker_registry:.+$,docker_registry: \"${REGISTRY}\"," /etc/kolla/globals.yml
     sed -i -r "s,^[# ]*docker_namespace:.+$,docker_namespace: \"lokolla\"," /etc/kolla/globals.yml
     sed -i -r "s,^[# ]*docker_insecure_registry:.+$,docker_insecure_registry: \"True\"," /etc/kolla/globals.yml
@@ -124,18 +125,8 @@ export OS_PASSWORD=password
 export OS_TENANT_NAME=admin
 export OS_VOLUME_API_VERSION=2
 EOF
+    chown vagrant: ~vagrant/openrc
 
-    # Quick&dirty helper script to push images to the local registry's lokolla
-    # namespace.
-    cat > ~vagrant/tag-and-push.sh <<EOF
-for image in \$(docker images|awk '/^kollaglue/ {print \$1}'); do
-    docker tag \$image ${REGISTRY}/lokolla/\${image#kollaglue/}:latest
-    docker push ${REGISTRY}/lokolla/\${image#kollaglue/}:latest
-done
-EOF
-    chmod +x ~vagrant/tag-and-push.sh
-
-    chown vagrant: ~vagrant/openrc ~vagrant/tag-and-push.sh
 
     # Launch a local registry (and mirror) to speed up pulling images.
     # 0.9.1 is actually the _latest_ tag.