summaryrefslogtreecommitdiff
path: root/openstackclient/api
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/api')
-rw-r--r--openstackclient/api/object_store_v1.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py
index 74c4a46f..31033525 100644
--- a/openstackclient/api/object_store_v1.py
+++ b/openstackclient/api/object_store_v1.py
@@ -16,6 +16,7 @@
import io
import logging
import os
+import sys
from osc_lib import utils
import six
@@ -376,12 +377,16 @@ class APIv1(api.BaseAPI):
stream=True,
)
if response.status_code == 200:
- if not os.path.exists(os.path.dirname(file)):
- if len(os.path.dirname(file)) > 0:
- os.makedirs(os.path.dirname(file))
- with open(file, 'wb') as f:
+ if file == '-':
for chunk in response.iter_content(64 * 1024):
- f.write(chunk)
+ sys.stdout.write(chunk)
+ else:
+ if not os.path.exists(os.path.dirname(file)):
+ if len(os.path.dirname(file)) > 0:
+ os.makedirs(os.path.dirname(file))
+ with open(file, 'wb') as f:
+ for chunk in response.iter_content(64 * 1024):
+ f.write(chunk)
def object_set(
self,