blob: e7ff16122f680479f758cac3f8e8b98a0ba227eb [file] [log] [blame]
Ievgeniia Zadorozhna3a6f9e22023-05-12 18:31:28 +03001#!/bin/bash
2
3FLAVOR='cvp.high'
4IMAGE='cvp.ubuntu.2004'
5EXT_NET='public'
6DNS_SERVERS='[]' # example of the custom value: DNS_SERVERS='["192.168.129.5", "192.168.129.254"]'
7APP_DOCKER_IMAGE='mirantis.azurecr.io/openstack/openstack-refapp:0.1.2' # you can replace with some local copy for offline cloud
8
9REFAPP_PATH=/opt/density/openstack-refapp/
10
11# Check the private CVP key, convert to the public one
12cvp_private_key=/opt/cmp-check/cvp_testkey
13if [ -e ${cvp_private_key} ]; then
14 ssh-keygen -y -f ${cvp_private_key} > ${REFAPP_PATH}/cvp_testkey.pub
15else
16 echo "The key file at ${cvp_private_key} does not exist. Please run \"cd /opt/cmp-check && bash /opt/cmp-check/prepare.sh -w $(pwd) && cd ${REFAPP_PATH}\" to create a key and other test resources."
17 exit 1
18fi
19
20TOP_FILE=${REFAPP_PATH}/heat-templates/top.yaml
21
22# Replace the default public key with the CVP one
23cvp_key=$(cat ${REFAPP_PATH}/cvp_testkey.pub)
24escaped_cvp_key=$(echo "$cvp_key" | sed -e 's/[\/&]/\\&/g')
25sed -i "/^ *cluster_public_key:/,/default:/ s/default:.*/default: '$escaped_cvp_key'/" $TOP_FILE
26
27# Replace the flavor
28sed -i "/^ *database_flavor:/,/default:/ s/default:.*/default: '$FLAVOR'/" $TOP_FILE
29
30# Replace the image
31sed -i "/^ *database_image:/,/default:/ s/default:.*/default: '$IMAGE'/" $TOP_FILE
32
33# Replace the external net
34sed -i "/^ *public_network_id:/,/default:/ s/default:.*/default: '$EXT_NET'/" $TOP_FILE
35
36# Replace the DNS servers list
37sed -i "/^ *dns_nameservers:/,/default:/ s/default:.*/default: $DNS_SERVERS/" $TOP_FILE
38
39# Replace the docker image for RefApp application if the cloud has no Internet access
40ESC_APP_DOCKER_IMAGE=$(sed 's/[\/&]/\\&/g' <<< "$APP_DOCKER_IMAGE")
41sed -i "/^\s*app_docker_image:/,/default:/ s/default:.*/default: '$ESC_APP_DOCKER_IMAGE'/" $TOP_FILE