Skip to content
Snippets Groups Projects
Commit 9183617e authored by MJB's avatar MJB
Browse files

fixing fixtures so that it is consitent with openstack deployment

parent a1ca634c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
repo_root="/vagrant" repo_root="/vagrant"
target_root="/opt/clmc"
config_file="rspec.json" config_file="rspec.json"
usage() { usage() {
...@@ -31,7 +32,7 @@ create() { ...@@ -31,7 +32,7 @@ create() {
# copy flame clmc files into the root container # copy flame clmc files into the root container
echo "Copying files to rootfs" echo "Copying files to rootfs"
container_dir="/var/lib/lxd/containers/"${service_name}"/rootfs" container_dir="/var/lib/lxd/containers/"${service_name}"/rootfs"
container_repo_root=${container_dir}"/opt/clmc" container_repo_root=${container_dir}${target_root}
mkdir -p ${container_repo_root} mkdir -p ${container_repo_root}
cp -f ${repo_root}/reporc ${container_repo_root} cp -f ${repo_root}/reporc ${container_repo_root}
cp -rf ${repo_root}/scripts ${container_repo_root} cp -rf ${repo_root}/scripts ${container_repo_root}
...@@ -50,9 +51,9 @@ create() { ...@@ -50,9 +51,9 @@ create() {
# provision software into each container # provision software into each container
echo "Provisioning: ${service_name}" echo "Provisioning: ${service_name}"
if [ ${service_name} == "clmc-service" ]; then if [ ${service_name} == "clmc-service" ]; then
cmd="/opt/clmc/scripts/clmc-service/install.sh" cmd="${target_root}/clmc/scripts/clmc-service/install.sh"
echo "Provisioning command ${cmd}" echo "Provisioning command ${cmd}"
lxc exec ${service_name} --env REPO_ROOT="/opt/clmc" --env SFEMC_FQDN="sfemc.localhost" -- ${cmd} lxc exec ${service_name} --env REPO_ROOT=${target_root} --env SFEMC_FQDN="sfemc.localhost" -- ${cmd}
exit_code=$? exit_code=$?
if [ $exit_code != 0 ]; then if [ $exit_code != 0 ]; then
echo "clmc-service installation failed with exit code ${exit_code}" echo "clmc-service installation failed with exit code ${exit_code}"
...@@ -60,7 +61,7 @@ create() { ...@@ -60,7 +61,7 @@ create() {
fi fi
elif [ ${service_name} == "test-runner" ] elif [ ${service_name} == "test-runner" ]
then then
cmd=/vagrant/src/test/clmctest/services/pytest/install.sh cmd="${target_root}/src/test/clmctest/services/pytest/install.sh"
lxc exec ${service_name} -- ${cmd} lxc exec ${service_name} -- ${cmd}
exit_code=$? exit_code=$?
if [ $exit_code != 0 ]; then if [ $exit_code != 0 ]; then
...@@ -78,16 +79,16 @@ create() { ...@@ -78,16 +79,16 @@ create() {
influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url') influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url')
# install service function specific software # install service function specific software
cmd=/vagrant/src/test/clmctest/services/${sf_package_id}/install.sh cmd="${target_root}/src/test/clmctest/services/${sf_package_id}/install.sh"
lxc exec ${service_name} --env REPO_ROOT="/vagrant" -- ${cmd} lxc exec ${service_name} --env REPO_ROOT="${target_root}" -- ${cmd}
exit_code=$? exit_code=$?
if [ $exit_code != 0 ]; then if [ $exit_code != 0 ]; then
echo "${sf_package_id} installation failed with exit code ${exit_code}" echo "${sf_package_id} installation failed with exit code ${exit_code}"
exit 1 exit 1
fi fi
# install telegraf # install telegraf
cmd=/vagrant/scripts/clmc-agent/install.sh cmd="${target_root}/scripts/clmc-agent/install.sh"
lxc exec ${service_name} --env REPO_ROOT="/vagrant" -- /vagrant/scripts/clmc-agent/install.sh lxc exec ${service_name} --env REPO_ROOT="${target_root}" -- ${cmd}
# check that telegraf installed (it may not have if the reporc file was not present or Nexus server was down) # check that telegraf installed (it may not have if the reporc file was not present or Nexus server was down)
if lxc-attach -n ${service_name} -- ls /etc/telegraf |& grep 'ls: cannot access'; then if lxc-attach -n ${service_name} -- ls /etc/telegraf |& grep 'ls: cannot access'; then
...@@ -108,7 +109,7 @@ create() { ...@@ -108,7 +109,7 @@ create() {
chown -R 100000:100000 ${container_dir}/etc/telegraf/ chown -R 100000:100000 ${container_dir}/etc/telegraf/
# replace telegraf template with container parameters # replace telegraf template with container parameters
cmd="/vagrant/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_instance_id} ${sf_package_id} ${sf_id} ${sf_endpoint_id} ${influxdb_url}" cmd="${target_root}/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_instance_id} ${sf_package_id} ${sf_id} ${sf_endpoint_id} ${influxdb_url}"
lxc exec ${service_name} -- ${cmd} lxc exec ${service_name} -- ${cmd}
# start telegraf # start telegraf
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment