Update workspace tempest.conf on changes
When updating variables that would result in a modified
tempest.conf, the /root/.tempest/etc/tempest.conf or
/etc/tempest.conf would get updated properly. A tempest
init happens after and does not copy those into an
existing workspace. This change allows backup workspaces
to be kept on each modification to keep from loosing any
existing workspaces.
Change-Id: Id2de9cbd0f06b73dead5298afb857df2700bab60
Closes-Bug: #1763336
(cherry picked from commit 7654719383
)
This commit is contained in:
parent
7c6c019ff1
commit
f5bc5f6c9f
|
@ -34,6 +34,45 @@
|
|||
mode: "0644"
|
||||
config_overrides: "{{ tempest_tempest_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
register: copy_tempest_config
|
||||
|
||||
- name: Move over workspace when config is updated
|
||||
shell: |
|
||||
set -e
|
||||
|
||||
. {{ tempest_venv_bin }}/activate
|
||||
|
||||
if tempest workspace list | grep ' workspace '; then
|
||||
|
||||
# Get a backup suffix
|
||||
export CURDATE=$(date +"%d%^b%g_%H%M%S%Z")
|
||||
|
||||
# Get the dirname for 'workspace' directly from the tempest workspace list
|
||||
WSPATH=$(dirname $(tempest workspace list | awk '{if($2 == "workspace"){print $4}}'))
|
||||
|
||||
# Rename the workspace
|
||||
tempest workspace rename --old-name workspace --new-name workspace_${CURDATE}
|
||||
|
||||
# A workspace move only changes the config. The move happens manually.
|
||||
if [ -d "${WSPATH}/workspace" ]
|
||||
then
|
||||
mv ${WSPATH}/workspace ${WSPATH}/workspace_${CURDATE}
|
||||
tempest workspace move --name workspace_${CURDATE} --path ${WSPATH}/workspace_${CURDATE}/
|
||||
fi
|
||||
|
||||
exit 3
|
||||
fi
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: tempest_move_workspace
|
||||
changed_when: tempest_move_workspace.rc == 3
|
||||
failed_when:
|
||||
- tempest_move_workspace.rc != 0
|
||||
- tempest_move_workspace.rc != 3
|
||||
when: copy_tempest_config.changed
|
||||
tags:
|
||||
# don't trigger ANSIBLE0016
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Initialise tempest workspace
|
||||
shell: |
|
||||
|
|
Loading…
Reference in New Issue