frappy cli returns now all frappy servers in subnet
only on instruments, not onlinse-c
This commit is contained in:
12
frappyman.py
12
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)
|
||||
|
||||
Reference in New Issue
Block a user