Skip to content

Commit 2ae0088

Browse files
committed
Merge branch 'db-client-data' into 'main'
Distribute wallets using DB client data MBeans See merge request weblogic-cloud/weblogic-deploy-tooling!1826
2 parents 5ef1f19 + 197283b commit 2ae0088

File tree

19 files changed

+431
-173
lines changed

19 files changed

+431
-173
lines changed

core/src/main/python/deploy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def __deploy_online(model_deployer, model_context):
167167
try:
168168
model_deployer.deploy_plugins()
169169
model_deployer.deploy_resources()
170-
model_deployer.distribute_database_wallets_online()
171170
model_deployer.deploy_app_attributes_online()
172171
except (DeployException, exceptions.Exception, JException), ex:
173172
# release the edit session, and raise the exception for tool_main to handle

core/src/main/python/update.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def __update_online(model_deployer, model, model_context, aliases):
197197
model_deployer.deploy_plugins() # may be referenced in SecurityConfiguration/CertificateManagement
198198
topology_updater.update()
199199
model_deployer.deploy_resources()
200-
model_deployer.distribute_database_wallets_online()
201200
model_deployer.deploy_app_attributes_online()
202201

203202
except (DeployException, exceptions.Exception, JException), ex:

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from wlsdeploy.aliases.model_constants import APPLICATION
5656
from wlsdeploy.aliases.model_constants import CALLOUT
5757
from wlsdeploy.aliases.model_constants import CUSTOM_RESOURCE
58+
from wlsdeploy.aliases.model_constants import DB_CLIENT_DATA_DIRECTORY
5859
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
5960
from wlsdeploy.aliases.model_constants import DOMAIN_INFO_ALIAS
6061
from wlsdeploy.aliases.model_constants import EJB_CONTAINER
@@ -179,6 +180,7 @@ class AliasEntries(object):
179180

180181
__app_deployments_top_level_folders = [
181182
APPLICATION,
183+
DB_CLIENT_DATA_DIRECTORY,
182184
LIBRARY,
183185
PLUGIN_DEPLOYMENT
184186
]

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
# Deprecated in WDT 4.0.0
8787
DATABASE_TYPE = 'databaseType'
8888

89+
DB_CLIENT_DATA_DIRECTORY = 'DbClientDataDirectory'
8990
DEFAULT_ADJUDICATOR = 'DefaultAdjudicator'
9091
DEFAULT_ADMIN_SERVER_NAME = 'AdminServer'
9192
DEFAULT_AUDITOR = 'DefaultAuditor'

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,12 @@ def _replace_path_tokens_for_deployment(self, deployment_type, deployment_name,
301301
self.logger.entering(deployment_type, deployment_name, deployment_dict,
302302
class_name=self._class_name, method_name=_method_name)
303303

304-
self.model_context.replace_tokens(deployment_type, deployment_name, SOURCE_PATH, deployment_dict)
305-
self.model_context.replace_tokens(deployment_type, deployment_name, PLAN_DIR, deployment_dict)
306-
self.model_context.replace_tokens(deployment_type, deployment_name, PLAN_PATH, deployment_dict)
304+
for attribute in [SOURCE_PATH, PLAN_DIR, PLAN_PATH]:
305+
self.model_context.replace_tokens(deployment_type, deployment_name, attribute, deployment_dict)
306+
# deployment path might need correcting from wlsdeploy/* => config/wlsdeploy/*
307+
path = dictionary_utils.get_element(deployment_dict, attribute)
308+
if path:
309+
deployment_dict[attribute] = WLSDeployArchive.getExtractPath(path)
307310

308311
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
309312

core/src/main/python/wlsdeploy/tool/deploy/applications_offline_deployer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from wlsdeploy.aliases.location_context import LocationContext
88
from wlsdeploy.aliases.model_constants import APPLICATION
9+
from wlsdeploy.aliases.model_constants import DB_CLIENT_DATA_DIRECTORY
910
from wlsdeploy.aliases.model_constants import LIBRARY
1011
from wlsdeploy.aliases.model_constants import MODULE_TYPE
1112
from wlsdeploy.aliases.model_constants import PLUGIN_DEPLOYMENT
@@ -32,6 +33,7 @@ def deploy(self, _is_restart_required):
3233

3334
self.__deploy_shared_libraries()
3435
self.__deploy_applications()
36+
self.__deploy_db_client_data()
3537

3638
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
3739

@@ -48,6 +50,9 @@ def __deploy_shared_libraries(self):
4850
def __deploy_applications(self):
4951
self.__update_deployments(APPLICATION)
5052

53+
def __deploy_db_client_data(self):
54+
self.__update_deployments(DB_CLIENT_DATA_DIRECTORY)
55+
5156
def __update_deployments(self, deployment_type):
5257
_method_name = '__update_deployments'
5358
self.logger.entering(deployment_type, class_name=self._class_name, method_name=_method_name)
@@ -86,7 +91,8 @@ def __update_deployments(self, deployment_type):
8691
self.__validate_deployment_source_path(deployment_name, deployment_type, deployment,
8792
existing_deployments)
8893

89-
self._extract_deployment_from_archive(deployment_name, deployment_type, deployment)
94+
if deployment_type != DB_CLIENT_DATA_DIRECTORY: # wallets were already extracted
95+
self._extract_deployment_from_archive(deployment_name, deployment_type, deployment)
9096

9197
# If SourcePath is empty and hasn't caused an error, deployment_name will be unchanged.
9298
source_path = dictionary_utils.get_element(deployment, SOURCE_PATH)

core/src/main/python/wlsdeploy/tool/deploy/applications_online_deployer.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
from oracle.weblogic.deploy.util import FileUtils
1414
from oracle.weblogic.deploy.util import PyOrderedDict as OrderedDict
1515
from oracle.weblogic.deploy.util import WdtJaxbException
16+
from oracle.weblogic.deploy.util import WLSDeployArchive
1617

1718
from wlsdeploy.aliases import alias_utils
1819
from wlsdeploy.aliases.location_context import LocationContext
1920
from wlsdeploy.aliases.model_constants import ABSOLUTE_PLAN_PATH
2021
from wlsdeploy.aliases.model_constants import ABSOLUTE_SOURCE_PATH
2122
from wlsdeploy.aliases.model_constants import APPLICATION
23+
from wlsdeploy.aliases.model_constants import DB_CLIENT_DATA_DIRECTORY
2224
from wlsdeploy.aliases.model_constants import DEPLOYMENT_ORDER
2325
from wlsdeploy.aliases.model_constants import LIBRARY
2426
from wlsdeploy.aliases.model_constants import MODULE_TYPE
@@ -72,6 +74,8 @@ def deploy(self, is_restart_required=False):
7274
self.logger.entering(self._parent_name, self._parent_type, is_restart_required,
7375
class_name=self._class_name, method_name=_method_name)
7476

77+
self.__deploy_db_client_data()
78+
7579
# Make copies of the model dictionary since we are going
7680
# to modify it as we build the deployment strategy.
7781
#
@@ -1144,6 +1148,9 @@ def __undeploy_app(self, deployment_name, deployment_type, partition_name=None,
11441148
'targets': targets
11451149
}
11461150

1151+
if deployment_type == DB_CLIENT_DATA_DIRECTORY:
1152+
kwargs['dbClientData'] = 'true'
1153+
11471154
if deployment_type == LIBRARY:
11481155
kwargs['libraryModule'] = 'true'
11491156

@@ -1284,6 +1291,40 @@ def __start_all_apps(self, deployed_app_list, base_location, is_restart_required
12841291

12851292
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
12861293

1294+
def __deploy_db_client_data(self):
1295+
_method_name = '__deploy_db_client_data'
1296+
self.logger.entering(class_name=self._class_name, method_name=_method_name)
1297+
1298+
db_client_location = LocationContext(self._base_location).append_location(DB_CLIENT_DATA_DIRECTORY)
1299+
if not self.aliases.is_model_location_valid(db_client_location):
1300+
return
1301+
1302+
db_client_entries = dictionary_utils.get_dictionary_element(self._parent_dict, DB_CLIENT_DATA_DIRECTORY)
1303+
db_client_entries = copy.deepcopy(db_client_entries)
1304+
self._replace_deployments_path_tokens(DB_CLIENT_DATA_DIRECTORY, db_client_entries)
1305+
existing_names = deployer_utils.get_existing_object_list(db_client_location, self.aliases)
1306+
1307+
for entry_name, entry_dict in db_client_entries.items():
1308+
if model_helper.is_delete_name(entry_name):
1309+
if self._does_deployment_to_delete_exist(entry_name, existing_names, DB_CLIENT_DATA_DIRECTORY):
1310+
name_to_delete = model_helper.get_delete_item_name(entry_name)
1311+
self.__undeploy_app(name_to_delete, DB_CLIENT_DATA_DIRECTORY)
1312+
else:
1313+
self.logger.info('WLSDPLY-09316', DB_CLIENT_DATA_DIRECTORY, entry_name,
1314+
class_name=self._class_name, method_name=_method_name)
1315+
1316+
source_path = dictionary_utils.get_element(entry_dict, SOURCE_PATH)
1317+
if string_utils.is_empty(source_path):
1318+
ex = exception_helper.create_deploy_exception(
1319+
'WLSDPLY-09317', DB_CLIENT_DATA_DIRECTORY, entry_name, SOURCE_PATH)
1320+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
1321+
raise ex
1322+
1323+
source_path = WLSDeployArchive.getExtractPath(source_path) # wlsdeploy => config/wlsdeploy
1324+
if self.archive_helper and self.archive_helper.is_path_into_archive(source_path):
1325+
source_path = self.path_helper.join(self.model_context.get_domain_home(), source_path)
1326+
1327+
self.wlst_helper.distribute_application(source_path, dbClientData='true', remote='true')
12871328

12881329
def _get_deployment_order(apps_dict, ordered_list, order):
12891330
"""

core/src/main/python/wlsdeploy/tool/deploy/model_deployer.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,45 +77,6 @@ def deploy_model_offline(self):
7777
def deploy_plugins(self):
7878
self.applications_deployer.deploy_plugins()
7979

80-
def distribute_database_wallets_online(self):
81-
"""
82-
Go through the model and run the WLST distributeApplication command to distribute the already extracted wallet
83-
to the targets.
84-
"""
85-
_method_name = 'distribute_database_wallets_online'
86-
87-
if self.archive_helper is None:
88-
return
89-
90-
if not self.wls_helper.is_db_client_data_distribution_supported():
91-
# Older WLS versions don't support wallet distribution
92-
return
93-
94-
if self.model_context.is_remote():
95-
# Should have already warned during wallets extraction
96-
return
97-
98-
try:
99-
wallet_path_list = self.archive_helper.get_all_database_wallet_paths()
100-
distribute_list = []
101-
# Go through the wallet path list and build the actual list avoid duplicate path in different wallets
102-
for wallet_path in wallet_path_list:
103-
for path in wallet_path['paths']:
104-
# correct deprecated location
105-
if path.startswith(WLSDeployArchive.WLSDPLY_ARCHIVE_BINARY_DIR + WLSDeployArchive.ZIP_SEP):
106-
path = WLSDeployArchive.CONFIG_DIR_NAME + WLSDeployArchive.ZIP_SEP + path
107-
absolute_path = self.path_helper.join(self.model_context.get_domain_home(), path)
108-
if absolute_path not in distribute_list:
109-
distribute_list.append(absolute_path)
110-
111-
for distribute_path in distribute_list:
112-
self.wlst_helper.distribute_application(distribute_path, dbClientData='true', remote='true')
113-
114-
except PyWLSTException, pwe:
115-
ex = exception_helper.create_deploy_exception('WLSDPLY-09650', pwe.getLocalizedMessage(), error=pwe)
116-
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
117-
raise ex
118-
11980
def deploy_model_after_update(self):
12081
"""
12182
Deploy the resources that must be done after WLST updateDomain.

0 commit comments

Comments
 (0)