Skip to content

Commit b0a64e6

Browse files
authored
backport change from OWLS-96280 to release 3.3 branch (#2784)
1 parent a5e260e commit b0a64e6

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

operator/src/main/resources/scripts/model_wdt_mii_filter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def getAdministrationPort(server, topology):
363363
def isAdministrationPortEnabledForServer(server, topology):
364364
administrationPortEnabled = False
365365
if 'AdministrationPortEnabled' in server:
366-
administrationPortEnabled = server['AdministrationPortEnabled'] == 'true'
366+
administrationPortEnabled = server['AdministrationPortEnabled']
367367
else:
368368
administrationPortEnabled = isAdministrationPortEnabledForDomain(topology)
369369
return administrationPortEnabled
@@ -373,7 +373,7 @@ def isAdministrationPortEnabledForDomain(topology):
373373
administrationPortEnabled = False
374374

375375
if 'AdministrationPortEnabled' in topology:
376-
administrationPortEnabled = topology['AdministrationPortEnabled'] == 'true'
376+
administrationPortEnabled = topology['AdministrationPortEnabled']
377377
else:
378378
# AdministrationPortEnabled is not explicitly set so going with the default
379379
# Starting with 14.1.2.0, the domain's AdministrationPortEnabled default is derived from the domain's SecureMode
@@ -385,11 +385,11 @@ def isAdministrationPortEnabledForDomain(topology):
385385
def isSecureModeEnabledForDomain(topology):
386386
secureModeEnabled = False
387387
if 'SecurityConfiguration' in topology and 'SecureMode' in topology['SecurityConfiguration'] and 'SecureModeEnabled' in topology['SecurityConfiguration']['SecureMode']:
388-
secureModeEnabled = topology['SecurityConfiguration']['SecureMode']['SecureModeEnabled'] == 'true'
388+
secureModeEnabled = topology['SecurityConfiguration']['SecureMode']['SecureModeEnabled']
389389
else:
390390
is_production_mode_enabled = False
391391
if 'ProductionModeEnabled' in topology:
392-
is_production_mode_enabled = topology['ProductionModeEnabled'] == 'true'
392+
is_production_mode_enabled = topology['ProductionModeEnabled']
393393
secureModeEnabled = is_production_mode_enabled and not env.wlsVersionEarlierThan("14.1.2.0")
394394
return secureModeEnabled
395395

@@ -429,7 +429,7 @@ def _get_ssl_listen_port(server):
429429
ssl = getSSLOrNone(server)
430430
ssl_listen_port = None
431431
model = env.getModel()
432-
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
432+
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
433433
ssl_listen_port = ssl['ListenPort']
434434
if ssl_listen_port is None:
435435
ssl_listen_port = "7002"
@@ -611,7 +611,7 @@ def customizeManagedIstioNetworkAccessPoint(template, listen_address):
611611
ssl = getSSLOrNone(template)
612612
ssl_listen_port = None
613613
model = env.getModel()
614-
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
614+
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
615615
ssl_listen_port = ssl['ListenPort']
616616
if ssl_listen_port is None:
617617
ssl_listen_port = "7002"
@@ -676,7 +676,7 @@ def addAdminChannelPortForwardNetworkAccessPoints(server):
676676

677677
ssl = getSSLOrNone(server)
678678
ssl_listen_port = None
679-
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
679+
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
680680
ssl_listen_port = ssl['ListenPort']
681681
if ssl_listen_port is None:
682682
ssl_listen_port = "7002"

operator/src/test/python/test_wdt_mii_filter.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,21 @@ def test_readDomainNameFromTopologyYaml(self):
294294
domain_name = model_wdt_mii_filter.env.getDomainName()
295295
self.assertEqual('wls-domain1', domain_name, "Expected domain name to be \'wls-domain1\'")
296296

297+
def test_isAdministrationPortEnabledForDomain(self):
298+
model = self.getModel()
299+
self.assertTrue(model_wdt_mii_filter.isAdministrationPortEnabledForDomain(model['topology']))
300+
301+
def test_isAdministrationPortEnabledForServer(self):
302+
model = self.getModel()
303+
304+
# disable Administration port for domain
305+
model['topology']['AdministrationPortEnabled'] = False
306+
307+
# enable Administration port for server
308+
model['topology']['Server']['admin-server']['AdministrationPortEnabled'] = True
309+
310+
self.assertTrue(model_wdt_mii_filter.isAdministrationPortEnabledForServer(model['topology']['Server']['admin-server'], model['topology']))
311+
297312
def test_istioVersionRequiresLocalHostBindings(self):
298313
model = self.getModel()
299314
self.assertTrue(model_wdt_mii_filter.istioVersionRequiresLocalHostBindings())

0 commit comments

Comments
 (0)