diff --git a/src/config/config_service.py b/src/config/config_service.py index 975bdb10..f0c6f379 100644 --- a/src/config/config_service.py +++ b/src/config/config_service.py @@ -2,7 +2,7 @@ import logging import os -from model import script_configs +from model import script_config from utils import os_utils, file_utils LOGGER = logging.getLogger('config_service') @@ -21,7 +21,7 @@ def list_configs(self, user): def load_script(path, content): try: json_object = json.loads(content) - short_config = script_configs.read_short(path, json_object) + short_config = script_config.read_short(path, json_object) if short_config is None: return None @@ -39,7 +39,7 @@ def create_config_model(self, name, user, parameter_values=None): def find_and_load(path, content): try: json_object = json.loads(content) - short_config = script_configs.read_short(path, json_object) + short_config = script_config.read_short(path, json_object) if short_config is None: return None @@ -95,7 +95,7 @@ def _load_script_config(self, path, content_or_json_dict, user, parameter_values json_object = json.loads(content_or_json_dict) else: json_object = content_or_json_dict - config = script_configs.ConfigModel( + config = script_config.ConfigModel( json_object, path, user.get_username(), diff --git a/src/execution/execution_service.py b/src/execution/execution_service.py index a098d223..0c03c9dc 100644 --- a/src/execution/execution_service.py +++ b/src/execution/execution_service.py @@ -4,7 +4,7 @@ from typing import Optional, Dict, Callable, Any from execution.executor import ScriptExecutor -from model import script_configs +from model import script_config from utils import audit_utils LOGGER = logging.getLogger('script_server.execution_service') @@ -98,7 +98,7 @@ def get_running_executions(self): return result - def get_config(self, execution_id) -> Optional[script_configs.ConfigModel]: + def get_config(self, execution_id) -> Optional[script_config.ConfigModel]: return self._get_for_execution_info(execution_id, lambda i: i.config) diff --git a/src/model/script_configs.py b/src/model/script_config.py similarity index 100% rename from src/model/script_configs.py rename to src/model/script_config.py diff --git a/src/tests/execution_service_test.py b/src/tests/execution_service_test.py index 86b9fe70..16e69441 100644 --- a/src/tests/execution_service_test.py +++ b/src/tests/execution_service_test.py @@ -3,7 +3,7 @@ from execution import executor from execution.execution_service import ExecutionService -from model.script_configs import ConfigModel +from model.script_config import ConfigModel from tests import test_utils from tests.test_utils import mock_object, create_audit_names, _MockProcessWrapper diff --git a/src/tests/model_helper_test.py b/src/tests/model_helper_test.py index 5bc07df6..c650b9fd 100644 --- a/src/tests/model_helper_test.py +++ b/src/tests/model_helper_test.py @@ -2,7 +2,7 @@ import unittest from config.constants import PARAM_TYPE_MULTISELECT, FILE_TYPE_FILE, FILE_TYPE_DIR -from model import script_configs, model_helper +from model import script_config, model_helper from model.model_helper import read_list, read_dict, normalize_incoming_values, fill_parameter_values, resolve_env_vars, \ InvalidFileException from tests import test_utils @@ -13,71 +13,71 @@ class TestDefaultValue(unittest.TestCase): env_key = 'test_val' def test_no_value(self): - default = script_configs._resolve_default(None, None, None) + default = script_config._resolve_default(None, None, None) self.assertEqual(default, None) def test_empty_value(self): - default = script_configs._resolve_default('', None, None) + default = script_config._resolve_default('', None, None) self.assertEqual(default, '') def test_text_value(self): - default = script_configs._resolve_default('text', None, None) + default = script_config._resolve_default('text', None, None) self.assertEqual(default, 'text') def test_unicode_value(self): - default = script_configs._resolve_default(u'text', None, None) + default = script_config._resolve_default(u'text', None, None) self.assertEqual(default, u'text') def test_int_value(self): - default = script_configs._resolve_default(5, None, None) + default = script_config._resolve_default(5, None, None) self.assertEqual(default, 5) def test_bool_value(self): - default = script_configs._resolve_default(True, None, None) + default = script_config._resolve_default(True, None, None) self.assertEqual(default, True) def test_env_variable(self): os.environ[self.env_key] = 'text' - default = script_configs._resolve_default('$$test_val', None, None) + default = script_config._resolve_default('$$test_val', None, None) self.assertEqual(default, 'text') def test_missing_env_variable(self): - self.assertRaises(Exception, script_configs._resolve_default, '$$test_val', None, None) + self.assertRaises(Exception, script_config._resolve_default, '$$test_val', None, None) def test_auth_username(self): - default = script_configs._resolve_default('${auth.username}', 'buggy', None) + default = script_config._resolve_default('${auth.username}', 'buggy', None) self.assertEqual('buggy', default) def test_auth_username_when_none(self): - default = script_configs._resolve_default('${auth.username}', None, None) + default = script_config._resolve_default('${auth.username}', None, None) self.assertEqual('', default) def test_auth_username_when_inside_text(self): - default = script_configs._resolve_default('__${auth.username}__', 'usx', None) + default = script_config._resolve_default('__${auth.username}__', 'usx', None) self.assertEqual('__usx__', default) def test_auth_audit_name(self): - default = script_configs._resolve_default('${auth.audit_name}', None, '127.0.0.1') + default = script_config._resolve_default('${auth.audit_name}', None, '127.0.0.1') self.assertEqual('127.0.0.1', default) def test_auth_audit_name_when_none(self): - default = script_configs._resolve_default('${auth.audit_name}', None, None) + default = script_config._resolve_default('${auth.audit_name}', None, None) self.assertEqual('', default) def test_auth_audit_name_when_inside_text(self): - default = script_configs._resolve_default('__${auth.audit_name}__', None, 'usx') + default = script_config._resolve_default('__${auth.audit_name}__', None, 'usx') self.assertEqual('__usx__', default) def test_auth_username_and_audit_name(self): - default = script_configs._resolve_default('${auth.username}:${auth.audit_name}', 'buggy', 'localhost') + default = script_config._resolve_default('${auth.username}:${auth.audit_name}', 'buggy', 'localhost') self.assertEqual('buggy:localhost', default) def tearDown(self): diff --git a/src/tests/parameter_server_file_test.py b/src/tests/parameter_server_file_test.py index 87be05ca..be7f7616 100644 --- a/src/tests/parameter_server_file_test.py +++ b/src/tests/parameter_server_file_test.py @@ -3,7 +3,7 @@ import unittest from config.constants import PARAM_TYPE_SERVER_FILE, FILE_TYPE_FILE, FILE_TYPE_DIR -from model.script_configs import WrongParameterUsageException, InvalidValueException +from model.script_config import WrongParameterUsageException, InvalidValueException from tests import test_utils from tests.test_utils import create_script_param_config, create_files diff --git a/src/tests/script_config_test.py b/src/tests/script_config_test.py index 170dcc91..3ac6d54d 100644 --- a/src/tests/script_config_test.py +++ b/src/tests/script_config_test.py @@ -3,7 +3,7 @@ import config.constants from config.constants import PARAM_TYPE_SERVER_FILE, PARAM_TYPE_MULTISELECT -from model.script_configs import ConfigModel, InvalidValueException, _TemplateProperty, ParameterNotFoundException +from model.script_config import ConfigModel, InvalidValueException, _TemplateProperty, ParameterNotFoundException from react.properties import ObservableDict, ObservableList from tests import test_utils from tests.test_utils import create_script_param_config, create_parameter_model, create_parameter_model_from_config, \ diff --git a/src/tests/test_utils.py b/src/tests/test_utils.py index 5f597b45..d7e9e026 100644 --- a/src/tests/test_utils.py +++ b/src/tests/test_utils.py @@ -8,7 +8,7 @@ import utils.file_utils as file_utils import utils.os_utils as os_utils from execution.process_base import ProcessWrapper -from model.script_configs import ConfigModel, ParameterModel +from model.script_config import ConfigModel, ParameterModel from react.properties import ObservableDict from utils import audit_utils diff --git a/src/web/server.py b/src/web/server.py index 1816f081..c01cc4e2 100755 --- a/src/web/server.py +++ b/src/web/server.py @@ -30,7 +30,7 @@ from model import model_helper from model.external_model import to_short_execution_log, to_long_execution_log, parameter_to_external from model.model_helper import is_empty -from model.script_configs import InvalidValueException, ParameterNotFoundException, WrongParameterUsageException +from model.script_config import InvalidValueException, ParameterNotFoundException, WrongParameterUsageException from model.server_conf import ServerConfig from utils import file_utils as file_utils from utils import tornado_utils, audit_utils