OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding=utf8 | 2 # coding=utf8 |
3 # Copyright 2011 Google Inc. All Rights Reserved. | 3 # Copyright 2011 Google Inc. All Rights Reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 __import__('gslib.commands.%s' % module_name) | 57 __import__('gslib.commands.%s' % module_name) |
58 command_map = {} | 58 command_map = {} |
59 # Only include Command subclasses in the dict. | 59 # Only include Command subclasses in the dict. |
60 for command in Command.__subclasses__(): | 60 for command in Command.__subclasses__(): |
61 command_map[command.command_spec[COMMAND_NAME]] = command | 61 command_map[command.command_spec[COMMAND_NAME]] = command |
62 for command_name_aliases in command.command_spec[COMMAND_NAME_ALIASES]: | 62 for command_name_aliases in command.command_spec[COMMAND_NAME_ALIASES]: |
63 command_map[command_name_aliases] = command | 63 command_map[command_name_aliases] = command |
64 return command_map | 64 return command_map |
65 | 65 |
66 def RunNamedCommand(self, command_name, args=None, headers=None, debug=0, | 66 def RunNamedCommand(self, command_name, args=None, headers=None, debug=0, |
67 parallel_operations=False, test_method=None): | 67 parallel_operations=False, test_method=None, |
| 68 bypass_prodaccess=True): |
68 """Runs the named command. Used by gsutil main, commands built atop | 69 """Runs the named command. Used by gsutil main, commands built atop |
69 other commands, and tests . | 70 other commands, and tests . |
70 | 71 |
71 Args: | 72 Args: |
72 command_name: The name of the command being run. | 73 command_name: The name of the command being run. |
73 args: Command-line args (arg0 = actual arg, not command name ala bash). | 74 args: Command-line args (arg0 = actual arg, not command name ala bash). |
74 headers: Dictionary containing optional HTTP headers to pass to boto. | 75 headers: Dictionary containing optional HTTP headers to pass to boto. |
75 debug: Debug level to pass in to boto connection (range 0..3). | 76 debug: Debug level to pass in to boto connection (range 0..3). |
76 parallel_operations: Should command operations be executed in parallel? | 77 parallel_operations: Should command operations be executed in parallel? |
77 test_method: Optional general purpose method for testing purposes. | 78 test_method: Optional general purpose method for testing purposes. |
(...skipping 12 matching lines...) Expand all Loading... |
90 headers = {} | 91 headers = {} |
91 headers['x-goog-api-version'] = api_version | 92 headers['x-goog-api-version'] = api_version |
92 | 93 |
93 if command_name not in self.command_map: | 94 if command_name not in self.command_map: |
94 raise CommandException('Invalid command "%s".' % command_name) | 95 raise CommandException('Invalid command "%s".' % command_name) |
95 command_class = self.command_map[command_name] | 96 command_class = self.command_map[command_name] |
96 command_inst = command_class(self, args, headers, debug, | 97 command_inst = command_class(self, args, headers, debug, |
97 parallel_operations, self.gsutil_bin_dir, | 98 parallel_operations, self.gsutil_bin_dir, |
98 self.boto_lib_dir, self.config_file_list, | 99 self.boto_lib_dir, self.config_file_list, |
99 self.gsutil_ver, self.bucket_storage_uri_class, | 100 self.gsutil_ver, self.bucket_storage_uri_class, |
100 test_method) | 101 test_method, bypass_prodaccess) |
101 return command_inst.RunCommand() | 102 return command_inst.RunCommand() |
OLD | NEW |