Skip to content
Snippets Groups Projects
Commit b63a071a authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-394: Remove path recasting magic by just copying the config into the...

L2SS-394: Remove path recasting magic by just copying the config into the container and using it from there
parent 784383c1
No related branches found
No related tags found
No related merge requests found
......@@ -10,23 +10,9 @@ else
help "A file name must be provided."
fi
# Check if the filename begins with /hosthome/, /opt/lofar2.0/tango or
# /opt/lofar2.0/ or if it is in the ${HOME} directory:
if [ ${1:0:10} != /hosthome/ -a ${1:0:20} != /opt/lofar2.0/tango/ -a ${1:0:14} != /opt/lofar2.0/ ]; then
pushd $(dirname ${file}) >/dev/null
full_path=${PWD}
popd >/dev/null
# Check if the file's directory begins with ${HOME}. Then it can be
# accessed via /hosthome. The replacement will then shorten the result.
home_replaced=${full_path#${HOME}}
if [ ${#home_replaced} -ne ${#full_path} ]; then
if [ ! -f ${file} ]; then
help "The file \"${1}\" does not exist."
fi
# copy file into container to read it from container, as the file's location
# in the container won't be the same as on the host.
docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json
# The file can be accessed through /hosthome. Modify the parameter.
file=/hosthome${home_replaced}/$(basename ${file})
fi
fi
docker exec -it dsconfig json2tango --write ${file}
# write settings
docker exec -it dsconfig json2tango --write /tmp/dsconfig-load-settings.json
......@@ -10,28 +10,9 @@ else
help "A file name must be provided."
fi
# Check if the filename begins with /hosthome/, /opt/lofar2.0/tango or
# /opt/lofar2.0/ or if it is in the ${HOME} directory:
if [ ${1:0:10} != /hosthome/ -a ${1:0:20} != /opt/lofar2.0/tango/ -a ${1:0:14} != /opt/lofar2.0/ ]; then
pushd $(dirname ${file}) >/dev/null
full_path=${PWD}
popd >/dev/null
# Check if the file's directory begins with ${HOME}. Then it can be
# accessed via /hosthome. The replacement will then shorten the result.
home_replaced=${full_path#${HOME}}
if [ ${#home_replaced} -ne ${#full_path} ]; then
if [ ! -f ${file} ]; then
help "The file \"${1}\" does not exist."
fi
# copy file into container to read it from container, as the file's location
# in the container won't be the same as on the host.
docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json
# The file can be accessed through /hosthome. Modify the parameter.
file=/hosthome${home_replaced}/$(basename ${file})
else
# The file is in one of the two: /opt/lofar2.0/tango/ /opt/lofar2.0/
# Provide the full path since it is accessible from within the docker
# image because both directories are mounted.
file=${full_path}/$(basename ${file})
fi
fi
docker exec -it dsconfig json2tango --write --update ${file}
# update settings
docker exec -it dsconfig json2tango --write --update /tmp/dsconfig-update-settings.json
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