summaryrefslogtreecommitdiff
path: root/trove/common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'trove/common/utils.py')
-rw-r--r--trove/common/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/trove/common/utils.py b/trove/common/utils.py
index bbddef87..e11a66c7 100644
--- a/trove/common/utils.py
+++ b/trove/common/utils.py
@@ -17,6 +17,7 @@
from collections import abc
import inspect
import os
+import shlex
import shutil
import uuid
import urllib.parse as urlparse
@@ -423,3 +424,13 @@ def req_to_text(req):
parts.extend([b'', safe_encode(req.body)])
return b'\r\n'.join(parts).decode(req.charset)
+
+
+def validate_command(string):
+ """
+ Check if the string is legal for command
+
+ raise invalidvalue if illegal
+ """
+ if string != shlex.quote(string):
+ raise exception.InvalidValue(value=string)