summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVipin Balachandran <vbala@vmware.com>2016-10-10 15:06:11 +0530
committerVipin Balachandran <vbala@vmware.com>2016-10-10 15:21:28 +0530
commitca4395caa8000339e31e55d5551c245cfea9f48c (patch)
tree47e1da469f029180c7075a4c4e4b7363e86bfd6a
parentcaff6c6fa20a2df24502aac800a983a5af586941 (diff)
downloadosprofiler-ca4395caa8000339e31e55d5551c245cfea9f48c.tar.gz
Use an env variable for connection string default
The user experience would be better if the connection string can be set as an environment variable while running the trace show command. This patch uses env[OSPROFILER_CONNECTION_STRING] as the default connection string if set. Change-Id: I816dceb05c4dad10897c965d7401a694d26a191a
-rw-r--r--osprofiler/cmd/commands.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/osprofiler/cmd/commands.py b/osprofiler/cmd/commands.py
index 2b6258f..99be83e 100644
--- a/osprofiler/cmd/commands.py
+++ b/osprofiler/cmd/commands.py
@@ -30,8 +30,11 @@ class TraceCommands(BaseCommand):
@cliutils.arg("trace", help="File with trace or trace id")
@cliutils.arg("--connection-string", dest="conn_str",
- default="ceilometer://",
- help="storage driver's connection string")
+ default=(cliutils.env("OSPROFILER_CONNECTION_STRING") or
+ "ceilometer://"),
+ help="Storage driver's connection string. Defaults to "
+ "env[OSPROFILER_CONNECTION_STRING] if set, else "
+ "ceilometer://")
@cliutils.arg("--json", dest="use_json", action="store_true",
help="show trace in JSON")
@cliutils.arg("--html", dest="use_html", action="store_true",