Skip to content

Commit 0685bb4

Browse files
authored
Remove deprecated "named object list" format for kubernetes model section (#1351)
1 parent c230e26 commit 0685bb4

File tree

5 files changed

+3
-91
lines changed

5 files changed

+3
-91
lines changed

core/src/main/python/wlsdeploy/tool/util/targets/crd_file_updater.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2022, Oracle Corporation and/or its affiliates.
2+
Copyright (c) 2022, 2023, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
55
Methods to update an output file with information from the kubernetes section of the model.
@@ -205,10 +205,6 @@ def _update_dictionary(output_dictionary, model_dictionary, schema_folder, schem
205205
property_folder = properties[key]
206206
element_type = schema_helper.get_type(property_folder)
207207

208-
# deprecated "named object list" format
209-
value = _check_named_object_list(value, element_type, property_folder, schema_path, key, model_crd_folder)
210-
# end deprecated
211-
212208
value = _convert_value(value, element_type)
213209

214210
if isinstance(value, dict):
@@ -299,38 +295,6 @@ def _convert_value(model_value, type_name):
299295
return model_value
300296

301297

302-
# *** DELETE METHOD WHEN deprecated "named object list" IS REMOVED ***
303-
def _check_named_object_list(model_value, type_name, schema_folder, schema_path, key, model_crd_folder):
304-
"""
305-
Convert specified model value to an object list if it uses deprecated "named object list" format.
306-
:param model_value: the value to be checked
307-
:param type_name: the schema type name of the value
308-
:param schema_folder: the schema for the value being checked
309-
:param schema_path: used for schema_helper key lookup
310-
:param key: used for schema_helper key lookup
311-
:param model_crd_folder: required for object list matching
312-
:return: the converted value
313-
"""
314-
if type_name == 'array' and isinstance(model_value, dict):
315-
object_list = list()
316-
next_schema_path = schema_helper.append_path(schema_path, key)
317-
list_key = model_crd_folder.get_object_list_key(next_schema_path)
318-
item_info = schema_helper.get_array_item_info(schema_folder)
319-
properties = schema_helper.get_properties(item_info)
320-
321-
for model_key, model_object in model_value.items():
322-
new_object = model_object.copy()
323-
324-
# see if the model name should become an attribute in the new object
325-
if (list_key in properties.keys()) and (list_key not in new_object.keys()):
326-
new_object[list_key] = model_key
327-
328-
object_list.append(new_object)
329-
return object_list
330-
331-
return model_value
332-
333-
334298
def _add_domain_comments(wko_dictionary):
335299
"""
336300
Add relevant comments to the domain CRD dictionary to provide additional information.

core/src/main/python/wlsdeploy/tool/validate/kubernetes_validator.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2020, 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2020, 2023, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55

@@ -133,16 +133,6 @@ def _validate_object_array(self, model_value, property_map, schema_path, model_p
133133
"""
134134
_method_name = '_validate_object_array'
135135

136-
# deprecated "named object list" format
137-
if isinstance(model_value, dict):
138-
self._logger.warning("WLSDPLY-05091", model_path, class_name=self._class_name, method_name=_method_name)
139-
for name in model_value:
140-
object_map = model_value[name]
141-
next_model_path = model_path + "/" + name
142-
self.validate_folder(object_map, property_map, schema_path, next_model_path)
143-
return
144-
# end deprecated
145-
146136
if not isinstance(model_value, list):
147137
self._logger.severe("WLSDPLY-05040", model_path, class_name=self._class_name, method_name=_method_name)
148138
return

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ WLSDPLY-05040=Expected a list of objects in model location {0}
514514

515515
# wlsdeploy/tool/validate/kubernetes_validator.py
516516
WLSDPLY-05090=Model folder {0} is not supported, will be skipped
517-
WLSDPLY-05091=Model folder {0} uses deprecated "named object list" format, should be a hyphenated object list
518517

519518
# wlsdeploy/tools/validate/validation_utils.py
520519
WLSDPLY-05300=NOT USED

core/src/test/python/wlsdeploy/tool/extract/extract_test.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2021, 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2021, 2023, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import os
@@ -86,26 +86,6 @@ def testKubernetesModel(self):
8686
self._match_values("Secret 0", secret_list[0], 'secret-1')
8787
self._match_values("Secret 1", secret_list[1], 'secret-2')
8888

89-
# deprecated
90-
def testNamedObjectListModel(self):
91-
"""
92-
Test that fields using the deprecated "named object list" in the kubernetes section of the model
93-
are transferred to the resulting domain resource file
94-
"""
95-
resource = self._extract_domain_resource('3')
96-
97-
# serverPod/env from the kubernetes section should be in the domain resource file
98-
env_list = self._traverse(resource, 'spec', 'serverPod', 'env')
99-
self._match_values("Env count", len(env_list), 2)
100-
self._match_values("Env 0", env_list[0]['name'], 'JAVA_OPTIONS')
101-
self._match_values("Env 1", env_list[1]['name'], 'USER_MEM_ARGS')
102-
103-
# clusters from kubernetes section should be in the domain resource file
104-
cluster_list = self._traverse(resource, 'spec', 'clusters')
105-
self._match_values("Cluster count", len(cluster_list), 2)
106-
self._match_values("Cluster 0 clusterName", cluster_list[0]['clusterName'], 'CLUSTER_1')
107-
self._match_values("Cluster 1 clusterName", cluster_list[1]['clusterName'], 'CLUSTER_2')
108-
10989
def _extract_domain_resource(self, suffix):
11090
model_file = os.path.join(self.MODELS_DIR, 'model-' + suffix + '.yaml')
11191
translator = FileToPython(model_file, use_ordering=True)

core/src/test/resources/extract/model-3.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)