Skip to content

Commit 2ef6933

Browse files
authored
Support remote app deploy (#1355)
* initial checkin for remote app deployment * update deployment strategy for remote app deploy * Fix command line args requirement if -remote is used. * refactor cla vaidation * refactor method name * add validation for remote update domain * Bug fix for model context does not have domain name and home when using -remote * update CLI options * fix bug for calculating hash when remote is specified. * refactor applicaiton_deployer for sonar * add resource for tests * update integration test * update unit test * refactor * doc and comments update * Fix code error * update copyrights * update doc * doc update * pull out doc changes for this PR * refactor based on PR comments * remove obsolete method * remove extra line * remove spaces
1 parent c9878d7 commit 2ef6933

File tree

24 files changed

+721
-274
lines changed

24 files changed

+721
-274
lines changed

core/src/main/python/deploy.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141

4242
__required_arguments = [
4343
CommandLineArgUtil.ORACLE_HOME_SWITCH,
44-
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
4544
CommandLineArgUtil.MODEL_FILE_SWITCH
4645
]
4746

4847
__optional_arguments = [
4948
# Used by shell script to locate WLST
49+
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
5050
CommandLineArgUtil.DOMAIN_TYPE_SWITCH,
5151
CommandLineArgUtil.ARCHIVE_FILE_SWITCH,
5252
CommandLineArgUtil.VARIABLE_FILE_SWITCH,
@@ -61,7 +61,8 @@
6161
CommandLineArgUtil.PASSPHRASE_ENV_SWITCH,
6262
CommandLineArgUtil.OUTPUT_DIR_SWITCH,
6363
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH,
64-
CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH
64+
CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH,
65+
CommandLineArgUtil.REMOTE_SWITCH
6566
]
6667

6768

@@ -72,6 +73,7 @@ def __process_args(args):
7273
:raises CLAException: if an error occurs while validating and processing the command-line arguments
7374
"""
7475
global __wlst_mode
76+
_method_name = '__process_args'
7577

7678
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
7779
cla_util.set_allow_multiple_models(True)
@@ -80,6 +82,7 @@ def __process_args(args):
8082
cla_helper.validate_optional_archive(_program_name, argument_map)
8183
cla_helper.validate_required_model(_program_name, argument_map)
8284
cla_helper.validate_variable_file_exists(_program_name, argument_map)
85+
cla_helper.validate_if_domain_home_required(_program_name, argument_map)
8386

8487
__wlst_mode = cla_helper.process_online_args(argument_map)
8588
cla_helper.process_encryption_args(argument_map)
@@ -124,6 +127,10 @@ def __deploy_online(model, model_context, aliases):
124127
__logger.info("WLSDPLY-09005", admin_url, timeout, method_name=_method_name, class_name=_class_name)
125128

126129
__wlst_helper.connect(admin_user, admin_pwd, admin_url, timeout)
130+
131+
model_context.set_domain_home_name_if_remote(__wlst_helper.get_domain_home_online(),
132+
__wlst_helper.get_domain_name_online())
133+
127134
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(skip_edit_session_check)
128135
__wlst_helper.edit()
129136
__logger.fine("WLSDPLY-09019", edit_lock_acquire_timeout, edit_lock_release_timeout, edit_lock_exclusive)

core/src/main/python/discover.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@
6767

6868
__required_arguments = [
6969
CommandLineArgUtil.ORACLE_HOME_SWITCH,
70-
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
7170
CommandLineArgUtil.MODEL_FILE_SWITCH
7271
]
7372

7473
__optional_arguments = [
7574
# Used by shell script to locate WLST
75+
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
7676
CommandLineArgUtil.ARCHIVE_FILE_SWITCH,
7777
CommandLineArgUtil.SKIP_ARCHIVE_FILE_SWITCH,
7878
CommandLineArgUtil.DOMAIN_TYPE_SWITCH,
@@ -102,6 +102,7 @@ def __process_args(args):
102102
argument_map = cla_util.process_args(args, TOOL_TYPE_DISCOVER)
103103

104104
__wlst_mode = cla_helper.process_online_args(argument_map)
105+
cla_helper.validate_if_domain_home_required(_program_name, argument_map)
105106
target_configuration_helper.process_target_arguments(argument_map)
106107
__process_model_arg(argument_map)
107108
__process_archive_filename_arg(argument_map)
@@ -356,6 +357,10 @@ def __connect_to_domain(model_context, helper):
356357
try:
357358
helper.connect(model_context.get_admin_user(), model_context.get_admin_password(),
358359
model_context.get_admin_url(), model_context.get_model_config().get_connect_timeout())
360+
361+
model_context.set_domain_home_name_if_remote(helper.get_domain_home_online(),
362+
helper.get_domain_name_online())
363+
359364
except PyWLSTException, wlst_ex:
360365
ex = exception_helper.create_discover_exception('WLSDPLY-06001', model_context.get_admin_url(),
361366
model_context.get_admin_user(),

core/src/main/python/update.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
from wlsdeploy.util.exit_code import ExitCode
3232
from wlsdeploy.util.model import Model
3333
from wlsdeploy.util.weblogic_helper import WebLogicHelper
34+
from wlsdeploy.tool.validate.validator import Validator
35+
from oracle.weblogic.deploy.validate import ValidateException
3436

3537

3638
wlst_helper.wlst_functions = globals()
@@ -44,12 +46,12 @@
4446

4547
__required_arguments = [
4648
CommandLineArgUtil.ORACLE_HOME_SWITCH,
47-
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
4849
CommandLineArgUtil.MODEL_FILE_SWITCH
4950
]
5051

5152
__optional_arguments = [
5253
# Used by shell script to locate WLST
54+
CommandLineArgUtil.DOMAIN_HOME_SWITCH,
5355
CommandLineArgUtil.DOMAIN_TYPE_SWITCH,
5456
CommandLineArgUtil.ARCHIVE_FILE_SWITCH,
5557
CommandLineArgUtil.VARIABLE_FILE_SWITCH,
@@ -66,6 +68,7 @@
6668
CommandLineArgUtil.OUTPUT_DIR_SWITCH,
6769
CommandLineArgUtil.UPDATE_RCU_SCHEMA_PASS_SWITCH,
6870
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH,
71+
CommandLineArgUtil.REMOTE_SWITCH,
6972
CommandLineArgUtil.WAIT_FOR_EDIT_LOCK_SWITCH
7073
]
7174

@@ -85,6 +88,7 @@ def __process_args(args):
8588
cla_helper.validate_optional_archive(_program_name, argument_map)
8689
cla_helper.validate_required_model(_program_name, argument_map)
8790
cla_helper.validate_variable_file_exists(_program_name, argument_map)
91+
cla_helper.validate_if_domain_home_required(_program_name, argument_map)
8892

8993
__wlst_mode = cla_helper.process_online_args(argument_map)
9094
cla_helper.process_encryption_args(argument_map)
@@ -130,14 +134,27 @@ def __update_online(model, model_context, aliases):
130134
__logger.info("WLSDPLY-09005", admin_url, timeout, method_name=_method_name, class_name=_class_name)
131135

132136
try:
137+
138+
if model_context.is_remote():
139+
model_validator = Validator(model_context, aliases, logger=__logger, wlst_mode=WlstModes.ONLINE)
140+
model_validator.validate_in_tool_mode(model.get_model(), None,
141+
model_context.get_archive_file_name())
142+
133143
__wlst_helper.connect(admin_user, admin_pwd, admin_url, timeout)
144+
145+
# -remote does not have domain home set, so get it from online wlst after connect
146+
model_context.set_domain_home_name_if_remote(__wlst_helper.get_domain_home_online(),
147+
__wlst_helper.get_domain_name_online())
148+
134149
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(skip_edit_session_check)
135150
__wlst_helper.edit()
136151
__logger.fine("WLSDPLY-09019", edit_lock_acquire_timeout, edit_lock_release_timeout, edit_lock_exclusive)
137152
__wlst_helper.start_edit(acquire_timeout=edit_lock_acquire_timeout, release_timeout=edit_lock_release_timeout,
138153
exclusive=edit_lock_exclusive)
139154
if model_context.is_discard_current_edit():
140155
deployer_utils.discard_current_edit()
156+
except ValidateException, ve:
157+
raise ve
141158
except BundleAwareException, ex:
142159
raise ex
143160

core/src/main/python/validate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
]
4848

4949
__optional_arguments = [
50+
CommandLineArgUtil.REMOTE_SWITCH,
5051
CommandLineArgUtil.DOMAIN_TYPE_SWITCH, # Used by shell script to locate WLST
5152
CommandLineArgUtil.MODEL_FILE_SWITCH,
5253
CommandLineArgUtil.ARCHIVE_FILE_SWITCH,

0 commit comments

Comments
 (0)