Fixing tempest containerized script

Run tempest containerized creates a script, that requires the
public_net_id set inside the script, before it was being set in the
cleanup-network script, which doesn't export properly the variable,
causing error.
Also, since docker run as root, the  tempest_container.sh creates the
tempest files as root, so we need to use sudo to cleanup the
directories.

Change-Id: Ie5723df5e791dbe9572b7d3e5b7b71506563d11c
This commit is contained in:
Arx Cruz 2018-04-18 11:07:05 +02:00
parent 812c8461ce
commit 57f652a0f4
2 changed files with 15 additions and 8 deletions

View File

@ -24,8 +24,6 @@ neutron net-create {{ public_net_name }} --router:external=True \
--provider:physical_network {{ public_physical_network }}
{% endif %}
public_net_id=$(neutron net-show {{ public_net_name }} -f value -c id)
neutron subnet-create --name ext-subnet \
--allocation-pool \
start={{ public_net_pool_start }},end={{ public_net_pool_end }} \
@ -59,9 +57,6 @@ openstack network create {{ public_net_name }} --external \
--provider-physical-network {{ public_physical_network }}
{% endif %}
public_net_id=$(openstack network show {{ public_net_name }} -f value -c id)
openstack subnet create ext-subnet \
--allocation-pool \
start={{ public_net_pool_start }},end={{ public_net_pool_end }} \

View File

@ -10,9 +10,11 @@
# as well as .workspace directory to store workspace information
# We need to delete .workspace directory otherwise tempest init failed
# to create tempest directory.
rm -rf {{ working_dir }}/.tempest
rm -rf {{ tempest_dir }}
rm -rf {{ working_dir }}/python-tempestconf
# We are doing this as sudo because tempest in containers create the files as
# root.
sudo rm -rf {{ working_dir }}/.tempest
sudo rm -rf {{ tempest_dir }}
sudo rm -rf {{ working_dir }}/python-tempestconf
# Source rc file
source {{ rc_file }}
@ -86,6 +88,16 @@ export TEMPESTCONF="{{ tempestconf }}"
# Source rc file for tempestconf generation
source {{ rc_file }}
{% if tempest_overcloud|bool %}
# Get public net id
{% if release == 'newton' %}
public_net_id=$(neutron net-show {{ public_net_name }} -f value -c id)
{% else %}
public_net_id=$(openstack network show {{ public_net_name }} -f value -c id)
{% endif %}
{% endif %}
{% if not tempest_overcloud|bool %}
export OS_AUTH_URL="$OS_AUTH_URL/v$OS_IDENTITY_API_VERSION"
{% endif %}