Closed TheDukeDK closed 8 years ago
Good point. Currently, there are lots of assumptions and not always helpful error messages when these are not met.
A first option could be to just check for dependencies and error out if they are not present.
Agreed, that would be a good first step. Error out the missing dependency, with maybe a link to help them along :-)
The dependency handling should, of course, know supported version. As an example my docker version is too old :-P
Finding out if docker, compose and machine is installed is easy. Like this for docker :
DOCKER_PATH=$(which docker)
if [ ! -z "$DOCKER_PATH" ]; then
echo "Docker is installed"
fi
Docker and docker-compose has a function that prints its version in a pretty format. like : docker version --format '{{.Client.Version}}'
and : docker-compose version --short
But docker-machine does not. So its not pretty. The closest it could get, is this : docker-machine version | cut -d"," -f1|cut -d" " -f3
Then we need a function that can compare these with supported versions. Any ideas?
I thing we should create a function file called sanity.f or something in $STACI_HOME/functions/, and then start small and build on that with more and more tests. These versions check is important, so they make a good starting point.
I have pushed some code for testing.
@praqmaTim could you test this?
cd staci
cd functions
source tools.f
source system.f
check_docker_dependencies
If it works, then i will add it to the install function.
I get :
- Running dependency checks, please wait...
- Docker version : 1.11.1 - OK
- Docker-compose version : 1.6.0 - OK
- Docker-machine version : 0.6.0 - OK
Fixed by #47
Running ./staci.sh install we assume that docker is setup properly on the host. Don't we? Or have I misunderstood?