mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-01 22:14:06 +03:00
Allow user to run browser without Zeroconf
This commit is contained in:
parent
bd768aa4da
commit
6105c493e0
@ -141,29 +141,32 @@ class GlancesAutoDiscoverServer(object):
|
|||||||
try:
|
try:
|
||||||
self.zeroconf = Zeroconf()
|
self.zeroconf = Zeroconf()
|
||||||
except socker.error as e:
|
except socker.error as e:
|
||||||
logger.critical("Can not start Zeroconf (%s)" % e)
|
logger.error("Can not start Zeroconf (%s)" % e)
|
||||||
sys.exit(2)
|
self.zeroconf_enable_tag = False
|
||||||
self.listener = GlancesAutoDiscoverListener()
|
else:
|
||||||
self.browser = ServiceBrowser(
|
self.listener = GlancesAutoDiscoverListener()
|
||||||
self.zeroconf, zeroconf_type, self.listener)
|
self.browser = ServiceBrowser(
|
||||||
|
self.zeroconf, zeroconf_type, self.listener)
|
||||||
|
self.zeroconf_enable_tag = True
|
||||||
else:
|
else:
|
||||||
logger.critical(
|
logger.error(
|
||||||
"Can not start autodiscover mode (Zeroconf lib is not installed)")
|
"Can not start autodiscover mode (Zeroconf lib is not installed)")
|
||||||
sys.exit(2)
|
self.zeroconf_enable_tag = False
|
||||||
|
|
||||||
def get_servers_list(self):
|
def get_servers_list(self):
|
||||||
"""Return the current server list (dict of dict)"""
|
"""Return the current server list (dict of dict)"""
|
||||||
if zeroconf_tag:
|
if zeroconf_tag and self.zeroconf_enable_tag:
|
||||||
return self.listener.get_servers_list()
|
return self.listener.get_servers_list()
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def set_server(self, server_pos, key, value):
|
def set_server(self, server_pos, key, value):
|
||||||
"""Set the key to the value for the server_pos (position in the list)"""
|
"""Set the key to the value for the server_pos (position in the list)"""
|
||||||
self.listener.set_server(server_pos, key, value)
|
if zeroconf_tag and self.zeroconf_enable_tag:
|
||||||
|
self.listener.set_server(server_pos, key, value)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if zeroconf_tag:
|
if zeroconf_tag and self.zeroconf_enable_tag:
|
||||||
self.zeroconf.close()
|
self.zeroconf.close()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user