summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2017-09-09 10:19:32 +0200
committernicolargo <nicolas@nicolargo.com>2017-09-09 10:19:32 +0200
commit372d3faf79ddd4cf86b4fb2162ae871e8013582a (patch)
treeab19c5f6bc61bed57738fb612a9a441a9d8b3d11
parent042c14608af6200a738e7e89da3e55ff443898a0 (diff)
Client and Quiet mode don't work together (issue #1139)
-rw-r--r--NEWS3
-rw-r--r--glances/client.py22
2 files changed, 19 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index a1761154..816a0938 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,8 @@ Glances Version 2
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
============
diff --git a/glances/client.py b/glances/client.py
index f58f55e3..29b54256 100644
--- a/glances/client.py
+++ b/glances/client.py
@@ -46,6 +46,8 @@ class GlancesClient(object):
# Store the arg/config
self.args = args
self.config = config
+ # Quiet mode
+ self._quiet = args.quiet
# Default client mode
self._client_mode = 'glances'
@@ -70,6 +72,10 @@ class GlancesClient(object):
except Exception as 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=''):
"""Log and exit."""
if not self.return_to_browser:
@@ -167,7 +173,11 @@ class GlancesClient(object):
self.stats.load_limits(self.config)
# 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
@@ -237,9 +247,10 @@ class GlancesClient(object):
cs_status = self.update()
# Update the screen
- exitkey = self.screen.update(self.stats,
- cs_status=cs_status,
- return_to_browser=self.return_to_browser)
+ if not self.quiet:
+ exitkey = self.screen.update(self.stats,
+ cs_status=cs_status,
+ return_to_browser=self.return_to_browser)
# Export stats using export modules
self.stats.export(self.stats)
@@ -251,4 +262,5 @@ class GlancesClient(object):
def end(self):
"""End of the client session."""
- self.screen.end()
+ if not self.quiet:
+ self.screen.end()