Make ./stack.sh optional

Create a new VAGRANT_KURYR_RUN_DEVSTACK environment variable to make the
`stack.sh` call optional.

Some people may want to edit the `local.conf` file before run `stack.sh`
manually in the VM. Useful for the devstack/plugin.sh development, for
instance.

It is defaulted to `true` for backwards compatibility.

Change-Id: Ia3fe8cb4416a75a3ec05cbb9ce698313daa555e4
This commit is contained in:
Jaume Devesa 2015-12-15 17:11:54 +01:00
parent 1bbfb6afb6
commit 07687f4401
4 changed files with 18 additions and 7 deletions

View File

@ -45,3 +45,6 @@ the definition of the Virtual Machine spawned:
* **VAGRANT\_KURYR\_VM\_MEMORY**: To modify the RAM of the VM. Defaulted to: 4096 * **VAGRANT\_KURYR\_VM\_MEMORY**: To modify the RAM of the VM. Defaulted to: 4096
* **VAGRANT\_KURYR\_VM\_CPU**: To modify the cpus of the VM. Defaulted to: 2 * **VAGRANT\_KURYR\_VM\_CPU**: To modify the cpus of the VM. Defaulted to: 2
* **VAGRANT\_KURYR\_RUN\_DEVSTACK**: Whether `vagrant up` should run devstack to
have an environment ready to use. Set it to 'false' if you want to edit
`local.conf` before run ./stack.sh manually in the VM. Defaulted to: true

View File

@ -4,6 +4,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
VM_MEMORY = ENV.fetch('VAGRANT_KURYR_VM_MEMORY', 4096) VM_MEMORY = ENV.fetch('VAGRANT_KURYR_VM_MEMORY', 4096)
VM_CPUS = ENV.fetch('VAGRANT_KURYR_VM_CPUS', 2) VM_CPUS = ENV.fetch('VAGRANT_KURYR_VM_CPUS', 2)
RUN_DEVSTACK = ENV.fetch('VAGRANT_KURYR_RUN_DEVSTACK', 'true')
config.vm.hostname = 'devstack' config.vm.hostname = 'devstack'
@ -33,7 +34,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# For CentOS machines it needs to be specified # For CentOS machines it needs to be specified
config.vm.synced_folder '.', '/vagrant' config.vm.synced_folder '.', '/vagrant'
config.vm.provision :shell, :path => 'vagrant.sh' config.vm.provision :shell do |s|
s.path = 'vagrant.sh'
s.args = RUN_DEVSTACK
end
if Vagrant.has_plugin?('vagrant-cachier') if Vagrant.has_plugin?('vagrant-cachier')
config.cache.scope = :box config.cache.scope = :box

View File

@ -3,6 +3,7 @@
set -e set -e
BASHPATH=$(dirname "$0"\") BASHPATH=$(dirname "$0"\")
RUN_DEVSTACK="$1"
echo "Run script from $BASHPATH" echo "Run script from $BASHPATH"
# Copied shamelessly from Devstack # Copied shamelessly from Devstack
@ -47,6 +48,9 @@ then
fi fi
# start devstack if $RUN_DEVSTACK; then
echo "Start Devstack" echo "Start Devstack"
su "$OS_USER" -c "cd $DEVSTACK && ./stack.sh" su "$OS_USER" -c "cd $DEVSTACK && ./stack.sh"
else
echo "Virtual Machine ready. You can run devstack by executing '/home/vagrant/devstack/stack.sh'"
fi

View File

@ -4,7 +4,7 @@ export OS_USER=vagrant
export OS_HOST_IP=172.68.5.10 export OS_HOST_IP=172.68.5.10
# run script # run script
bash /vagrant/devstack.sh bash /vagrant/devstack.sh "$1"
#set environment variables for kuryr #set environment variables for kuryr
su "$OS_USER" -c "echo 'source /vagrant/config/kuryr_rc' >> ~/.bashrc" su "$OS_USER" -c "echo 'source /vagrant/config/kuryr_rc' >> ~/.bashrc"