Index: third_party/gsutil/gsutil |
diff --git a/third_party/gsutil/gsutil b/third_party/gsutil/gsutil |
index aca0c7809409cdc81749b558dc1418b667885541..e6509edcaa3b7c84001d60e8f13814368b30101b 100755 |
--- a/third_party/gsutil/gsutil |
+++ b/third_party/gsutil/gsutil |
@@ -109,6 +109,7 @@ def main(): |
if sys.version_info[:3] < (2, 6): |
raise CommandException('gsutil requires Python 2.6 or higher.') |
+ bypass_prodaccess = False |
config_file_list = _GetBotoConfigFileList() |
command_runner = CommandRunner(gsutil_bin_dir, boto_lib_dir, config_file_list, |
gsutil_ver) |
@@ -128,9 +129,10 @@ def main(): |
boto.config.setbool('Boto', 'https_validate_certificates', True) |
try: |
- opts, args = getopt.getopt(sys.argv[1:], 'dDvh:m', |
+ opts, args = getopt.getopt(sys.argv[1:], 'dDvh:mb', |
['debug', 'detailedDebug', 'version', 'help', |
- 'header', 'multithreaded']) |
+ 'header', 'multithreaded', |
+ 'bypass_prodaccess']) |
except getopt.GetoptError, e: |
_HandleCommandException(CommandException(e.msg)) |
for o, a in opts: |
@@ -155,6 +157,8 @@ def main(): |
headers[hdr_name] = hdr_val |
if o in ('-m', '--multithreaded'): |
parallel_operations = True |
+ if o in ('-b', '--bypass_prodaccess'): |
+ bypass_prodaccess = True |
if debug > 1: |
sys.stderr.write( |
'***************************** WARNING *****************************\n' |
@@ -186,9 +190,13 @@ def main(): |
else: |
command_name = args[0] |
+ if not bypass_prodaccess: |
+ import plugins.sso_auth |
+ |
return _RunNamedCommandAndHandleExceptions(command_runner, command_name, |
args[1:], headers, debug, |
- parallel_operations) |
+ parallel_operations, |
+ bypass_prodaccess) |
def _GetBotoConfigFileList(): |
@@ -244,7 +252,8 @@ def _HandleSigQuit(signal_num, cur_stack_frame): |
def _RunNamedCommandAndHandleExceptions(command_runner, command_name, args=None, |
headers=None, debug=0, |
- parallel_operations=False): |
+ parallel_operations=False, |
+ bypass_prodaccess=False): |
try: |
# Catch ^C so we can print a brief message instead of the normal Python |
# stack trace. |
@@ -283,7 +292,7 @@ def _RunNamedCommandAndHandleExceptions(command_runner, command_name, args=None, |
# config file (who might previously have been using gsutil only for |
# accessing publicly readable buckets and objects). |
if e.status == 403: |
- if not HasConfiguredCredentials(): |
+ if not HasConfiguredCredentials(bypass_prodaccess): |
_OutputAndExit( |
'You are attempting to access protected data with no configured ' |
'credentials.\nPlease see ' |