diff options
Diffstat (limited to 'openstackclient/common/utils.py')
| -rw-r--r-- | openstackclient/common/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index d7702a3f..bc9ed264 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -249,3 +249,13 @@ def get_password(stdin): raise exceptions.CommandError("Error reading password.") raise exceptions.CommandError("There was a request to be prompted for a" " password and a terminal was not detected.") + + +def read_blob_file_contents(blob_file): + try: + with open(blob_file) as file: + blob = file.read().strip() + return blob + except IOError: + msg = "Error occurred trying to read from file %s" + raise exceptions.CommandError(msg % blob_file) |
