4
4
"""
5
5
6
6
from oracle .weblogic .deploy .util import WLSDeployArchive
7
+ from oracle .weblogic .deploy .exception import BundleAwareException
7
8
8
9
from wlsdeploy .aliases .location_context import LocationContext
9
10
from wlsdeploy .aliases .validation_codes import ValidationCodes
@@ -179,7 +180,7 @@ def _create_security_provider_mbeans(self, type_name, model_nodes, base_location
179
180
180
181
self .logger .entering (type_name , str (base_location ), log_created ,
181
182
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 ):
183
184
return
184
185
185
186
location = LocationContext (base_location ).append_location (type_name )
@@ -188,20 +189,19 @@ def _create_security_provider_mbeans(self, type_name, model_nodes, base_location
188
189
# For create, delete the existing nodes, and re-add in order found in model in iterative code below
189
190
self ._delete_existing_providers (location )
190
191
192
+ if model_nodes is None or len (model_nodes ) == 0 :
193
+ return
194
+
191
195
token_name = self .alias_helper .get_name_token (location )
192
196
create_path = self .alias_helper .get_wlst_create_path (location )
193
197
list_path = self .alias_helper .get_wlst_list_path (location )
194
198
existing_folder_names = self ._get_existing_folders (list_path )
195
199
known_providers = self .alias_helper .get_model_subfolder_names (location )
196
200
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 ))
199
201
200
202
for model_name in model_nodes :
201
203
model_node = model_nodes [model_name ]
202
204
203
- # Need to create the node first ?
204
- self .logger .fine ('Adding the provider {0} at location {1}' , model_name , str (location ))
205
205
if model_node is None :
206
206
# The node is empty so nothing to do... move to the next named node.
207
207
continue
@@ -391,23 +391,22 @@ def _create_subfolders(self, location, model_nodes):
391
391
"""
392
392
_method_name = '_create_subfolders'
393
393
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 )
395
395
model_subfolder_names = self .alias_helper .get_model_subfolder_names (location )
396
-
397
396
for key in model_nodes :
398
397
if key in model_subfolder_names :
399
-
400
398
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 :
403
406
if self .alias_helper .supports_multiple_mbean_instances (sub_location ):
404
407
self .logger .finest ('WLSDPLY-12109' , key , str (sub_location ), subfolder_nodes ,
405
408
class_name = self .__class_name , method_name = _method_name )
406
409
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 )
411
410
elif self .alias_helper .is_artificial_type_folder (sub_location ):
412
411
ex = exception_helper .create_create_exception ('WLSDPLY-12120' , str (sub_location ),
413
412
key , str (location ))
@@ -417,6 +416,7 @@ def _create_subfolders(self, location, model_nodes):
417
416
self .logger .finest ('WLSDPLY-12110' , key , str (sub_location ), subfolder_nodes ,
418
417
class_name = self .__class_name , method_name = _method_name )
419
418
self ._create_mbean (key , subfolder_nodes , location )
419
+
420
420
self .logger .exiting (class_name = self .__class_name , method_name = _method_name )
421
421
return
422
422
@@ -487,18 +487,27 @@ def _delete_existing_providers(self, location):
487
487
self .logger .entering (location .get_folder_path (), class_name = self .__class_name , method_name = _method_name )
488
488
489
489
list_path = self .alias_helper .get_wlst_list_path (location )
490
- self .logger .finer ('Look for providers at location {0}' , list_path )
491
490
existing_folder_names = self ._get_existing_folders (list_path )
492
491
wlst_base_provider_type = self .alias_helper .get_wlst_mbean_type (location )
493
492
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 )
495
495
else :
496
496
create_path = self .alias_helper .get_wlst_create_path (location )
497
497
self .wlst_helper .cd (create_path )
498
498
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
+
502
511
self .logger .exiting (class_name = self .__class_name , method_name = _method_name )
503
512
return
504
513
0 commit comments