summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/subcmds.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2018-01-23 15:56:45 +0530
committerKotresh HR <khiremat@redhat.com>2018-01-26 16:08:27 +0000
commit5d3c90d14839fc134580a4ff944d68f3ff3c605a (patch)
treeb921d60d61d4566832a81a19654db0819ebfafa5 /geo-replication/syncdaemon/subcmds.py
parentc3647b747af88e40334e927dafdbf88154b308f0 (diff)
geo-rep: Detailed JSON output for config
JSON output of `config-get` command now returns in the following format { "name": CONFIG_NAME, "value": CONFIG_VALUE, "default_value": DEFAULT_VALUE, # Only if modified == true "configurable": true|false, "modified": true|false } Change-Id: I6193de48cd33655df7ecef5a0d83d7cb147089cf Fixes: #361 Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/subcmds.py')
-rw-r--r--geo-replication/syncdaemon/subcmds.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/geo-replication/syncdaemon/subcmds.py b/geo-replication/syncdaemon/subcmds.py
index 258dbb0b658..1b306ad5b62 100644
--- a/geo-replication/syncdaemon/subcmds.py
+++ b/geo-replication/syncdaemon/subcmds.py
@@ -243,21 +243,29 @@ def subcmd_config_get(args):
sys.stderr.write("Invalid config name \"%s\"\n" % args.name)
sys.exit(ERROR_CONFIG_INVALID)
- print_config(args.name, val, only_value=args.only_value,
+ print_config(args.name, val["value"], only_value=args.only_value,
use_underscore=args.use_underscore)
return
if args.json:
- out = {}
+ out = []
# Convert all values as string
- for k, v in all_config.items():
- out[k] = str(v)
+ for k in sorted(all_config):
+ v = all_config[k]
+ out.append({
+ "name": k,
+ "value": str(v["value"]),
+ "default": str(v["default"]),
+ "configurable": v["configurable"],
+ "modified": v["modified"]
+ })
print(json.dumps(out))
return
for k in sorted(all_config):
- print_config(k, all_config[k], use_underscore=args.use_underscore)
+ print_config(k, all_config[k]["value"],
+ use_underscore=args.use_underscore)
def subcmd_config_check(args):