Unexpected update in setup script for functional test
There are some placeholder files for running functional test in zuul. The contents of the files, such as `auth_url` of the following files, are updated while running devstack `stack.sh`. * tacker/tests/etc/samples/local-vim.yaml * tools/test-setup-default-vim.sh These Git management files including the above, should not be modified. Therefore, I will be fix as follow. The need files to be change for Zuul are deploy by Ansible, so the deploy process is run with Ansible instead of the `devstack/lib/tacker` script. Allow `tools/test-setup-default-vim.sh` script to be executed by itself, so the git management files aren't updated by running devstack `stack.sh`. Also, as other improvements, replace the file path included in Ansible role to definition value. Change-Id: Iad88c7adfe56e926ee0324d94787577ba066989b Closes-Bug: #1879303
This commit is contained in:
parent
fe165673dd
commit
fa373795ba
@ -436,26 +436,11 @@ function tacker_register_default_vim {
|
|||||||
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $VIM_CONFIG_FILE
|
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $VIM_CONFIG_FILE
|
||||||
echo "The content of VIM config file $VIM_CONFIG_FILE :"
|
echo "The content of VIM config file $VIM_CONFIG_FILE :"
|
||||||
cat $VIM_CONFIG_FILE
|
cat $VIM_CONFIG_FILE
|
||||||
DEFAULT_VIM_NAME="VIM0"
|
|
||||||
|
|
||||||
# TODO(tpatil): Remove installing python-tackerclient using pip once
|
# TODO(tpatil): Remove installing python-tackerclient using pip once
|
||||||
# a solution is available to install it using requirements.
|
# a solution is available to install it using requirements.
|
||||||
pip_install python-tackerclient
|
pip_install python-tackerclient
|
||||||
|
|
||||||
cat >> $TACKER_DIR/tools/test-setup-default-vim.sh <<EOF
|
|
||||||
|
|
||||||
openstack --os-username nfv_user --os-project-name nfv --os-password devstack --os-auth-url ${KEYSTONE_SERVICE_URI} --os-project-domain-name Default --os-user-domain-name Default vim register --is-default --description "Default VIM" --config-file $VIM_CONFIG_FILE $DEFAULT_VIM_NAME
|
|
||||||
|
|
||||||
EOF
|
|
||||||
echo "The content of $TACKER_DIR/tools/test-setup-default-vim.sh"
|
|
||||||
cat $TACKER_DIR/tools/test-setup-default-vim.sh
|
|
||||||
|
|
||||||
echo "Update tacker/tests/etc/samples/local-vim.yaml for functional testing"
|
|
||||||
functional_vim_file="$TACKER_DIR/tacker/tests/etc/samples/local-vim.yaml"
|
|
||||||
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $functional_vim_file
|
|
||||||
echo "The content of functional VIM config file $functional_vim_file :"
|
|
||||||
cat $functional_vim_file
|
|
||||||
|
|
||||||
echo "Set up target openstack vim resources ..."
|
echo "Set up target openstack vim resources ..."
|
||||||
openstack --os-cloud=devstack-admin quota set \
|
openstack --os-cloud=devstack-admin quota set \
|
||||||
--class --instances -1 --cores -1 --ram -1 default
|
--class --instances -1 --cores -1 --ram -1 default
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
- name: Copy files test setup default vim sh
|
- name: Copy files test setup default vim sh
|
||||||
copy:
|
copy:
|
||||||
remote_src=True
|
remote_src=True
|
||||||
src=/opt/stack/tacker/tools/test-setup-default-vim.sh
|
src={{ devstack_base_dir }}/tacker/tools/test-setup-default-vim.sh
|
||||||
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
|
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
|
||||||
|
mode=0755
|
||||||
|
when: inventory_hostname == "controller"
|
||||||
|
|
||||||
- name: Copy test vim file
|
- name: Copy test vim file
|
||||||
copy:
|
copy:
|
||||||
remote_src=True
|
remote_src=True
|
||||||
src=/opt/stack/tacker/tacker/tests/etc/samples/local-vim.yaml
|
src={{ devstack_base_dir }}/tacker/tacker/tests/etc/samples/local-vim.yaml
|
||||||
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
|
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
|
||||||
|
when: inventory_hostname == "controller"
|
||||||
|
|
||||||
- name: Check if project's tools/test-setup-default-vim.sh exists
|
- name: Check if project's tools/test-setup-default-vim.sh exists
|
||||||
stat:
|
stat:
|
||||||
@ -20,10 +23,46 @@
|
|||||||
or it doesn't have execute permission.
|
or it doesn't have execute permission.
|
||||||
when: p.stat.exists != True or p.stat.executable != True
|
when: p.stat.exists != True or p.stat.executable != True
|
||||||
|
|
||||||
|
- name: Get stackenv from devstack environment
|
||||||
|
slurp:
|
||||||
|
src: "{{ devstack_base_dir }}/devstack/.stackenv"
|
||||||
|
register: stackenv
|
||||||
|
|
||||||
|
- name: Set a keystone authentication uri
|
||||||
|
set_fact:
|
||||||
|
auth_uri: "{{
|
||||||
|
stackenv.content
|
||||||
|
| b64decode
|
||||||
|
| regex_replace('\n', ' ')
|
||||||
|
| regex_replace('^.*KEYSTONE_SERVICE_URI=([^ ]+).*$', '\\1')
|
||||||
|
}}"
|
||||||
|
when:
|
||||||
|
- p.stat.exists
|
||||||
|
|
||||||
|
- name: Replace the keystone authentication uri in the test-setup-default-vim.sh and local-vim.yaml
|
||||||
|
replace:
|
||||||
|
path: "{{ item }}"
|
||||||
|
regexp: "http://127.0.0.1/identity"
|
||||||
|
replace: "{{ auth_uri }}"
|
||||||
|
with_items:
|
||||||
|
- "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
|
||||||
|
- "{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
|
||||||
|
when:
|
||||||
|
- inventory_hostname == 'controller'
|
||||||
|
- p.stat.exists
|
||||||
|
|
||||||
|
- name: Replace the config file path in the test-setup-default-vim.sh
|
||||||
|
replace:
|
||||||
|
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
|
||||||
|
regexp: '(?<=config-file )([^ ]+)(?= )'
|
||||||
|
replace: "{{ ansible_env.HOME }}/{{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml"
|
||||||
|
when: inventory_hostname == 'controller'
|
||||||
|
|
||||||
- name: Run tools/test-setup-default-vim.sh
|
- name: Run tools/test-setup-default-vim.sh
|
||||||
command: tools/test-setup-default-vim.sh
|
command: tools/test-setup-default-vim.sh
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
when:
|
when:
|
||||||
|
- inventory_hostname == 'controller'
|
||||||
- p.stat.exists
|
- p.stat.exists
|
||||||
- p.stat.executable
|
- p.stat.executable
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
- name: Print net information
|
- name: Print net information
|
||||||
shell: sudo bash -c "ip address > /opt/stack/ipaddress.txt"
|
shell: sudo bash -c "ip address > {{ devstack_base_dir }}//ipaddress.txt"
|
||||||
|
|
||||||
- name: Collect net information
|
- name: Collect net information
|
||||||
fetch:
|
fetch:
|
||||||
flat: yes
|
flat: yes
|
||||||
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ipaddress.txt"
|
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ipaddress.txt"
|
||||||
src: "/opt/stack/ipaddress.txt"
|
src: "{{ devstack_base_dir }}//ipaddress.txt"
|
||||||
|
|
||||||
- name: print ovs information
|
- name: print ovs information
|
||||||
shell: sudo bash -c "ovs-vsctl show > /opt/stack/ovsvsctl.txt"
|
shell: sudo bash -c "ovs-vsctl show > {{ devstack_base_dir }}//ovsvsctl.txt"
|
||||||
|
|
||||||
- name: Collect ovs information
|
- name: Collect ovs information
|
||||||
fetch:
|
fetch:
|
||||||
flat: yes
|
flat: yes
|
||||||
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ovsvsctl.txt"
|
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/ovsvsctl.txt"
|
||||||
src: "/opt/stack/ovsvsctl.txt"
|
src: "{{ devstack_base_dir }}//ovsvsctl.txt"
|
||||||
|
@ -4,3 +4,25 @@
|
|||||||
# for functional testing, which cannot be put
|
# for functional testing, which cannot be put
|
||||||
# in devstack/plugin.sh because new zuul3 CI
|
# in devstack/plugin.sh because new zuul3 CI
|
||||||
# cannot keep the devstack plugins order
|
# cannot keep the devstack plugins order
|
||||||
|
#
|
||||||
|
# Also, this script updates the following
|
||||||
|
# parameter which has been modified
|
||||||
|
# unintentionally by ansible playbook
|
||||||
|
# `roles/setup-default-vim/tasks/main.yaml`
|
||||||
|
# according to the execution environment of
|
||||||
|
# Zuul.
|
||||||
|
#
|
||||||
|
# --os-auth-url
|
||||||
|
# --config-file
|
||||||
|
|
||||||
|
openstack vim register \
|
||||||
|
--os-username nfv_user \
|
||||||
|
--os-project-name nfv \
|
||||||
|
--os-password devstack \
|
||||||
|
--os-auth-url http://127.0.0.1/identity \
|
||||||
|
--os-project-domain-name Default \
|
||||||
|
--os-user-domain-name Default \
|
||||||
|
--is-default \
|
||||||
|
--description "Default VIM" \
|
||||||
|
--config-file /opt/stack/tacker/tacker/tests/etc/samples/local-vim.yaml \
|
||||||
|
VIM0
|
||||||
|
Loading…
Reference in New Issue
Block a user