提交 372d3faf 编写于 作者: N nicolargo

Client and Quiet mode don't work together (issue #1139)

上级 042c1460
...@@ -5,7 +5,8 @@ Glances Version 2 ...@@ -5,7 +5,8 @@ Glances Version 2
Version 2.11.1 Version 2.11.1
============== ==============
* ... * [WebUI] Sensors not showing on Web (issue #1142)
* Client and Quiet mode don't work together (issue #1139)
Version 2.11 Version 2.11
============ ============
......
...@@ -46,6 +46,8 @@ class GlancesClient(object): ...@@ -46,6 +46,8 @@ class GlancesClient(object):
# Store the arg/config # Store the arg/config
self.args = args self.args = args
self.config = config self.config = config
# Quiet mode
self._quiet = args.quiet
# Default client mode # Default client mode
self._client_mode = 'glances' self._client_mode = 'glances'
...@@ -70,6 +72,10 @@ class GlancesClient(object): ...@@ -70,6 +72,10 @@ class GlancesClient(object):
except Exception as e: except Exception as e:
self.log_and_exit("Client couldn't create socket {}: {}".format(self.uri, e)) self.log_and_exit("Client couldn't create socket {}: {}".format(self.uri, e))
@property
def quiet(self):
return self._quiet
def log_and_exit(self, msg=''): def log_and_exit(self, msg=''):
"""Log and exit.""" """Log and exit."""
if not self.return_to_browser: if not self.return_to_browser:
...@@ -167,7 +173,11 @@ class GlancesClient(object): ...@@ -167,7 +173,11 @@ class GlancesClient(object):
self.stats.load_limits(self.config) self.stats.load_limits(self.config)
# Init screen # Init screen
self.screen = GlancesCursesClient(config=self.config, args=self.args) if self.quiet:
# In quiet mode, nothing is displayed
logger.info("Quiet mode is ON: Nothing will be displayed")
else:
self.screen = GlancesCursesClient(config=self.config, args=self.args)
# Return True: OK # Return True: OK
return True return True
...@@ -237,9 +247,10 @@ class GlancesClient(object): ...@@ -237,9 +247,10 @@ class GlancesClient(object):
cs_status = self.update() cs_status = self.update()
# Update the screen # Update the screen
exitkey = self.screen.update(self.stats, if not self.quiet:
cs_status=cs_status, exitkey = self.screen.update(self.stats,
return_to_browser=self.return_to_browser) cs_status=cs_status,
return_to_browser=self.return_to_browser)
# Export stats using export modules # Export stats using export modules
self.stats.export(self.stats) self.stats.export(self.stats)
...@@ -251,4 +262,5 @@ class GlancesClient(object): ...@@ -251,4 +262,5 @@ class GlancesClient(object):
def end(self): def end(self):
"""End of the client session.""" """End of the client session."""
self.screen.end() if not self.quiet:
self.screen.end()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册