populating /etc/hosts fails on DockerHub images because the file exists, but it is empty. So this condition triggers
elif [ -f /etc/hosts ]; then
# In FreeBSD, sed doesn't interpret \n. We put a real newline.
eval "${SED_I} -e \"1s/^/${entry}\"$'\\\\\n/' /etc/hosts"
and nothing happens. Now it is -s which will check both that the file exists and is not empty. When empty, next condition (else) will be checked and the entry will be forcibly written.
Some linting as well
Closes OpenNebula/one#6174
No doc PR required since it is a context problem. When the release is made it will be added to the context changelog
populating
/etc/hosts
fails on DockerHub images because the file exists, but it is empty. So this condition triggersand nothing happens. Now it is
-s
which will check both that the file exists and is not empty. When empty, next condition (else) will be checked and the entry will be forcibly written.Some linting as well
Closes OpenNebula/one#6174
No doc PR required since it is a context problem. When the release is made it will be added to the context changelog