Skip to content

Commit 40790fb

Browse files
committed
Create internal WKO filter and invoke it for known targets
1 parent c6d9d11 commit 40790fb

File tree

6 files changed

+48
-5
lines changed

6 files changed

+48
-5
lines changed

core/src/main/python/wlsdeploy/tool/util/filter_helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2021, Oracle Corporation and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import imp
66
import os
77
import sys
88

99
from wlsdeploy.logging.platform_logger import PlatformLogger
10+
from wlsdeploy.tool.util.filters import wko_filter
1011
from wlsdeploy.util import dictionary_utils
1112
from wlsdeploy.util import path_utils
1213
from wlsdeploy.util.model_translator import FileToPython
@@ -17,7 +18,7 @@
1718
TARGET_CONFIG_TOKEN = '@@TARGET_CONFIG_DIR@@'
1819

1920
__id_filter_map = {
20-
# 'filterId': filter_method
21+
'wko_filter': wko_filter.filter_model
2122
}
2223

2324

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
Copyright (c) 2021, Oracle Corporation and/or its affiliates.
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
"""
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2021, Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
#
4+
# ------------
5+
# Description:
6+
# ------------
7+
# WDT filters to prepare a model for use with WKO, using the createDomain or prepareModel tools.
8+
# These operations can be invoked as a single call, or independently of each other.
9+
10+
def filter_model(model):
11+
"""
12+
Perform the following operations on the specified model:
13+
- Remove any online-only attributes
14+
- Check if servers in a cluster have different ports
15+
:param model: the model to be filtered
16+
"""
17+
filter_online_attributes(model)
18+
check_clustered_server_ports(model)
19+
20+
21+
def filter_online_attributes(model):
22+
"""
23+
Remove any online-only attributes from the specified model.
24+
:param model: the model to be filtered
25+
"""
26+
print("\n\nFILTER ONLINE ATTRIBUTES")
27+
28+
29+
def check_clustered_server_ports(model):
30+
"""
31+
Set the CalculatedListenPorts attribute to false for dynamic clusters in the specified model.
32+
Warn if servers in a static cluster have different ports in the specified model.
33+
:param model: the model to be filtered
34+
"""
35+
print("\n\nCHECK_CLUSTERED SERVER PORTS")

core/src/main/targetconfigs/k8s/target.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "k8s_prep", "path": "@@TARGET_CONFIG_DIR@@/k8s_operator_filter.py" }
4+
{ "name": "k8s_prep", "path": "@@TARGET_CONFIG_DIR@@/k8s_operator_filter.py" },
5+
{ "id": "wko_filter" }
56
]
67
},
78
"variable_injectors" : {"PORT": {},"HOST": {},"URL": {}},

core/src/main/targetconfigs/vz/target.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "vz_prep", "path": "@@TARGET_CONFIG_DIR@@/vz_filter.py" }
4+
{ "name": "vz_prep", "path": "@@TARGET_CONFIG_DIR@@/vz_filter.py" },
5+
{ "id": "wko_filter" }
56
]
67
},
78
"variable_injectors" : {"PORT": {},"HOST": {},"URL": {}},

core/src/main/targetconfigs/wko/target.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"model_filters" : {
33
"discover": [
4-
{ "name": "wko_prep", "path": "@@TARGET_CONFIG_DIR@@/wko_operator_filter.py" }
4+
{ "name": "wko_prep", "path": "@@TARGET_CONFIG_DIR@@/wko_operator_filter.py" },
5+
{ "id": "wko_filter" }
56
]
67
},
78
"variable_injectors" : {"PORT": {},"HOST": {},"URL": {}},

0 commit comments

Comments
 (0)