Added validation to docker script verbs

Added a noop verb that does nothing, also added a global-catch that
issues a warning if unknown verb was supplied.

Change-Id: I98ca93457f58d7d9f63188d3642788e5618df62d
This commit is contained in:
Shachar Snapiri 2018-12-10 12:21:47 +02:00
parent ca688e4290
commit 04cdcb41c9
2 changed files with 20 additions and 0 deletions

View File

@ -109,3 +109,17 @@ This will start the container with the Dragonflow installed, but no service.
This is useful in order to test any standalone binaries or code that should This is useful in order to test any standalone binaries or code that should
use the Dragonflow as a library, separated from the controller node. use the Dragonflow as a library, separated from the controller node.
Using the container as a base for other container
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The docker entrypoint script accepts verbs. To only run the configuration and
use the container with another main process, in your entrypoint run the
following command:
.. code-block:: bash
/opt/dragonflow/tools/run_dragonflow.sh --dragonflow_ip <DRAGONFLOW_IP> --db_ip <DB_IP>:2379 noop
Note that running a container with the noop verb without a live process as
entrypoint will cause the container to exit immediately.

View File

@ -86,4 +86,10 @@ case "$VERB" in
pip install bottle pip install bottle
/usr/local/bin/df-rest-service --config /etc/dragonflow/dragonflow.ini --host 0.0.0.0 --json /var/dragonflow_model.json /usr/local/bin/df-rest-service --config /etc/dragonflow/dragonflow.ini --host 0.0.0.0 --json /var/dragonflow_model.json
;; ;;
"noop")
echo "Dragonflow script end"
;;
*)
echo>&2 "Warning: Unknown option supplied to Dragonflow: $VERB"
;;
esac esac