From d5d85325dd5a331157be83773c78a3b325f13792 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 15 Jul 2016 17:39:43 +0200 Subject: [PATCH] Correct two issues with latest Zeroconf version (issue #888 and #889) --- NEWS | 4 +++- glances/autodiscover.py | 6 ++++-- glances/outputs/glances_curses.py | 2 +- glances/server.py | 5 +++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 7f397a27..af03b6bf 100644 --- a/NEWS +++ b/NEWS @@ -38,7 +38,9 @@ Bugs corrected: * On Windows, Glances try to display unexisting Load stats (issue #871) * Check CPU info (issue #881) * Unicode error on processlist on Windows server 2008 (french) (issue #886) - * PermissionError/OSError when starting glances (issue #885) + * PermissionError/OSError when starting glances (issue #885) + * Zeroconf problem with zeroconf_type = "_%s._tcp." % __appname__ (issue #888) + * Zeroconf problem with zeroconf service name (issue #889) * Top 3 processes are back in the alert summary Code quality follow up: from 5.93 to 6.24 (source: https://scrutinizer-ci.com/g/nicolargo/glances) diff --git a/glances/autodiscover.py b/glances/autodiscover.py index e7c9de45..3e501253 100644 --- a/glances/autodiscover.py +++ b/glances/autodiscover.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2015 Nicolargo +# Copyright (C) 2016 Nicolargo # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -47,7 +47,9 @@ if zeroconf_tag: sys.exit(1) # Global var -zeroconf_type = "_%s._tcp." % __appname__ +# Recent versions of the zeroconf python package doesnt like a zeroconf type that ends with '._tcp.'. +# Correct issue: zeroconf problem with zeroconf_type = "_%s._tcp." % __appname__ #888 +zeroconf_type = "_%s._tcp.local." % __appname__ class AutoDiscovered(object): diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index e462cc4f..892125a8 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -104,7 +104,7 @@ class _GlancesCurses(object): def load_config(self, config): '''Load the outputs section of the configuration file''' # Load the theme - if config.has_section('outputs'): + if config is not None and config.has_section('outputs'): logger.debug('Read the outputs section in the configuration file') self.theme['name'] = config.get_value('outputs', 'curse_theme', default='black') logger.debug('Theme for the curse interface: {}'.format(self.theme['name'])) diff --git a/glances/server.py b/glances/server.py index be3f7729..3bf41e75 100644 --- a/glances/server.py +++ b/glances/server.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2015 Nicolargo +# Copyright (C) 2016 Nicolargo # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -207,7 +207,8 @@ class GlancesServer(object): if not self.args.disable_autodiscover: # Note: The Zeroconf service name will be based on the hostname - self.autodiscover_client = GlancesAutoDiscoverClient(socket.gethostname(), args) + # Correct issue: Zeroconf problem with zeroconf service name #889 + self.autodiscover_client = GlancesAutoDiscoverClient(socket.gethostname().split('.', 1)[0], args) else: logger.info("Glances autodiscover announce is disabled")