Skip to content

Commit 088b5bf

Browse files
authored
Remove machine references from server templates in model filter (#1137)
1 parent eb1a3cf commit 088b5bf

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

core/src/main/python/wlsdeploy/tool/util/filters/wko_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def filter_topology(model, _model_context):
181181
auto_migration_enabled = server_template[AUTO_MIGRATION_ENABLED]
182182
if auto_migration_enabled is None or alias_utils.convert_boolean(auto_migration_enabled):
183183
server_template[AUTO_MIGRATION_ENABLED] = PyRealBoolean(False)
184-
for delete_key in [SERVER_START]:
184+
for delete_key in [MACHINE, SERVER_START]:
185185
if delete_key in server_template:
186186
del server_template[delete_key]
187187

core/src/test/python/wlsdeploy/tool/util/filters/wko_filter_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
from wlsdeploy.aliases.model_constants import RESOURCES
2020
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
2121
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
22+
from wlsdeploy.aliases.model_constants import SERVER
23+
from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
2224
from wlsdeploy.aliases.model_constants import TOPOLOGY
2325
from wlsdeploy.aliases.model_constants import VIRTUAL_TARGET
2426
from wlsdeploy.tool.util.filters import wko_filter
@@ -78,6 +80,12 @@ def testFilter(self):
7880
self._no_dictionary_key(topology, MACHINE)
7981
self._no_dictionary_key(topology, VIRTUAL_TARGET)
8082

83+
server_1 = self._traverse(model, TOPOLOGY, SERVER, 'm1')
84+
self._no_dictionary_key(server_1, MACHINE)
85+
86+
template_1 = self._traverse(model, TOPOLOGY, SERVER_TEMPLATE, 'template-1')
87+
self._no_dictionary_key(template_1, MACHINE)
88+
8189
# Partition and resource elements should be removed from the model
8290

8391
resources = self._traverse(model, RESOURCES)

core/src/test/resources/prepare/wko-filter.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,22 @@ topology:
3131
m1:
3232
Cluster: staticCluster
3333
ListenPort: 5001
34+
Machine: "machine-1"
3435
m2:
3536
Cluster: staticCluster
3637
# string value should match numeric value
3738
ListenPort: "5001"
39+
Machine: "machine-1"
3840
m3:
3941
Cluster: staticCluster
4042
# this should cause a warning message
4143
ListenPort: 5002
44+
Machine: "machine-1"
45+
ServerTemplate:
46+
'template-1':
47+
Machine: "machine-1"
4248
Machine:
49+
# this machine and any references to it should be removed
4350
machine-1:
4451
VirtualTarget:
4552
target-2:

0 commit comments

Comments
 (0)