Skip to content

Commit b8aef22

Browse files
committed
Merge remote-tracking branch 'origin/Issue#164-support-custom-security-providers' into Issue#164-support-custom-security-providers
2 parents 0b77a28 + 07450eb commit b8aef22

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

core/src/main/python/discover.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
55
The entry point for the discoverDomain tool.
@@ -20,7 +20,6 @@
2020
from oracle.weblogic.deploy.util import TranslateException
2121
from oracle.weblogic.deploy.util import WLSDeployArchive
2222
from oracle.weblogic.deploy.util import WLSDeployArchiveIOException
23-
from oracle.weblogic.deploy.util import WLSDeployExit
2423
from oracle.weblogic.deploy.util import WebLogicDeployToolingVersion
2524
from oracle.weblogic.deploy.validate import ValidateException
2625

@@ -72,7 +71,8 @@
7271
CommandLineArgUtil.VARIABLE_PROPERTIES_FILE_SWITCH,
7372
CommandLineArgUtil.ADMIN_URL_SWITCH,
7473
CommandLineArgUtil.ADMIN_USER_SWITCH,
75-
CommandLineArgUtil.ADMIN_PASS_SWITCH
74+
CommandLineArgUtil.ADMIN_PASS_SWITCH,
75+
CommandLineArgUtil.TARGET_MODE_SWITCH
7676
]
7777

7878

@@ -153,6 +153,7 @@ def __process_online_args(optional_arg_map):
153153
optional_arg_map[CommandLineArgUtil.ADMIN_PASS_SWITCH] = String(password)
154154

155155
mode = WlstModes.ONLINE
156+
optional_arg_map[CommandLineArgUtil.TARGET_MODE_SWITCH] = 'online'
156157
return mode
157158

158159

core/src/main/python/wlsdeploy/tool/create/creator.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
from oracle.weblogic.deploy.util import WLSDeployArchive
7+
from oracle.weblogic.deploy.exception import BundleAwareException
78

89
from wlsdeploy.aliases.location_context import LocationContext
910
from wlsdeploy.aliases.validation_codes import ValidationCodes
@@ -179,7 +180,7 @@ def _create_security_provider_mbeans(self, type_name, model_nodes, base_location
179180

180181
self.logger.entering(type_name, str(base_location), log_created,
181182
class_name=self.__class_name, method_name=_method_name)
182-
if model_nodes is None or len(model_nodes) == 0 or not self._is_type_valid(base_location, type_name):
183+
if not self._is_type_valid(base_location, type_name):
183184
return
184185

185186
location = LocationContext(base_location).append_location(type_name)
@@ -188,20 +189,19 @@ def _create_security_provider_mbeans(self, type_name, model_nodes, base_location
188189
# For create, delete the existing nodes, and re-add in order found in model in iterative code below
189190
self._delete_existing_providers(location)
190191

192+
if model_nodes is None or len(model_nodes) == 0:
193+
return
194+
191195
token_name = self.alias_helper.get_name_token(location)
192196
create_path = self.alias_helper.get_wlst_create_path(location)
193197
list_path = self.alias_helper.get_wlst_list_path(location)
194198
existing_folder_names = self._get_existing_folders(list_path)
195199
known_providers = self.alias_helper.get_model_subfolder_names(location)
196200
allow_custom = str(self.alias_helper.is_custom_folder_allowed(location))
197-
self.logger.finer('create path {0}, list_path {1}, existing folders {2}', create_path, list_path,
198-
str(existing_folder_names))
199201

200202
for model_name in model_nodes:
201203
model_node = model_nodes[model_name]
202204

203-
# Need to create the node first ?
204-
self.logger.fine('Adding the provider {0} at location {1}', model_name, str(location))
205205
if model_node is None:
206206
# The node is empty so nothing to do... move to the next named node.
207207
continue
@@ -391,23 +391,22 @@ def _create_subfolders(self, location, model_nodes):
391391
"""
392392
_method_name = '_create_subfolders'
393393

394-
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
394+
self.logger.entering(location.get_folder_path(), class_name=self.__class_name, method_name=_method_name)
395395
model_subfolder_names = self.alias_helper.get_model_subfolder_names(location)
396-
397396
for key in model_nodes:
398397
if key in model_subfolder_names:
399-
400398
subfolder_nodes = model_nodes[key]
401-
if len(subfolder_nodes) != 0:
402-
sub_location = LocationContext(location).append_location(key)
399+
sub_location = LocationContext(location).append_location(key)
400+
# both create and update are merge to model so will process a subfolder with an empty node
401+
if self.alias_helper.requires_artificial_type_subfolder_handling(sub_location):
402+
self.logger.finest('WLSDPLY-12116', key, str(sub_location), subfolder_nodes,
403+
class_name=self.__class_name, method_name=_method_name)
404+
self._create_security_provider_mbeans(key, subfolder_nodes, location)
405+
elif len(subfolder_nodes) != 0:
403406
if self.alias_helper.supports_multiple_mbean_instances(sub_location):
404407
self.logger.finest('WLSDPLY-12109', key, str(sub_location), subfolder_nodes,
405408
class_name=self.__class_name, method_name=_method_name)
406409
self._create_named_mbeans(key, subfolder_nodes, location)
407-
elif self.alias_helper.requires_artificial_type_subfolder_handling(sub_location):
408-
self.logger.finest('WLSDPLY-12116', key, str(sub_location), subfolder_nodes,
409-
class_name=self.__class_name, method_name=_method_name)
410-
self._create_security_provider_mbeans(key, subfolder_nodes, location)
411410
elif self.alias_helper.is_artificial_type_folder(sub_location):
412411
ex = exception_helper.create_create_exception('WLSDPLY-12120', str(sub_location),
413412
key, str(location))
@@ -417,6 +416,7 @@ def _create_subfolders(self, location, model_nodes):
417416
self.logger.finest('WLSDPLY-12110', key, str(sub_location), subfolder_nodes,
418417
class_name=self.__class_name, method_name=_method_name)
419418
self._create_mbean(key, subfolder_nodes, location)
419+
420420
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
421421
return
422422

@@ -487,18 +487,27 @@ def _delete_existing_providers(self, location):
487487
self.logger.entering(location.get_folder_path(), class_name=self.__class_name, method_name=_method_name)
488488

489489
list_path = self.alias_helper.get_wlst_list_path(location)
490-
self.logger.finer('Look for providers at location {0}', list_path)
491490
existing_folder_names = self._get_existing_folders(list_path)
492491
wlst_base_provider_type = self.alias_helper.get_wlst_mbean_type(location)
493492
if len(existing_folder_names) == 0:
494-
self.logger.finer('No default providers installed for {0} at {1}', wlst_base_provider_type, list_path)
493+
self.logger.finer('WLSDPLY-12136', wlst_base_provider_type, list_path, class_name=self.__class_name,
494+
method_name=_method_name)
495495
else:
496496
create_path = self.alias_helper.get_wlst_create_path(location)
497497
self.wlst_helper.cd(create_path)
498498
for existing_folder_name in existing_folder_names:
499-
self.wlst_helper.delete(existing_folder_name, wlst_base_provider_type)
500-
self.logger.finer('Removed default provider {0} from provider {1} at location {2}',
501-
existing_folder_name, wlst_base_provider_type, create_path)
499+
try:
500+
self.wlst_helper.delete(existing_folder_name, wlst_base_provider_type)
501+
self.logger.finer('WLSDPLY-12135', existing_folder_name, wlst_base_provider_type, create_path,
502+
class_name=self.__class_name, method_name=_method_name)
503+
except BundleAwareException, bae:
504+
ex = exception_helper.create_exception(self._exception_type, 'WLSDPLY-12134', existing_folder_name,
505+
self.wls_helper.get_weblogic_version(),
506+
wlst_base_provider_type, bae.getLocalizedMessage(),
507+
error=bae)
508+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
509+
raise ex
510+
502511
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
503512
return
504513

core/src/main/python/wlsdeploy/tool/util/wlst_helper.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from oracle.weblogic.deploy.util import PyWLSTException
@@ -41,19 +41,6 @@ def assign(self, source_type, source_name, target_type, target_name):
4141
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
4242
raise ex
4343

44-
45-
def reorder_provider(self, provider_type, provider_map, wlst_path):
46-
"""
47-
Retrieve the list of security providers at the provided path and
48-
:param provider_type: MBean Type of the Security Provider, i.e. AuthenticationProvider
49-
:param provider_map: Map of mbean names and corresponding mbean type
50-
:param wlst_path: Location of the realm where the Mbeans will be reordered.
51-
:return: Map of provider name and corresponding mbean object
52-
"""
53-
_method_name = 'reorder_provider'
54-
55-
56-
5744
def cd(self, wlst_path):
5845
"""
5946
Change WLST directories to the specified path
@@ -172,7 +159,7 @@ def delete(self, wlst_name, wlst_type):
172159
try:
173160
wlst_helper.delete(wlst_name, wlst_type)
174161
except PyWLSTException, pwe:
175-
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19103', wlst_type, wlst_name,
162+
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19135', wlst_type, wlst_name,
176163
pwe.getLocalizedMessage(), error=pwe)
177164
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
178165
raise ex

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,10 @@ WLSDPLY-12130=The set method for attribute {0} has {1} arguments
959959
WLSDPLY-12131=Unable to invoke method "{0}" with argument {1}: {2}
960960
WLSDPLY-12132=Unrecognized data type {0}
961961
WLSDPLY-12133=Unable to convert "{0}" to value of type {1}
962+
WLSDPLY-12134=Unable to remove "{0}" in target domain release {1}. The remove is required to properly configure \
963+
the Realm Provider Type {2}. Consult the WebLogic Deploy Tool documentation for further information. : {3}
964+
WLSDPLY-12135=Removed Security provider {0} with Provider type {1} at location {2}
965+
WLSDPLY-12136=No default providers installed for {0} at {1}
962966

963967
# domain_creator.py
964968
WLSDPLY-12200={0} did not find the required {1} section in the model file {2}

0 commit comments

Comments
 (0)