diff options
author | Aravinda VK <avishwan@redhat.com> | 2017-11-23 15:28:07 +0530 |
---|---|---|
committer | Aravinda VK <avishwan@redhat.com> | 2017-11-24 13:59:24 +0000 |
commit | d395387f601c9fb57a5fd9f19385b4de3c870de8 (patch) | |
tree | 522bc9fc7bdecddb90ce84deab5103745ca2b7b4 /geo-replication/syncdaemon/gsyncdstatus.py | |
parent | cd27e0ffb8afd69c1df28c38808c49a3af8cc75d (diff) |
geo-rep: JSON output for status and config
For Glusterd2 integration, JSON output of status and config
is very useful from gsyncd
Fixes: #361
Change-Id: I53c61f19033ad4ac601ea49469e4e7c7c8e9af3d
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/gsyncdstatus.py')
-rw-r--r-- | geo-replication/syncdaemon/gsyncdstatus.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py index 38ca92c73a9..1df24330438 100644 --- a/geo-replication/syncdaemon/gsyncdstatus.py +++ b/geo-replication/syncdaemon/gsyncdstatus.py @@ -399,6 +399,15 @@ class GeorepStatus(object): return data - def print_status(self, checkpoint_time=0): - for key, value in self.get_status(checkpoint_time).items(): + def print_status(self, checkpoint_time=0, json_output=False): + status_out = self.get_status(checkpoint_time) + if json_output: + out = {} + # Convert all values as string + for k, v in status_out.items(): + out[k] = str(v) + print json.dumps(out) + return + + for key, value in status_out.items(): print ("%s: %s" % (key, value)) |