summaryrefslogtreecommitdiff
path: root/bin/swift
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@chmouel.com>2012-11-16 15:23:25 +1000
committerChmouel Boudjnah <chmouel@chmouel.com>2013-01-07 17:59:12 +0100
commitab4282ebb4affe637187245fb9d01a64359f1233 (patch)
treee622bf5c179913e747561082032ff1fa4c82b96c /bin/swift
parente93d47a930f6079547c668070665a85f731d332f (diff)
downloadpython-swiftclient-ab4282ebb4affe637187245fb9d01a64359f1233.tar.gz
Fix debug feature and add --debug to swift.
- Remove PYTHON_SWIFTCLIENT and use --debug making it more consistents with other openstack clients libraries. - Fix printing the curl command. - Don't show the body of the GET objects it could get bad on large objects and it's an iterator anyway. - Use -I for showing HEADs (and not -X HEAD). Change-Id: I954e7d3d795401fc3679725440dec36cdc80af87
Diffstat (limited to 'bin/swift')
-rwxr-xr-xbin/swift10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/swift b/bin/swift
index 7c942f4..772c82e 100755
--- a/bin/swift
+++ b/bin/swift
@@ -15,6 +15,7 @@
# limitations under the License.
import signal
import socket
+import logging
from errno import EEXIST, ENOENT
from hashlib import md5
@@ -1065,6 +1066,9 @@ Example:
default=False, help='Use SERVICENET internal network')
parser.add_option('-v', '--verbose', action='count', dest='verbose',
default=1, help='Print more info')
+ parser.add_option('--debug', action='store_true', dest='debug',
+ default=False, help='Show the curl commands of all http '
+ 'queries.')
parser.add_option('-q', '--quiet', action='store_const', dest='verbose',
const=0, default=1, help='Suppress status output')
parser.add_option('-A', '--auth', dest='auth',
@@ -1143,7 +1147,7 @@ Example:
parser.add_option('--os-endpoint-type',
metavar='<endpoint-type>',
default=environ.get('OS_ENDPOINT_TYPE'),
- help='Openstack Endpoint type. ' \
+ help='Openstack Endpoint type. '
'Defaults to env[OS_ENDPOINT_TYPE]')
parser.add_option('--os-cacert',
metavar='<ca-certificate>',
@@ -1169,6 +1173,10 @@ Example:
signal.signal(signal.SIGINT, attempt_graceful_exit)
+ if options.debug:
+ logger = logging.getLogger("swiftclient")
+ logging.basicConfig(level=logging.DEBUG)
+
print_queue = Queue(10000)
def _print(item):