From: schillinge Date: Thu, 14 Mar 2019 21:46:14 +0000 (+0100) Subject: Also support the usual CMD field in images X-Git-Tag: v6.0.0~21 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F7323%2F4;p=osm%2Fvim-emu.git Also support the usual CMD field in images For backwards-compatibility the SON_EMU_CMD/VIM_EMU_CMD commands still surpress this, but otherwise the usual ENTRYPOINT + CMD logic should be working with this + commit 83b52502743eb29e5e0b8e33e6aa119a5005c676 in containernet. Since the caching of the build server prevents a automatic Containernet update to latest master, an explicit commit hash is given. This will allow explicit updates when required while still supporting caching. Comment wording above checkout is from Manuel Peuster. Change-Id: Ic01f87acb5f9e79d09baae499f3d353c2c0aca9e Signed-off-by: schillinge --- diff --git a/Dockerfile b/Dockerfile index cccecdf..b77c268 100755 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,9 @@ RUN apt-get update \ sudo # install containernet (using its Ansible playbook) -RUN git clone https://github.com/containernet/containernet.git +# Attention: Containernet installation fixed to specific commit. Change to update to latest Containernet version. +RUN git clone https://github.com/containernet/containernet.git && \ + (cd containernet && git checkout bc269d6f1cf9f50f71fda65c25fe1f2f4c1573b7) WORKDIR /containernet/ansible RUN ansible-playbook -i "localhost," -c local --skip-tags "notindocker" install.yml diff --git a/src/emuvim/api/openstack/compute.py b/src/emuvim/api/openstack/compute.py index 873daa4..9d77a44 100755 --- a/src/emuvim/api/openstack/compute.py +++ b/src/emuvim/api/openstack/compute.py @@ -493,6 +493,7 @@ class OpenstackCompute(object): # Start the real emulator command now as specified in the dockerfile config = c.dcinfo.get("Config", dict()) env = config.get("Env", list()) + legacy_command_execution = False for env_var in env: var, cmd = map(str.strip, map(str, env_var.split('=', 1))) if var == "SON_EMU_CMD" or var == "VIM_EMU_CMD": @@ -503,7 +504,10 @@ class OpenstackCompute(object): t = threading.Thread(target=c.cmdPrint, args=(cmd,)) t.daemon = True t.start() + legacy_command_execution = True break # only execute one command + if not legacy_command_execution: + c.start() def stop_compute(self, server): """ diff --git a/src/emuvim/api/rest/compute.py b/src/emuvim/api/rest/compute.py index aec010e..7a12c68 100755 --- a/src/emuvim/api/rest/compute.py +++ b/src/emuvim/api/rest/compute.py @@ -79,6 +79,7 @@ class Compute(Resource): try: config = c.dcinfo.get("Config", dict()) env = config.get("Env", list()) + legacy_command_execution = False for env_var in env: var, cmd = map(str.strip, map(str, env_var.split('=', 1))) logging.debug("%r = %r" % (var, cmd)) @@ -90,6 +91,10 @@ class Compute(Resource): t = threading.Thread(target=c.cmdPrint, args=(cmd,)) t.daemon = True t.start() + legacy_command_execution = True + break + if not legacy_command_execution: + c.start() except Exception as ex: logging.warning("Couldn't run Docker entry point VIM_EMU_CMD") logging.exception("Exception:")