Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/src/main/python/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,19 @@ def __deploy_online(model, model_context, aliases):
admin_user = model_context.get_admin_user()
admin_pwd = model_context.get_admin_password()
timeout = model_context.get_model_config().get_connect_timeout()
skip_edit_session_check = model_context.is_discard_current_edit() or model_context.is_wait_for_edit_lock()
edit_lock_acquire_timeout = model_context.get_model_config.get_wlst_edit_lock_acquire_timeout()
edit_lock_release_timeout = model_context.get_model_config.get_wlst_edit_lock_release_timeout()
edit_lock_exclusive = model_context.get_model_config().get_wlst_edit_lock_exclusive()

__logger.info("WLSDPLY-09005", admin_url, timeout, method_name=_method_name, class_name=_class_name)

__wlst_helper.connect(admin_user, admin_pwd, admin_url, timeout)
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(model_context.is_discard_current_edit())
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(skip_edit_session_check)
__wlst_helper.edit()
__wlst_helper.start_edit()
__logger.fine("WLSDPLY-09019", edit_lock_acquire_timeout, edit_lock_release_timeout, edit_lock_exclusive)
__wlst_helper.start_edit(acquire_timeout=edit_lock_acquire_timeout, release_timeout=edit_lock_release_timeout,
exclusive=edit_lock_exclusive)
if model_context.is_discard_current_edit():
deployer_utils.discard_current_edit()

Expand Down
15 changes: 11 additions & 4 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

The entry point for the updateDomain tool.
Expand Down Expand Up @@ -67,7 +67,8 @@
CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH,
CommandLineArgUtil.OUTPUT_DIR_SWITCH,
CommandLineArgUtil.UPDATE_RCU_SCHEMA_PASS_SWITCH,
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH,
CommandLineArgUtil.WAIT_FOR_EDIT_LOCK_SWITCH
]


Expand Down Expand Up @@ -123,14 +124,20 @@ def __update_online(model, model_context, aliases):
admin_user = model_context.get_admin_user()
admin_pwd = model_context.get_admin_password()
timeout = model_context.get_model_config().get_connect_timeout()
skip_edit_session_check = model_context.is_discard_current_edit() or model_context.is_wait_for_edit_lock()
edit_lock_acquire_timeout = model_context.get_model_config().get_wlst_edit_lock_acquire_timeout()
edit_lock_release_timeout = model_context.get_model_config().get_wlst_edit_lock_release_timeout()
edit_lock_exclusive = model_context.get_model_config().get_wlst_edit_lock_exclusive()

__logger.info("WLSDPLY-09005", admin_url, timeout, method_name=_method_name, class_name=_class_name)

try:
__wlst_helper.connect(admin_user, admin_pwd, admin_url, timeout)
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(model_context.is_discard_current_edit())
deployer_utils.ensure_no_uncommitted_changes_or_edit_sessions(skip_edit_session_check)
__wlst_helper.edit()
__wlst_helper.start_edit()
__logger.fine("WLSDPLY-09019", edit_lock_acquire_timeout, edit_lock_release_timeout, edit_lock_exclusive)
__wlst_helper.start_edit(acquire_timeout=edit_lock_acquire_timeout, release_timeout=edit_lock_release_timeout,
exclusive=edit_lock_exclusive)
if model_context.is_discard_current_edit():
deployer_utils.discard_current_edit()
except BundleAwareException, ex:
Expand Down
11 changes: 8 additions & 3 deletions core/src/main/python/wlsdeploy/tool/util/wlst_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,16 +839,21 @@ def edit(self):
raise pwe
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name)

def start_edit(self):
def start_edit(self, acquire_timeout=0, release_timeout=-1, exclusive='false'):
"""
Start an edit session with the WebLogic Server for the currently connected user.
:param acquire_timeout: Time (in milliseconds) that WLST waits until it gets a lock, in the event that another user has a lock.
:param release_timeout: Timeout (in milliseconds) that WLST waits to release the edit lock (-1 means edit session never expires).
:param exclusive: Whether to request an exclusive lock or not
:raises: Exception for the specified tool type: if a WLST error occurs
"""
"""
"""
_method_name = 'start_edit'
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
self.__logger.entering(acquire_timeout, release_timeout, exclusive, class_name=self.__class_name, method_name=_method_name)

try:
self.__load_global('startEdit')()
self.__load_global('startEdit')(waitTimeInMillis=acquire_timeout, timeOutInMillis=release_timeout, exclusive=exclusive)
except self.__load_global('WLSTException'), e:
pwe = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-00050',
_format_exception(e), error=e)
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/python/wlsdeploy/util/cla_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class CommandLineArgUtil(object):
# extractDomainResource output file
DOMAIN_RESOURCE_FILE_SWITCH = '-domain_resource_file'
OUTPUT_DIR_SWITCH = "-output_dir"

WAIT_FOR_EDIT_LOCK_SWITCH = "-wait_for_edit_lock"
TARGET_SWITCH = '-target'


Expand All @@ -112,7 +112,8 @@ class CommandLineArgUtil(object):
RUN_RCU_SWITCH,
UPDATE_RCU_SCHEMA_PASS_SWITCH,
DISCARD_CURRENT_EDIT_SWITCH,
USE_ENCRYPTION_SWITCH
USE_ENCRYPTION_SWITCH,
WAIT_FOR_EDIT_LOCK_SWITCH
]

# a slot to stash the parsed domain typedef dictionary
Expand Down
35 changes: 33 additions & 2 deletions core/src/main/python/wlsdeploy/util/model_config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Copyright (c) 2020, Oracle Corporation and/or its affiliates.
Copyright (c) 2020, 2022, Oracle Corporation and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""

from java.io import IOException
from java.lang import Long
from java.lang import NumberFormatException
from java.lang import System

from wlsdeploy.exception import exception_helper
from wlsdeploy.logging.platform_logger import PlatformLogger
from wlsdeploy.util import path_utils
from wlsdeploy.util import string_utils
Expand Down Expand Up @@ -36,6 +36,15 @@
STOP_APP_TIMEOUT_DEFAULT = '180000'
SET_SERVER_GRPS_TIMEOUT_PROP = 'set.server.groups.timeout'
SET_SERVER_GRPS_TIMEOUT_DEFAULT = '30000'
WLST_EDIT_LOCK_ACQUIRE_TIMEOUT_PROP = 'wlst.edit.lock.acquire.timeout'
WLST_EDIT_LOCK_ACQUIRE_TIMEOUT_DEFAULT = '0'
WLST_EDIT_LOCK_RELEASE_TIMEOUT_PROP = 'wlst.edit.lock.release.timeout'
WLST_EDIT_LOCK_RELEASE_TIMEOUT_DEFAULT = '-1'
WLST_EDIT_LOCK_EXCLUSIVE_PROP = 'wlst.edit.lock.exclusive'
WLST_EDIT_LOCK_EXCLUSIVE_DEFAULT = 'false'

# System Property overrides for WLST timeout properties
SYS_PROP_PREFIX = 'wdt.config.'


class ModelConfiguration(object):
Expand Down Expand Up @@ -107,12 +116,34 @@ def get_set_server_grps_timeout(self):
"""
return self._get_from_dict_as_long(SET_SERVER_GRPS_TIMEOUT_PROP, SET_SERVER_GRPS_TIMEOUT_DEFAULT)

def get_wlst_edit_lock_acquire_timeout(self):
"""
Return the waitTimeInMillis for startEdit from tool properties
:return: wlst edit lock acquire timeout
"""
return self._get_from_dict_as_long(WLST_EDIT_LOCK_ACQUIRE_TIMEOUT_PROP, WLST_EDIT_LOCK_ACQUIRE_TIMEOUT_DEFAULT)

def get_wlst_edit_lock_release_timeout(self):
"""
Return the timeOutInMillis for startEdit from tool properties
:return: wlst edit lock release timeout
"""
return self._get_from_dict_as_long(WLST_EDIT_LOCK_RELEASE_TIMEOUT_PROP, WLST_EDIT_LOCK_RELEASE_TIMEOUT_DEFAULT)

def get_wlst_edit_lock_exclusive(self):
"""
Returns the exclusive value for startEdit from tool properties
:return: the string 'true' or 'false' (default)
"""
return self._get_from_dict(WLST_EDIT_LOCK_EXCLUSIVE_PROP, WLST_EDIT_LOCK_EXCLUSIVE_DEFAULT)

def _get_from_dict(self, name, default_value=None):
_method_name = '_get_from_dict'
_logger.entering(name, default_value, class_name=_class_name, method_name=_method_name)
result = default_value
if name in self.__config_dict:
result = self.__config_dict[name]
result = System.getProperty(SYS_PROP_PREFIX + name, result)
_logger.exiting(result=result, class_name=_class_name, method_name=_method_name)
return result

Expand Down
13 changes: 13 additions & 0 deletions core/src/main/python/wlsdeploy/util/model_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(self, program_name, arg_map):
self._variable_properties_file = None
self._rcu_db_user = self.DB_USER_DEFAULT
self._discard_current_edit = False
self._wait_for_edit_lock = False
self._model_config = None

self._trailing_args = []
Expand Down Expand Up @@ -153,6 +154,9 @@ def __copy_from_args(self, arg_map):
if CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH in arg_map:
self._discard_current_edit = arg_map[CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH]

if CommandLineArgUtil.WAIT_FOR_EDIT_LOCK_SWITCH in arg_map:
self._wait_for_edit_lock = arg_map[CommandLineArgUtil.WAIT_FOR_EDIT_LOCK_SWITCH]

if CommandLineArgUtil.PREVIOUS_MODEL_FILE_SWITCH in arg_map:
self._previous_model_file = arg_map[CommandLineArgUtil.PREVIOUS_MODEL_FILE_SWITCH]

Expand Down Expand Up @@ -289,6 +293,8 @@ def __copy__(self):
arg_map[CommandLineArgUtil.RUN_RCU_SWITCH] = self._run_rcu
if self._discard_current_edit is not None:
arg_map[CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH] = self._discard_current_edit
if self._wait_for_edit_lock is not None:
arg_map[CommandLineArgUtil.WAIT_FOR_EDIT_LOCK_SWITCH] = self._wait_for_edit_lock
if self._rcu_database is not None:
arg_map[CommandLineArgUtil.RCU_DB_SWITCH] = self._rcu_database
if self._rcu_prefix is not None:
Expand Down Expand Up @@ -474,6 +480,13 @@ def is_discard_current_edit(self):
"""
return self._discard_current_edit

def is_wait_for_edit_lock(self):
"""
Get the wait for edit lock value.
:return: true or false
"""
return self._wait_for_edit_lock

def get_opss_wallet(self):
"""
Get the opss wallet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ WLSDPLY-09016=There are outstanding changes but -discard_current_edit has been s
discarded before processing update.
WLSDPLY-09017=NOT USED
WLSDPLY-09018=Online update has been canceled because the flag cancel_changes_if_restart_required is set and the update requires restart: {0}
WLSDPLY-09019=Acquiring online edit lock with acquire timeout value of {0}, release timeout value of {1}, and exclusive value of {2}

# wlsdeploy/tool/deploy/deployer_utils.py
WLSDPLY-09100=Existing object names are {0}
Expand Down
24 changes: 15 additions & 9 deletions documentation/2.0/content/userguide/tools-config/tool_prop.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ weight: 4

If a property is removed from the file, or a property value is incorrectly formatted, a `WARNING` message is logged and an internal default value used instead of the missing or bad value.

| Property | Description |
| -------- | ----- |
| `connect.timeout` | The number of milliseconds that WLST waits for the online `connect` command to complete. A value of 0 means the operation will not timeout. |
| `activate.timeout` | The number of milliseconds that WLST waits for the activation of configuration changes to complete. A value of -1 means the operation will not timeout. |
| `deploy.timeout` | The number of milliseconds that WLST waits for the undeployment process to complete. A value of 0 means the operation will not timeout. |
| `redeploy.timeout` | The number of milliseconds that WLST waits for the redeployment process to complete. A value of 0 means the operation will not timeout. |
| `start.application.timeout` | The number of milliseconds that WLST waits for the start application process to complete. A value of 0 means the operation will not timeout. |
| `stop.application.timeout` | The number of milliseconds that WLST waits for the stop application process to complete. A value of 0 means the operation will not timeout. |
| `set.server.groups.timeout` | Specifies the amount of time the set server groups connection can be inactive before the connection times out. |
| Property | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `connect.timeout` | The number of milliseconds that WLST waits for the online `connect` command to complete. A value of 0 means the operation will not timeout. |
| `activate.timeout` | The number of milliseconds that WLST waits for the activation of configuration changes to complete. A value of -1 means the operation will not timeout. |
| `deploy.timeout` | The number of milliseconds that WLST waits for the undeployment process to complete. A value of 0 means the operation will not timeout. |
| `redeploy.timeout` | The number of milliseconds that WLST waits for the redeployment process to complete. A value of 0 means the operation will not timeout. |
| `start.application.timeout` | The number of milliseconds that WLST waits for the start application process to complete. A value of 0 means the operation will not timeout. |
| `stop.application.timeout` | The number of milliseconds that WLST waits for the stop application process to complete. A value of 0 means the operation will not timeout. |
| `set.server.groups.timeout` | Specifies the amount of time the set server groups connection can be inactive before the connection times out. |
| `wlst.edit.lock.acquire.timeout` | Specifies the amount of time in milliseconds the WLST online `startEdit` command will wait trying to acquire the edit lock before it times out. |
| `wlst.edit.lock.release.timeout` | Specifies the amount of time in milliseconds the WLST online `startEdit` command will wait for the edit lock to be released before releasing it automatically. |
| `wlst.edit.lock.exclusive` | Specifies whether the edit lock acquired by `startEdit` should be exclusive or shared (default is shared). |

You can override the value of a single property using a Java System property with the name `wdt.config.<tool-property-name>`.
For example, adding `-Dwdt.config.connect.timeout=5000` will set the effective `connect.timeout` property to 5000 milliseconds, regardless of what the value in the tool.properties file might be.
1 change: 1 addition & 0 deletions documentation/2.0/content/userguide/tools/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ The Deploy Applications Tool supports the use of multiple models, as described i
| `-passphrase_file` | An alternative to entering the encryption passphrase at a prompt. The value is the name of a file with a string value which WDT will read to retrieve the passphrase. | |
| `-use_encryption` | One or more of the passwords in the model or variables file(s) are encrypted and must be decrypted. Java 8 or later is required for this feature. | |
| `-variable_file` | The location of the property file containing the values for variables used in the model. This can also be specified as a comma-separated list of property files, where each successive set of properties layers on top of the previous ones. | |
| `-wait_for_edit_lock` | Skip checks for active edit sessions and pending changes before trying to acquire the WLST online edit lock to modify domain configuration. | |
Loading