Skip to content

Remove machine references from server templates in model filter #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def filter_topology(model, _model_context):
auto_migration_enabled = server_template[AUTO_MIGRATION_ENABLED]
if auto_migration_enabled is None or alias_utils.convert_boolean(auto_migration_enabled):
server_template[AUTO_MIGRATION_ENABLED] = PyRealBoolean(False)
for delete_key in [SERVER_START]:
for delete_key in [MACHINE, SERVER_START]:
if delete_key in server_template:
del server_template[delete_key]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from wlsdeploy.aliases.model_constants import RESOURCES
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION
from wlsdeploy.aliases.model_constants import SERVER
from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
from wlsdeploy.aliases.model_constants import TOPOLOGY
from wlsdeploy.aliases.model_constants import VIRTUAL_TARGET
from wlsdeploy.tool.util.filters import wko_filter
Expand Down Expand Up @@ -78,6 +80,12 @@ def testFilter(self):
self._no_dictionary_key(topology, MACHINE)
self._no_dictionary_key(topology, VIRTUAL_TARGET)

server_1 = self._traverse(model, TOPOLOGY, SERVER, 'm1')
self._no_dictionary_key(server_1, MACHINE)

template_1 = self._traverse(model, TOPOLOGY, SERVER_TEMPLATE, 'template-1')
self._no_dictionary_key(template_1, MACHINE)

# Partition and resource elements should be removed from the model

resources = self._traverse(model, RESOURCES)
Expand Down
7 changes: 7 additions & 0 deletions core/src/test/resources/prepare/wko-filter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@ topology:
m1:
Cluster: staticCluster
ListenPort: 5001
Machine: "machine-1"
m2:
Cluster: staticCluster
# string value should match numeric value
ListenPort: "5001"
Machine: "machine-1"
m3:
Cluster: staticCluster
# this should cause a warning message
ListenPort: 5002
Machine: "machine-1"
ServerTemplate:
'template-1':
Machine: "machine-1"
Machine:
# this machine and any references to it should be removed
machine-1:
VirtualTarget:
target-2:
Expand Down