Skip to content

Commit fb3dc99

Browse files
authored
Merge pull request #229 from oracle/WDT#52-set-domain-attributes
Wdt#52 set domain attributes
2 parents 8eeea2e + efb689b commit fb3dc99

File tree

5 files changed

+72
-13
lines changed

5 files changed

+72
-13
lines changed

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

Lines changed: 33 additions & 7 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
import javaos as os
@@ -146,7 +146,7 @@ def create(self):
146146
self.__run_rcu()
147147
self.__fail_mt_1221_domain_creation()
148148
self.__create_domain()
149-
self.__deploy_resources_and_apps()
149+
self.__deploy()
150150
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
151151
return
152152

@@ -249,20 +249,28 @@ def __create_domain(self):
249249
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
250250
return
251251

252+
def __deploy(self):
253+
"""
254+
Update the domain with domain attributes, resources and deployments.
255+
:raises: CreateException: if an error occurs while reading or updating the domain.
256+
"""
257+
self.model_context.set_domain_home(self._domain_home)
258+
self.wlst_helper.read_domain(self._domain_home)
259+
self.__set_domain_attributes()
260+
self.__deploy_resources_and_apps()
261+
self.wlst_helper.update_domain()
262+
self.wlst_helper.close_domain()
263+
return
264+
252265
def __deploy_resources_and_apps(self):
253266
"""
254267
Deploy the resources and applications.
255-
:raises: CreateException: if an error occurs while reading or updating the domain.
256268
:raises: DeployException: if an error occurs while deploy the resources or applications
257269
"""
258270
_method_name = '__deploy_resources_and_apps'
259271

260272
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
261-
self.model_context.set_domain_home(self._domain_home)
262-
self.wlst_helper.read_domain(self._domain_home)
263273
model_deployer.deploy_resources_and_apps_for_create(self.model, self.model_context, self.aliases)
264-
self.wlst_helper.update_domain()
265-
self.wlst_helper.close_domain()
266274
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
267275
return
268276

@@ -383,6 +391,7 @@ def __apply_base_domain_config(self, topology_folder_list):
383391
location.add_name_token(domain_name_token, self._domain_name)
384392

385393
self.__set_core_domain_params()
394+
386395
self.__create_security_folder(location)
387396
topology_folder_list.remove(SECURITY)
388397

@@ -408,6 +417,7 @@ def __apply_base_domain_config(self, topology_folder_list):
408417
topology_folder_list.remove(MIGRATABLE_TARGET)
409418

410419
self.__create_other_domain_artifacts(location, topology_folder_list)
420+
411421
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
412422
return
413423

@@ -811,3 +821,19 @@ def __set_admin_server_name(self):
811821
else:
812822
self._admin_server_name = self.__default_admin_server_name
813823
return
824+
825+
def __set_domain_attributes(self):
826+
"""
827+
Set the Domain attributes, which are in the top folder
828+
:param location: current location context
829+
"""
830+
_method_name = '__set_domain_attributes'
831+
self.logger.finer('WLSDPLY-12231', self._domain_name, class_name=self.__class_name, method_name=_method_name)
832+
attrib_dict = dictionary_utils.get_dictionary_attributes(self.model.get_model_topology())
833+
if DOMAIN_NAME in attrib_dict:
834+
del attrib_dict[DOMAIN_NAME]
835+
location = LocationContext()
836+
attribute_path = self.alias_helper.get_wlst_attributes_path(location)
837+
self.wlst_helper.cd(attribute_path)
838+
self._set_attributes(location, attrib_dict)
839+
return

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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 wlsdeploy.aliases.location_context import LocationContext
66
from wlsdeploy.aliases.model_constants import CLUSTER
7+
from wlsdeploy.aliases.model_constants import DOMAIN_NAME
78
from wlsdeploy.aliases.model_constants import MACHINE
89
from wlsdeploy.aliases.model_constants import MIGRATABLE_TARGET
910
from wlsdeploy.aliases.model_constants import SECURITY
@@ -75,6 +76,9 @@ def update(self):
7576
self._security_provider_creator.create_security_configuration(location)
7677
folder_list.remove(SECURITY_CONFIGURATION)
7778

79+
# set the domain attributes
80+
self._set_domain_attributes()
81+
7882
self._process_section(self._topology, folder_list, MACHINE, location)
7983
self._process_section(self._topology, folder_list, UNIX_MACHINE, location)
8084

@@ -114,3 +118,15 @@ def _process_section(self, folder_dict, folder_list, key, location):
114118

115119
if key in folder_list:
116120
folder_list.remove(key)
121+
122+
def _set_domain_attributes(self):
123+
_method_name = '_set_domain_attributes'
124+
self.logger.fine('WLSDPLY-09700', self.model_context.get_domain_name(), class_name=self._class_name,
125+
method_name=_method_name)
126+
attrib_dict = dictionary_utils.get_dictionary_attributes(self._topology)
127+
if DOMAIN_NAME in attrib_dict:
128+
del attrib_dict[DOMAIN_NAME]
129+
location = LocationContext()
130+
attribute_path = self.alias_helper.get_wlst_attributes_path(location)
131+
self.wlst_helper.cd(attribute_path)
132+
self.set_attributes(location, attrib_dict)

core/src/main/python/wlsdeploy/util/dictionary_utils.py

Lines changed: 15 additions & 1 deletion
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
import java.util.Properties as JProperties
@@ -26,6 +26,20 @@ def get_dictionary_element(dictionary, element_name):
2626
return result
2727

2828

29+
def get_dictionary_attributes(dictionary):
30+
"""
31+
Get the attributes and skip the dictionary attributes from the dictionary.
32+
:param dictionary: to return the skimmed down attribute list
33+
:return: list of attributes
34+
"""
35+
result_list = OrderedDict()
36+
if dictionary:
37+
for key, value in dictionary.iteritems():
38+
if not isinstance(value, dict):
39+
result_list[key] = value
40+
return result_list
41+
42+
2943
def is_empty_dictionary_element(dictionary, element_name):
3044
"""
3145
Determine if the element in the dictionary for the element name is not present or empty.

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Domain.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"copyright": "Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.",
2+
"copyright": "Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.",
33
"license": "The Universal Permissive License (UPL), Version 1.0",
44
"wlst_type": "",
55
"folders": {},
@@ -46,8 +46,7 @@
4646
"ParallelDeployApplicationModules": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "ParallelDeployApplicationModules", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
4747
"ParallelDeployApplications": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "ParallelDeployApplications", "wlst_path": "WP001", "value": {"default": "${false:true}"}, "wlst_type": "boolean" } ],
4848
"PartitionUriSpace": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "PartitionUriSpace", "wlst_path": "WP001", "value": {"default": "/partitions" }, "wlst_type": "string" } ],
49-
"ProductionModeEnabled": [ {"version": "[10,12.2.1.3)", "wlst_mode": "both", "wlst_name": "ProductionModeEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ,
50-
{"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "ProductionModeEnabled", "wlst_path": "WP001", "value": {"default": "true" }, "wlst_type": "boolean" } ],
49+
"ProductionModeEnabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ProductionModeEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
5150
"RootDirectory": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RootDirectory", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "access": "RO", "uses_path_tokens": "true"} ],
5251
"ServerMigrationHistorySize": [ {"version": "[12.1.2,12.2.1.1)", "wlst_mode": "both", "wlst_name": "ServerMigrationHistorySize", "wlst_path": "WP001", "value": {"default": "-1" }, "wlst_type": "integer", "restart_required": "true" },
5352
{"version": "[12.2.1.1,12.2.1.3)","wlst_mode": "both", "wlst_name": "ServerMigrationHistorySize", "wlst_path": "WP001", "value": {"default": "-1" }, "wlst_type": "integer" } ,

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
22
# The Universal Permissive License (UPL), Version 1.0
33
#
44
#
@@ -900,6 +900,9 @@ WLSDPLY-09610=Updating {0} {1} in {2} {3}
900900
# wlsdeploy/tool/deploy/model_deployer.py
901901
WLSDPLY-09650=Deployment failed due to WLST exception {0}
902902

903+
# wlsdeploy/tool/deploy/topology_updater.py
904+
WLSDPLY-09700=Update Domain {0} domain level attributes
905+
903906
###############################################################################
904907
# create messages (12000 - 14999) #
905908
###############################################################################
@@ -978,6 +981,7 @@ WLSDPLY-12227=Changing domain name from {0} to {1}
978981
WLSDPLY-12228=The model does not define the required attribute {0} in the {1} section of the model
979982
WLSDPLY-12229=Changing the administration server name from {0} to {1}
980983
WLSDPLY-12230=Creating placeholder for Coherence cluster {0}
984+
WLSDPLY-12231=Apply Domain {0} domain level attributes
981985

982986
# domain_typedef.py
983987
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

0 commit comments

Comments
 (0)