Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: third_party/gsutil/boto/boto/roboto/awsqueryrequest.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/boto/boto/roboto/awsqueryrequest.py
diff --git a/third_party/gsutil/20110627/boto/boto/roboto/awsqueryrequest.py b/third_party/gsutil/boto/boto/roboto/awsqueryrequest.py
similarity index 88%
rename from third_party/gsutil/20110627/boto/boto/roboto/awsqueryrequest.py
rename to third_party/gsutil/boto/boto/roboto/awsqueryrequest.py
index 3544bdcf9302e6934a1a8421bfcf244ff322ebbb..9e05ac638e7e732061a9550b1147a9a6d0b28274 100644
--- a/third_party/gsutil/20110627/boto/boto/roboto/awsqueryrequest.py
+++ b/third_party/gsutil/boto/boto/roboto/awsqueryrequest.py
@@ -26,6 +26,34 @@ import boto
import optparse
import copy
import boto.exception
+import boto.roboto.awsqueryservice
+
+import bdb
+import traceback
+try:
+ import epdb as debugger
+except ImportError:
+ import pdb as debugger
+
+def boto_except_hook(debugger_flag, debug_flag):
+ def excepthook(typ, value, tb):
+ if typ is bdb.BdbQuit:
+ sys.exit(1)
+ sys.excepthook = sys.__excepthook__
+
+ if debugger_flag and sys.stdout.isatty() and sys.stdin.isatty():
+ if debugger.__name__ == 'epdb':
+ debugger.post_mortem(tb, typ, value)
+ else:
+ debugger.post_mortem(tb)
+ elif debug_flag:
+ print traceback.print_tb(tb)
+ sys.exit(1)
+ else:
+ print value
+ sys.exit(1)
+
+ return excepthook
class Line(object):
@@ -241,7 +269,17 @@ class AWSQueryRequest(object):
if python_name in self.args:
del self.connection_args[python_name]
if required:
- raise RequiredParamError(required)
+ l = []
+ for p in self.Params+self.Args:
+ if p.name in required:
+ if p.short_name and p.long_name:
+ l.append('(%s, %s)' % (p.optparse_short_name,
+ p.optparse_long_name))
+ elif p.short_name:
+ l.append('(%s)' % p.optparse_short_name)
+ else:
+ l.append('(%s)' % p.optparse_long_name)
+ raise RequiredParamError(','.join(l))
boto.log.debug('request_params: %s' % self.request_params)
self.process_markers(self.Response)
@@ -281,6 +319,9 @@ class AWSQueryRequest(object):
# add standard options that all commands get
group.add_option('-D', '--debug', action='store_true',
help='Turn on all debugging output')
+ group.add_option('--debugger', action='store_true',
+ default=False,
+ help='Enable interactive debugger on error')
group.add_option('-U', '--url', action='store',
help='Override service URL with value provided')
group.add_option('--region', action='store',
@@ -319,9 +360,21 @@ class AWSQueryRequest(object):
# TODO - Where should the version # come from?
print 'version x.xx'
exit(0)
-
+ sys.excepthook = boto_except_hook(options.debugger,
+ options.debug)
+
+ def get_usage(self):
+ s = 'usage: %prog [options] '
+ l = [ a.long_name for a in self.Args ]
+ s += ' '.join(l)
+ for a in self.Args:
+ if a.doc:
+ s += '\n\n\t%s - %s' % (a.long_name, a.doc)
+ return s
+
def build_cli_parser(self):
- self.parser = optparse.OptionParser()
+ self.parser = optparse.OptionParser(description=self.Description,
+ usage=self.get_usage())
self.add_standard_options()
for param in self.Params:
ptype = action = choices = None
@@ -404,6 +457,13 @@ class AWSQueryRequest(object):
sys.exit(1)
except self.ServiceClass.ResponseError, err:
print 'Error(%s): %s' % (err.error_code, err.error_message)
+ sys.exit(1)
+ except boto.roboto.awsqueryservice.NoCredentialsError, err:
+ print 'Unable to find credentials.'
+ sys.exit(1)
+ except Exception, e:
+ print e
+ sys.exit(1)
def _generic_cli_formatter(self, fmt, data, label=''):
if fmt['type'] == 'object':
« no previous file with comments | « third_party/gsutil/boto/boto/roboto/__init__.py ('k') | third_party/gsutil/boto/boto/roboto/awsqueryservice.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698