From e751a7cc07a6bf3ea92b089292b14004ad40519f Mon Sep 17 00:00:00 2001
From: Borne Mace <borne.mace@oracle.com>
Date: Thu, 19 Apr 2018 12:36:31 -0700
Subject: [PATCH] Added support for kolla-cli development

Updated the vagrant dev environment to include support
for development and testing of the kolla-cli

Change-Id: I1d8f66cced7f0a9cc37e3b296c5ae10ab989f736
---
 contrib/dev/vagrant/Vagrantfile            | 9 ++++++---
 contrib/dev/vagrant/bootstrap.sh           | 2 ++
 doc/source/contributor/vagrant-dev-env.rst | 3 ++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/contrib/dev/vagrant/Vagrantfile b/contrib/dev/vagrant/Vagrantfile
index 4859ff120d..5f852acf44 100644
--- a/contrib/dev/vagrant/Vagrantfile
+++ b/contrib/dev/vagrant/Vagrantfile
@@ -15,10 +15,11 @@ end
 
 vagrant_dir = File.expand_path(File.dirname(__FILE__))
 
-# get kolla and kolla-ansibe repos path relative to current directory
+# get kolla, kolla-ansibe and kolla-cli repos path relative to current directory
 # they will be used by the bootstrap script to configure the nodes
 kolla_ansible_repo_path = File.expand_path(File.join(vagrant_dir, '..', '..', '..'))
 kolla_repo_path = File.expand_path(File.join(vagrant_dir, '..', '..', '..', '..', 'kolla'))
+kolla_cli_repo_path = File.expand_path(File.join(vagrant_dir, '..', '..', '..', '..', 'kolla-cli'))
 
 # Vagrantfile.custom contains user customization for the Vagrantfile
 # You shouldn't have to edit the Vagrantfile, ever.
@@ -181,6 +182,7 @@ Vagrant.configure(2) do |config|
   vagrant_shared_folder = "#{user_home}/sync"
   kolla_path = "#{user_home}/kolla"
   kolla_ansible_path = "#{user_home}/kolla-ansible"
+  kolla_cli_path = "#{user_home}/kolla-cli"
 
   # Next to the hostonly NAT-network there is a host-only network with all
   # nodes attached. Plus, each node receives a 3rd adapter connected to the
@@ -230,9 +232,10 @@ Vagrant.configure(2) do |config|
   # The operator controls the deployment
   config.vm.define "operator", primary: true do |admin|
     admin.vm.hostname = "operator.local"
-    admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{kolla_path} #{kolla_ansible_path}"
+    admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path}"
     admin.vm.synced_folder kolla_ansible_repo_path, kolla_ansible_path, create:"True", type: get_default(:sync_method)
     admin.vm.synced_folder kolla_repo_path, kolla_path, create:"True", type: get_default(:sync_method)
+    admin.vm.synced_folder kolla_cli_repo_path, kolla_cli_path, create:"True", type: get_default(:sync_method)
     admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'operator'), "/data/host", create:"True", type: get_default(:sync_method)
     admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
     admin.vm.synced_folder ".", vagrant_shared_folder, disabled: true
@@ -253,7 +256,7 @@ Vagrant.configure(2) do |config|
         hostname = "#{node_type}0#{i}"
         config.vm.define hostname do |node|
           node.vm.hostname = "#{hostname}.local"
-          node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{kolla_path} #{kolla_ansible_path}"
+          node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path}"
           node.vm.synced_folder File.join(vagrant_dir, 'storage', node_type), "/data/host", create:"True", type: get_default(:sync_method)
           node.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
           node.vm.synced_folder ".", vagrant_shared_folder, disabled: true
diff --git a/contrib/dev/vagrant/bootstrap.sh b/contrib/dev/vagrant/bootstrap.sh
index fa9d463b2b..51b8afbf21 100644
--- a/contrib/dev/vagrant/bootstrap.sh
+++ b/contrib/dev/vagrant/bootstrap.sh
@@ -10,6 +10,7 @@ VM=$1
 MODE=$2
 KOLLA_PATH=$3
 KOLLA_ANSIBLE_PATH=$4
+KOLLA_CLI_PATH=$5
 
 export http_proxy=
 export https_proxy=
@@ -175,6 +176,7 @@ function configure_operator {
 
     pip install ${KOLLA_ANSIBLE_PATH}
     pip install ${KOLLA_PATH}
+    pip install ${KOLLA_CLI_PATH}
 
     # Set selinux to permissive
     if [[ "$(getenforce)" == "Enforcing" ]]; then
diff --git a/doc/source/contributor/vagrant-dev-env.rst b/doc/source/contributor/vagrant-dev-env.rst
index 7443414e59..7ec683f614 100644
--- a/doc/source/contributor/vagrant-dev-env.rst
+++ b/doc/source/contributor/vagrant-dev-env.rst
@@ -167,12 +167,13 @@ Find a location in the system's home directory and checkout Kolla repos:
 
 .. code-block:: console
 
+   git clone https://git.openstack.org/openstack/kolla-cli
    git clone https://git.openstack.org/openstack/kolla-ansible
    git clone https://git.openstack.org/openstack/kolla
 
 .. end
 
-Both repos must share the same parent directory so the bootstrap code can
+All repos must share the same parent directory so the bootstrap code can
 locate them.
 
 Developers can now tweak the Vagrantfile or bring up the default **all-in-one**