From 16cd31ccf5831a060fea1f6969a94e1b5a27e707 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 7 Jul 2025 17:54:02 +0200 Subject: [PATCH] frappy cli returns now all frappy servers in subnet only on instruments, not onlinse-c --- frappyman.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frappyman.py b/frappyman.py index 9605a41..b420560 100644 --- a/frappyman.py +++ b/frappyman.py @@ -24,6 +24,7 @@ import os import re import builtins from glob import glob +from socket import gethostbyname, gethostname from itertools import zip_longest from collections import defaultdict from os.path import join, isdir, basename, expanduser, exists @@ -219,6 +220,17 @@ class FrappyManager(ServiceManager): def do_cli(self, ins='', service=None): nodes = self.get_nodes(ins, service) from frappy.client.interactive import init, interact + from frappy.protocol.discovery import scan + if len(self.info) <= 2: + all_nodes = {} + for node in nodes: + host, port = node.split(':') + if host == 'localhost': + host = gethostname() + all_nodes[gethostbyname(host), int(port)] = node + for a in scan(): + all_nodes.setdefault((a.address, a.port), f'{a.hostname}:{a.port}') + nodes = list(all_nodes.values()) init(*nodes) try: interact(appname=ins)