Check cirros symlink before creation

Currently, run_tests.sh does:
ln -s ~/cache/files/cirros-0.4.0-x86_64-disk.img $IMG_DIR

inconditionally. This patch checks if the file exists and is a symlink
before doing the ln -s.

This helps running ./all-in-one.sh twice if the first attempt failed, for
some reasons, which isn't hypothetical, it happens often that it fails
because of networking problems (bad WIFI) on my laptop.

Change-Id: I3faed512a1eeccef15f4965d6deb2151eab9d36d
This commit is contained in:
Thomas Goirand 2018-05-15 22:51:04 +02:00
parent 4bbea36c6f
commit fb4836d749
1 changed files with 3 additions and 1 deletions

View File

@ -146,7 +146,9 @@ fi
if [ -f ~/cache/files/cirros-0.4.0-x86_64-disk.img ]; then
# Create a symlink for tempest.
ln -s ~/cache/files/cirros-0.4.0-x86_64-disk.img $IMG_DIR
if ! [ -h /tmp/openstack/image/cirros-0.4.0-x86_64-disk.img ] ; then
ln -s ~/cache/files/cirros-0.4.0-x86_64-disk.img $IMG_DIR
fi
else
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img -P $IMG_DIR
fi