From 3aa1e063166b9bfcaa1acd1550f1438cc5d1ca0f Mon Sep 17 00:00:00 2001
From: Carlos Natalino <carlos.natalino@chalmers.se>
Date: Mon, 15 Nov 2021 15:00:17 +0000
Subject: [PATCH] Fixing how the client modules are included into the image.'

---
 src/webui/Config.py                | 8 ++++----
 src/webui/Dockerfile               | 7 ++++++-
 src/webui/service/device/routes.py | 6 +++---
 src/webui/tests/test_unitary.py    | 2 --
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/webui/Config.py b/src/webui/Config.py
index 5ff3e1648..152a4d7c4 100644
--- a/src/webui/Config.py
+++ b/src/webui/Config.py
@@ -15,10 +15,10 @@ HOST = '0.0.0.0'  # accepts connections coming from any ADDRESS
 
 DEBUG=False
 
-CONTEXT_SERVICE_ADDRESS = '10.107.242.226'
-# CONTEXT_SERVICE_ADDRESS = 'context'  # TODO: use the correct context ADDRESS
+# CONTEXT_SERVICE_ADDRESS = '10.107.242.226'
+CONTEXT_SERVICE_ADDRESS = 'context'  # TODO: use the correct context ADDRESS
 CONTEXT_SERVICE_PORT = 1010
 
-DEVICE_SERVICE_ADDRESS = '10.109.49.149'
-# DEVICE_SERVICE_ADDRESS = 'device'  # TODO: use the correct address
+# DEVICE_SERVICE_ADDRESS = '10.109.49.149'
+DEVICE_SERVICE_ADDRESS = 'device'  # TODO: use the correct address
 DEVICE_SERVICE_PORT = 2020
diff --git a/src/webui/Dockerfile b/src/webui/Dockerfile
index de5d393c3..b65889025 100644
--- a/src/webui/Dockerfile
+++ b/src/webui/Dockerfile
@@ -29,7 +29,12 @@ RUN python3 -m pip install -r webui/requirements.txt
 
 # Add files into working directory
 COPY common/. common
-COPY context/. context
+COPY context/__init__.py context/__init__.py
+COPY context/proto/. context/proto
+COPY context/client/. context/client
+COPY device/__init__.py device/__init__.py
+COPY device/proto/. device/proto
+COPY device/client/. device/client
 COPY webui/. webui
 
 # Start webui service
diff --git a/src/webui/service/device/routes.py b/src/webui/service/device/routes.py
index 080035f91..30ca43a3a 100644
--- a/src/webui/service/device/routes.py
+++ b/src/webui/service/device/routes.py
@@ -1,11 +1,11 @@
 from flask import render_template, Blueprint, flash, session, redirect
-from context.proto.context_pb2 import ConfigActionEnum, ConfigRule, TopologyIdList, TopologyList
 from device.client.DeviceClient import DeviceClient
+from context.client.ContextClient import ContextClient
 from webui.Config import (CONTEXT_SERVICE_ADDRESS, CONTEXT_SERVICE_PORT,
                 DEVICE_SERVICE_ADDRESS, DEVICE_SERVICE_PORT)
-from context.client.ContextClient import ContextClient
 from webui.proto.context_pb2 import (ContextId, DeviceList, DeviceId,
-    Device, DeviceDriverEnum, DeviceOperationalStatusEnum)
+    Device, DeviceDriverEnum, DeviceOperationalStatusEnum,
+    ConfigActionEnum, ConfigRule, TopologyIdList, TopologyList)
 from webui.service.device.forms import AddDeviceForm
 
 device = Blueprint('device', __name__, url_prefix='/device')
diff --git a/src/webui/tests/test_unitary.py b/src/webui/tests/test_unitary.py
index 833f30439..0c0b82a6b 100644
--- a/src/webui/tests/test_unitary.py
+++ b/src/webui/tests/test_unitary.py
@@ -95,6 +95,4 @@ def test_device_add_action(client):
         'device_endpoints': [],
     }
     rw = client.post('/device/add', data=DEVICE_EMU, follow_redirects=True)
-    with open('device_add.html', 'wb') as file:
-        file.write(rw.data)
     assert b'success' in rw.data
-- 
GitLab