Skip to content

Commit cf8e70d

Browse files
authored
Use Jython directly for encryptModel (#550)
* JIRA-WDT-387 Convert encryptModel to use Jython directly; use shared windows script * JIRA-WDT-387 Use shared method to verify required arguments * JIRA-WDT-387 Refine shared functions for Windows; use shared functions for validateModel * JIRA-WDT-387 Create shared Unix script, refactor validateModel to use this * JIRA-WDT-387 Combined variable setup methods, clean up comments * JIRA-WDT-387 Remove extra variable assignment * JIRA-WDT-387 Revised usage comment * JIRA-WDT-387 Revised usage comments * JIRA-WDT-387 Refactor encryptModel to use shared functions * JIRA-WDT-387 Corrected WLSDEPLOY_PROPERTIES variable name, removed "used directly" comments * JIRA-WDT-387 Corrected WLSDEPLOY_PROPERTIES description
1 parent 2726150 commit cf8e70d

File tree

7 files changed

+546
-1094
lines changed

7 files changed

+546
-1094
lines changed

core/src/main/python/encrypt.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@
2828
from wlsdeploy.logging.platform_logger import PlatformLogger
2929
from wlsdeploy.tool.encrypt import encryption_utils
3030
from wlsdeploy.tool.util.alias_helper import AliasHelper
31+
from wlsdeploy.util import cla_helper
3132
from wlsdeploy.util import getcreds
3233
from wlsdeploy.util import variables as variable_helper
33-
from wlsdeploy.tool.util import wlst_helper
34-
from wlsdeploy.tool.util.wlst_helper import WlstHelper
3534
from wlsdeploy.util.cla_utils import CommandLineArgUtil
3635
from wlsdeploy.util.model_context import ModelContext
3736
from wlsdeploy.util.model_translator import FileToPython
3837
from wlsdeploy.util.model_translator import PythonToFile
3938

40-
wlst_helper.wlst_functions = globals()
41-
4239
_program_name = 'encryptModel'
4340
_class_name = 'encrypt'
4441
__logger = PlatformLogger('wlsdeploy.encrypt')
@@ -68,7 +65,7 @@ def __process_args(args):
6865
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
6966
required_arg_map, optional_arg_map = cla_util.process_args(args)
7067

71-
__verify_required_args_present(required_arg_map)
68+
cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
7269
__validate_mode_args(optional_arg_map)
7370
__process_passphrase_arg(optional_arg_map)
7471

@@ -91,23 +88,6 @@ def __process_args(args):
9188
return model_context
9289

9390

94-
def __verify_required_args_present(required_arg_map):
95-
"""
96-
Verify that the required args are present.
97-
:param required_arg_map: the required arguments map
98-
:raises CLAException: if one or more of the required arguments are missing
99-
"""
100-
_method_name = '__verify_required_args_present'
101-
102-
for req_arg in __required_arguments:
103-
if req_arg not in required_arg_map:
104-
ex = exception_helper.create_cla_exception('WLSDPLY-20005', _program_name, req_arg)
105-
ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
106-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
107-
raise ex
108-
return
109-
110-
11191
def __validate_mode_args(optional_arg_map):
11292
"""
11393
Verify that either the model_file or the manual switch was specified.
@@ -281,7 +261,6 @@ def main(args):
281261
for index, arg in enumerate(args):
282262
__logger.finer('sys.argv[{0}] = {1}', str(index), str(arg), class_name=_class_name, method_name=_method_name)
283263

284-
WlstHelper(ExceptionType.ENCRYPTION).silence()
285264
exit_code = _process_request(args)
286265
__logger.exiting(class_name=_class_name, method_name=_method_name, result=exit_code)
287266
sys.exit(exit_code)

0 commit comments

Comments
 (0)