Skip to content

Commit a81b2f2

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents dfbef66 + fc6d3e4 commit a81b2f2

36 files changed

+341
-95
lines changed

core/src/main/java/oracle/weblogic/deploy/yaml/AbstractYamlTranslator.java

+6-2
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
package oracle.weblogic.deploy.yaml;
@@ -72,7 +72,11 @@ public void enterAssign(YamlParser.AssignContext ctx) {
7272
PyObject value = getAssignValue(name, ctx);
7373

7474
PyDictionary container = currentDict.peek();
75-
container.__setitem__(new PyString(name), value);
75+
76+
// null indicates not parsable, Py.None would be returned for legitimate cases
77+
if (value != null) {
78+
container.__setitem__(new PyString(name), value);
79+
}
7680
}
7781

7882
/**

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from wlsdeploy.aliases.alias_constants import WLST_TYPE
5353
from wlsdeploy.aliases.alias_constants import WLST_SUBFOLDERS_PATH
5454
from wlsdeploy.aliases.model_constants import ARGUMENTS
55-
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
5655
from wlsdeploy.aliases.model_constants import SERVER
5756
from wlsdeploy.aliases.model_constants import SERVER_START
5857

@@ -683,13 +682,10 @@ def convert_from_type(data_type, value, preferred=None, delimiter=None):
683682
elif value is not None and isinstance(value, ObjectName):
684683
new_value = value.getKeyProperty('Name')
685684
else:
686-
new_value = _jconvert_to_type(data_type, value, delimiter)
687-
685+
model_type = data_type
688686
if preferred:
689-
# now put it into the preferred model type, but the model delimiter should ALWAYS be the
690-
# model default delimiter
691-
delimiter = MODEL_LIST_DELIMITER
692-
new_value = _jconvert_to_type(preferred, new_value, delimiter)
687+
model_type = preferred
688+
new_value = _jconvert_to_type(model_type, value, delimiter)
693689

694690
return new_value
695691

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

+41-7
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

@@ -165,6 +165,14 @@ def _create_named_mbeans(self, type_name, model_nodes, base_location, log_create
165165

166166
Creator._create_named_mbeans(self, type_name, model_nodes, base_location, log_created=log_created)
167167

168+
# Override
169+
def _create_mbean(self, type_name, model_nodes, base_location, log_created=False):
170+
Creator._create_mbean(self, type_name, model_nodes, base_location, log_created)
171+
172+
# check for file paths that need to be qualified
173+
self.topology_helper.qualify_nm_properties(type_name, model_nodes, base_location, self.model_context,
174+
self.attribute_setter)
175+
168176
def __run_rcu(self):
169177
"""
170178
The method that runs RCU to drop and then create the schemas.
@@ -249,20 +257,28 @@ def __create_domain(self):
249257
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
250258
return
251259

260+
def __deploy(self):
261+
"""
262+
Update the domain with domain attributes, resources and deployments.
263+
:raises: CreateException: if an error occurs while reading or updating the domain.
264+
"""
265+
self.model_context.set_domain_home(self._domain_home)
266+
self.wlst_helper.read_domain(self._domain_home)
267+
self.__set_domain_attributes()
268+
self.__deploy_resources_and_apps()
269+
self.wlst_helper.update_domain()
270+
self.wlst_helper.close_domain()
271+
return
272+
252273
def __deploy_resources_and_apps(self):
253274
"""
254275
Deploy the resources and applications.
255-
:raises: CreateException: if an error occurs while reading or updating the domain.
256276
:raises: DeployException: if an error occurs while deploy the resources or applications
257277
"""
258278
_method_name = '__deploy_resources_and_apps'
259279

260280
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)
263281
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()
266282
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
267283
return
268284

@@ -383,6 +399,7 @@ def __apply_base_domain_config(self, topology_folder_list):
383399
location.add_name_token(domain_name_token, self._domain_name)
384400

385401
self.__set_core_domain_params()
402+
386403
self.__create_security_folder(location)
387404
topology_folder_list.remove(SECURITY)
388405

@@ -408,6 +425,7 @@ def __apply_base_domain_config(self, topology_folder_list):
408425
topology_folder_list.remove(MIGRATABLE_TARGET)
409426

410427
self.__create_other_domain_artifacts(location, topology_folder_list)
428+
411429
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
412430
return
413431

@@ -811,3 +829,19 @@ def __set_admin_server_name(self):
811829
else:
812830
self._admin_server_name = self.__default_admin_server_name
813831
return
832+
833+
def __set_domain_attributes(self):
834+
"""
835+
Set the Domain attributes, which are in the top folder
836+
:param location: current location context
837+
"""
838+
_method_name = '__set_domain_attributes'
839+
self.logger.finer('WLSDPLY-12231', self._domain_name, class_name=self.__class_name, method_name=_method_name)
840+
attrib_dict = dictionary_utils.get_dictionary_attributes(self.model.get_model_topology())
841+
if DOMAIN_NAME in attrib_dict:
842+
del attrib_dict[DOMAIN_NAME]
843+
location = LocationContext()
844+
attribute_path = self.alias_helper.get_wlst_attributes_path(location)
845+
self.wlst_helper.cd(attribute_path)
846+
self._set_attributes(location, attrib_dict)
847+
return

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

+40-23
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,40 @@
44
"""
55
import copy
66
import javaos as os
7-
from sets import Set
8-
7+
from java.io import ByteArrayOutputStream
98
from java.io import File
10-
from java.io import IOException
119
from java.io import FileNotFoundException
12-
from java.util.zip import ZipException
10+
from java.io import IOException
11+
from java.lang import IllegalStateException
1312
from java.security import NoSuchAlgorithmException
1413
from java.util.jar import JarFile
15-
from java.util.jar import Manifest
16-
from java.lang import IllegalStateException
17-
from java.io import ByteArrayOutputStream
18-
19-
import oracle.weblogic.deploy.util.FileUtils as FileUtils
20-
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
21-
14+
from java.util.zip import ZipException
15+
from sets import Set
2216
from wlsdeploy.aliases.location_context import LocationContext
23-
from wlsdeploy.aliases.wlst_modes import WlstModes
24-
from wlsdeploy.exception import exception_helper
25-
from wlsdeploy.tool.deploy import deployer_utils
26-
from wlsdeploy.tool.deploy.deployer import Deployer
27-
from wlsdeploy.util import dictionary_utils
28-
from wlsdeploy.util import string_utils
29-
3017
from wlsdeploy.aliases.model_constants import ABSOLUTE_SOURCE_PATH
31-
from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
3218
from wlsdeploy.aliases.model_constants import APPLICATION
19+
from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
3320
from wlsdeploy.aliases.model_constants import DEPLOYMENT_ORDER
3421
from wlsdeploy.aliases.model_constants import LIBRARY
3522
from wlsdeploy.aliases.model_constants import PARTITION
3623
from wlsdeploy.aliases.model_constants import PLAN_PATH
3724
from wlsdeploy.aliases.model_constants import PLAN_STAGE_MODE
25+
from wlsdeploy.aliases.model_constants import RESOURCES
3826
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
3927
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP_TEMPLATE
40-
from wlsdeploy.aliases.model_constants import RESOURCES
4128
from wlsdeploy.aliases.model_constants import SECURITY_DD_MODEL
4229
from wlsdeploy.aliases.model_constants import SOURCE_PATH
4330
from wlsdeploy.aliases.model_constants import TARGET
4431
from wlsdeploy.aliases.model_constants import TARGETS
32+
from wlsdeploy.aliases.wlst_modes import WlstModes
33+
from wlsdeploy.exception import exception_helper
34+
from wlsdeploy.tool.deploy import deployer_utils
35+
from wlsdeploy.tool.deploy.deployer import Deployer
36+
from wlsdeploy.util import dictionary_utils
37+
from wlsdeploy.util import string_utils
38+
39+
import oracle.weblogic.deploy.util.FileUtils as FileUtils
40+
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
4541

4642

4743
class ApplicationsDeployer(Deployer):
@@ -158,6 +154,27 @@ def __add_applications(self):
158154

159155
application = \
160156
copy.deepcopy(dictionary_utils.get_dictionary_element(applications, application_name))
157+
158+
app_source_path = dictionary_utils.get_element(application, SOURCE_PATH)
159+
if string_utils.is_empty(app_source_path):
160+
ex = exception_helper.create_deploy_exception('WLSDPLY-09302', application_name, SOURCE_PATH)
161+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
162+
raise ex
163+
164+
if deployer_utils.is_path_into_archive(app_source_path):
165+
if self.archive_helper is not None:
166+
self.archive_helper.extract_file(app_source_path)
167+
else:
168+
ex = exception_helper.create_deploy_exception('WLSDPLY-09303', application_name)
169+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
170+
raise ex
171+
full_source_path = File(File(self.model_context.get_domain_home()), app_source_path).getAbsolutePath()
172+
else:
173+
full_source_path = File(self.model_context.replace_token_string(app_source_path)).getAbsolutePath()
174+
175+
application_name = \
176+
self.__get_deployable_library_versioned_name(full_source_path, application_name)
177+
161178
quoted_application_name = self.wlst_helper.get_quoted_name_for_wlst(application_name)
162179
application_location.add_name_token(application_token, quoted_application_name)
163180

@@ -732,9 +749,9 @@ def __deploy_app_online(self, application_name, source_path, targets, plan=None,
732749
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
733750
raise ex
734751

735-
if options is not None and 'libraryModule' in options and string_utils.to_boolean(options['libraryModule']):
736-
computed_name = self.__get_deployable_library_versioned_name(source_path, application_name)
737-
application_name = computed_name
752+
# if options is not None and 'libraryModule' in options and string_utils.to_boolean(options['libraryModule']):
753+
computed_name = self.__get_deployable_library_versioned_name(source_path, application_name)
754+
application_name = computed_name
738755

739756
# build the dictionary of named arguments to pass to the deploy_application method
740757
args = list()

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

+25-1
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
@@ -58,6 +59,14 @@ def _add_named_elements(self, type_name, model_nodes, location):
5859

5960
Deployer._add_named_elements(self, type_name, model_nodes, location)
6061

62+
# Override
63+
def _add_model_elements(self, type_name, model_nodes, location):
64+
Deployer._add_model_elements(self, type_name, model_nodes, location)
65+
66+
# check for file paths that need to be qualified
67+
self._topology_helper.qualify_nm_properties(type_name, model_nodes, location, self.model_context,
68+
self.attribute_setter)
69+
6170
def update(self):
6271
"""
6372
Deploy resource model elements at the domain level, including multi-tenant elements.
@@ -75,6 +84,9 @@ def update(self):
7584
self._security_provider_creator.create_security_configuration(location)
7685
folder_list.remove(SECURITY_CONFIGURATION)
7786

87+
# set the domain attributes
88+
self._set_domain_attributes()
89+
7890
self._process_section(self._topology, folder_list, MACHINE, location)
7991
self._process_section(self._topology, folder_list, UNIX_MACHINE, location)
8092

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

115127
if key in folder_list:
116128
folder_list.remove(key)
129+
130+
def _set_domain_attributes(self):
131+
_method_name = '_set_domain_attributes'
132+
self.logger.fine('WLSDPLY-09700', self.model_context.get_domain_name(), class_name=self._class_name,
133+
method_name=_method_name)
134+
attrib_dict = dictionary_utils.get_dictionary_attributes(self._topology)
135+
if DOMAIN_NAME in attrib_dict:
136+
del attrib_dict[DOMAIN_NAME]
137+
location = LocationContext()
138+
attribute_path = self.alias_helper.get_wlst_attributes_path(location)
139+
self.wlst_helper.cd(attribute_path)
140+
self.set_attributes(location, attrib_dict)

core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py

+4-2
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 java.io import File
@@ -58,6 +58,8 @@ def discover(self):
5858
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
5959
model_folder_name, folder_result = self.get_jdbc_stores()
6060
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
61+
model_folder_name, folder_result = self.get_path_services()
62+
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
6163
JmsResourcesDiscoverer(self._model_context, self._dictionary, self._base_location, wlst_mode=self._wlst_mode,
6264
aliases=self._aliases).discover()
6365
model_folder_name, folder_result = self.get_wldf_system_resources()
@@ -289,7 +291,7 @@ def get_path_services(self):
289291
result[path_service] = OrderedDict()
290292
location.add_name_token(name_token, path_service)
291293
self._populate_model_parameters(result[path_service], location)
292-
location.remove_name_token(name_token.PATHSERVICE)
294+
location.remove_name_token(name_token)
293295
_logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
294296
return model_top_folder_name, result
295297

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

+5-5
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
@@ -143,7 +143,7 @@ def _get_attributes_for_current_location_online(self, location):
143143
path = self._alias_helper.get_wlst_attributes_path(location)
144144
try:
145145
lsa_attributes = wlst_helper.lsa(path)
146-
mbi_attributes = _get_mbi_attribute_list()
146+
mbi_attributes = _get_mbi_attribute_list(path)
147147
if mbi_attributes:
148148
for lsa_attribute_name in lsa_attributes:
149149
if lsa_attribute_name in lsa_attributes and lsa_attribute_name not in mbi_attributes:
@@ -659,9 +659,9 @@ def convert_to_absolute_path(relative_to, file_name):
659659
return file_name
660660

661661

662-
def _get_mbi_attribute_list():
662+
def _get_mbi_attribute_list(path):
663663
attribute_list = []
664-
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
664+
for mbean_attribute_info in wlst_helper.get_mbi(path).getAttributes():
665665
if _is_attribute(mbean_attribute_info):
666666
attribute_list.append(mbean_attribute_info.getName())
667667
return attribute_list
@@ -705,7 +705,7 @@ def _massage_online_folders(lsc_folders):
705705
location = wlst_helper.get_pwd()
706706
folder_list = []
707707
mbi_folder_list = []
708-
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
708+
for mbean_attribute_info in wlst_helper.get_mbi(location).getAttributes():
709709
if _is_containment(mbean_attribute_info):
710710
mbi_folder_list.append(mbean_attribute_info.getName())
711711
for lsc_folder in lsc_folders:

core/src/main/python/wlsdeploy/tool/discover/jms_resources_discoverer.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,14 @@ def _get_group_params(self, location):
321321
class_name=_class_name, method_name=_method_name)
322322
else:
323323
group_param_name = attributes[wlst_subdeployment]
324-
_logger.finer('WLSDPLY-06487', group_param_name, self._alias_helper.get_model_folder_path(location),
325-
class_name=_class_name, method_name=_method_name)
326-
subfolder_result[group_param_name] = OrderedDict()
327-
self._populate_model_parameters(subfolder_result[group_param_name], location)
324+
if group_param_name is None:
325+
_logger.warning('WLSDPLY-06486', folder_name, self._alias_helper.get_model_folder_path(location),
326+
class_name=_class_name, method_name=_method_name)
327+
else:
328+
_logger.finer('WLSDPLY-06487', group_param_name, self._alias_helper.get_model_folder_path(location),
329+
class_name=_class_name, method_name=_method_name)
330+
subfolder_result[group_param_name] = OrderedDict()
331+
self._populate_model_parameters(subfolder_result[group_param_name], location)
328332
location.remove_name_token(name_token)
329333
location.pop_location()
330334
_logger.exiting(class_name=_class_name, method_name=_method_name, result=subfolder_result)

0 commit comments

Comments
 (0)