Skip to content

Commit

Permalink
Report Client and Quiet mode don't work together (issue #1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Sep 9, 2017
2 parents 90a36aa + 372d3fa commit 4a0e175
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
3 changes: 1 addition & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Glances Version 2
Version 2.11.1
==============

Bugs corrected:

* [WebUI] Sensors not showing on Web (issue #1142)
* Client and Quiet mode don't work together (issue #1139)

Version 2.11
============
Expand Down
22 changes: 17 additions & 5 deletions glances/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, config=None, args=None, timeout=7, return_to_browser=False):
# Store the arg/config
self.args = args
self.config = config
# Quiet mode
self._quiet = args.quiet

# Default client mode
self._client_mode = 'glances'
Expand All @@ -70,6 +72,10 @@ def __init__(self, config=None, args=None, timeout=7, return_to_browser=False):
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:
Expand Down Expand Up @@ -167,7 +173,11 @@ def login(self):
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
Expand Down Expand Up @@ -237,9 +247,10 @@ def serve_forever(self):
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)
Expand All @@ -251,4 +262,5 @@ def serve_forever(self):

def end(self):
"""End of the client session."""
self.screen.end()
if not self.quiet:
self.screen.end()

0 comments on commit 4a0e175

Please sign in to comment.