ixc / ixc-django-docker

Scripts and config files that make it easier to run Django projects consistently with and without Docker.
5 stars 1 forks source link

Report all missing commands rather than just the first one #21

Open aweakley opened 5 years ago

aweakley commented 5 years ago

Cameron has suggested this change, please can you review:

[~/PM/ixc-django-docker(git:entrypoint-multiwarning)]fleet*> diff
diff --git a/ixc_django_docker/bin/entrypoint.sh b/ixc_django_docker/bin/entrypoint.sh
index c4a1386..b77655c 100755
--- a/ixc_django_docker/bin/entrypoint.sh
+++ b/ixc_django_docker/bin/entrypoint.sh
@@ -76,11 +76,13 @@ else
        # packages, and we also verify that required environment variables and
        # programs are available.

+    ok=1
+
        # Fail loudly when required environment variables are missing.
        for var in PROJECT_DIR PROJECT_VENV_DIR; do
                eval [[ -z \${$var+1} ]] && {
                        >&2 echo "ERROR: Missing environment variable: $var"
-                       exit 1
+                       ok=
                }
        done

@@ -88,11 +90,15 @@ else
        for cmd in dockerize md5sum nginx npm psql python pv redis-server supervisord supervisorctl transcrypt yarn; do  # TODO: elasticsearch
                hash $cmd 2>/dev/null || {
                        >&2 echo "ERROR: Missing program: $cmd"
-                       >&2 echo 'See: https://github.com/ixc/ixc-django-docker/blob/master/README.rst#system-requirements-when-running-without-docker'
-                       exit 1
+            ok=
                }
        done

+    [ $ok ] || {
+        >&2 echo 'See: https://github.com/ixc/ixc-django-docker/blob/master/README.rst#system-requirements-when-running-without-docker'
+        exit 1
+    }
+
        # Add virtualenv bin directory to PATH.
        export PATH="$PROJECT_VENV_DIR/bin:$PATH"
 fi
cameron-simpson commented 5 years ago

PR here: https://github.com/ixc/ixc-django-docker/pull/22