summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osprofiler/cmd/commands.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/osprofiler/cmd/commands.py b/osprofiler/cmd/commands.py
index bc3de7e..df92a56 100644
--- a/osprofiler/cmd/commands.py
+++ b/osprofiler/cmd/commands.py
@@ -36,7 +36,6 @@ class TraceCommands(BaseCommand):
@cliutils.arg("trace", help="File with trace or trace id")
@cliutils.arg("--connection-string", dest="conn_str",
default=(cliutils.env("OSPROFILER_CONNECTION_STRING")),
- required=True,
help="Storage driver's connection string. Defaults to "
"env[OSPROFILER_CONNECTION_STRING] if set")
@cliutils.arg("--transport-url", dest="transport_url",
@@ -59,6 +58,12 @@ class TraceCommands(BaseCommand):
def show(self, args):
"""Display trace results in HTML, JSON or DOT format."""
+ if not args.conn_str:
+ raise exc.CommandError(
+ "You must provide connection string via"
+ " either --connection-string or "
+ "via env[OSPROFILER_CONNECTION_STRING]")
+
trace = None
if not uuidutils.is_uuid_like(args.trace):
@@ -156,7 +161,6 @@ class TraceCommands(BaseCommand):
@cliutils.arg("--connection-string", dest="conn_str",
default=cliutils.env("OSPROFILER_CONNECTION_STRING"),
- required=True,
help="Storage driver's connection string. Defaults to "
"env[OSPROFILER_CONNECTION_STRING] if set")
@cliutils.arg("--error-trace", dest="error_trace",
@@ -164,6 +168,11 @@ class TraceCommands(BaseCommand):
help="List all traces that contain error.")
def list(self, args):
"""List all traces"""
+ if not args.conn_str:
+ raise exc.CommandError(
+ "You must provide connection string via"
+ " either --connection-string or "
+ "via env[OSPROFILER_CONNECTION_STRING]")
try:
engine = base.get_driver(args.conn_str, **args.__dict__)
except Exception as e: