Skip to content

Commit 2f256c2

Browse files
committed
[sesman] Simplify internal module management
Internal modules loading with sesman was a bit fuzzy. It is now simplified: - service should have the name INTERNAL - target_host field should have the name of the module
1 parent d583c60 commit 2f256c2

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

tools/sesman/sesmanworker/engine.py

-11
Original file line numberDiff line numberDiff line change
@@ -647,17 +647,6 @@ def get_targets_list(self, group_filter: str, device_filter: str, protocol_filte
647647
for target_info in self.displaytargets:
648648
temp_service_login = target_info.service_login
649649
temp_resource_service_protocol_cn = target_info.protocol
650-
if target_info.protocol != "APP" \
651-
and target_info.target_name in {'autotest',
652-
'bouncer2',
653-
'widget2_message',
654-
'widgettest',
655-
'card',
656-
}:
657-
temp_service_login = target_info.service_login.replace(
658-
':RDP',
659-
':INTERNAL', 1)
660-
temp_resource_service_protocol_cn = 'INTERNAL'
661650

662651
if (fc(group_filter) not in fc(target_info.group)
663652
or fc(protocol_filter) not in fc(temp_resource_service_protocol_cn)):

tools/sesman/sesmanworker/sesman.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
MAGICASK = ('UNLIKELYVALUEMAGICASPICONSTANTS'
7373
'3141592926ISUSEDTONOTIFYTHEVALUEMUSTBEASKED')
7474

75+
MAGIC_INTERNAL_SERVICE = 'INTERNAL'
7576
KEEPALIVE_INTERVAL = 30
7677
KEEPALIVE_GRACEDELAY = 30
7778
KEEPALIVE_TIMEOUT = KEEPALIVE_INTERVAL + KEEPALIVE_GRACEDELAY
@@ -1085,7 +1086,9 @@ def get_service(self) -> Tuple[Union[None, bool], str]:
10851086
'target_service': self.target_service_name,
10861087
}
10871088
if not self.internal_target:
1088-
self.internal_target = (self.target_service_name == 'INTERNAL')
1089+
self.internal_target = (
1090+
self.target_service_name == MAGIC_INTERNAL_SERVICE
1091+
)
10891092
self.send_data(data_to_send)
10901093
_status = True
10911094
elif self.shared.get('selector') == MAGICASK:
@@ -1242,7 +1245,9 @@ def get_service(self) -> Tuple[Union[None, bool], str]:
12421245
data_to_send['target_service'] = service_name
12431246
self._full_user_device_account = f"{target_login}@{device_name}:{wab_login}"
12441247
if not self.internal_target:
1245-
self.internal_target = (s[2] == 'INTERNAL')
1248+
self.internal_target = (
1249+
service_name == MAGIC_INTERNAL_SERVICE
1250+
)
12461251
self.send_data(data_to_send)
12471252
self.target_service_name = service_name
12481253
self.target_group = s[0]
@@ -1391,10 +1396,7 @@ def select_target(self) -> Tuple[Any, bool, str]:
13911396
selected_target = None
13921397
target_device = self.shared.get('target_device')
13931398
target_login = self.shared.get('target_login')
1394-
target_service = (
1395-
self.target_service_name if self.target_service_name != 'INTERNAL'
1396-
else 'RDP'
1397-
)
1399+
target_service = self.target_service_name
13981400
target_group = self.target_group
13991401

14001402
Logger().info(f"selected target ==> {target_login} {target_device} {target_service}")
@@ -1837,7 +1839,7 @@ def connect_to_target(self, selected_target) -> Tuple[Union[None, bool], str]:
18371839

18381840
if _status:
18391841
module = kv.get('proto_dest')
1840-
if module not in {'RDP', 'VNC', 'INTERNAL'}:
1842+
if module not in {'RDP', 'VNC'}:
18411843
module = 'RDP'
18421844
if self.internal_target:
18431845
module = 'INTERNAL'

0 commit comments

Comments
 (0)