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

Side by Side Diff: client/isolateserver.py

Issue 2969463002: Use config.json to enable Isolated gRPC proxy (Closed)
Patch Set: Fix pylint errors Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « client/isolate_storage.py ('k') | client/tests/isolate_storage_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The LUCI Authors. All rights reserved. 2 # Copyright 2013 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Archives a set of files or directories to an Isolate Server.""" 6 """Archives a set of files or directories to an Isolate Server."""
7 7
8 __version__ = '0.8.0' 8 __version__ = '0.8.0'
9 9
10 import errno 10 import errno
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 1942
1943 def add_isolate_server_options(parser): 1943 def add_isolate_server_options(parser):
1944 """Adds --isolate-server and --namespace options to parser.""" 1944 """Adds --isolate-server and --namespace options to parser."""
1945 parser.add_option( 1945 parser.add_option(
1946 '-I', '--isolate-server', 1946 '-I', '--isolate-server',
1947 metavar='URL', default=os.environ.get('ISOLATE_SERVER', ''), 1947 metavar='URL', default=os.environ.get('ISOLATE_SERVER', ''),
1948 help='URL of the Isolate Server to use. Defaults to the environment ' 1948 help='URL of the Isolate Server to use. Defaults to the environment '
1949 'variable ISOLATE_SERVER if set. No need to specify https://, this ' 1949 'variable ISOLATE_SERVER if set. No need to specify https://, this '
1950 'is assumed.') 1950 'is assumed.')
1951 parser.add_option( 1951 parser.add_option(
1952 '--is-grpc', action='store_true', help='Communicate to Isolate via gRPC') 1952 '--grpc-proxy', help='gRPC proxy by which to communicate to Isolate')
1953 parser.add_option( 1953 parser.add_option(
1954 '--namespace', default='default-gzip', 1954 '--namespace', default='default-gzip',
1955 help='The namespace to use on the Isolate Server, default: %default') 1955 help='The namespace to use on the Isolate Server, default: %default')
1956 1956
1957 1957
1958 def process_isolate_server_options( 1958 def process_isolate_server_options(
1959 parser, options, set_exception_handler, required): 1959 parser, options, set_exception_handler, required):
1960 """Processes the --isolate-server option. 1960 """Processes the --isolate-server option.
1961 1961
1962 Returns the identity as determined by the server. 1962 Returns the identity as determined by the server.
1963 """ 1963 """
1964 if not options.isolate_server: 1964 if not options.isolate_server:
1965 if required: 1965 if required:
1966 parser.error('--isolate-server is required.') 1966 parser.error('--isolate-server is required.')
1967 return 1967 return
1968 1968
1969 if 'ISOLATED_GRPC_PROXY' in os.environ: 1969 if options.grpc_proxy:
1970 options.is_grpc = True 1970 isolate_storage.set_grpc_proxy(options.grpc_proxy)
1971
1972 if options.is_grpc:
1973 isolate_storage.set_storage_api_class(isolate_storage.IsolateServerGrpc)
1974 else: 1971 else:
1975 try: 1972 try:
1976 options.isolate_server = net.fix_url(options.isolate_server) 1973 options.isolate_server = net.fix_url(options.isolate_server)
1977 except ValueError as e: 1974 except ValueError as e:
1978 parser.error('--isolate-server %s' % e) 1975 parser.error('--isolate-server %s' % e)
1979 if set_exception_handler: 1976 if set_exception_handler:
1980 on_error.report_on_exception_exit(options.isolate_server) 1977 on_error.report_on_exception_exit(options.isolate_server)
1981 try: 1978 try:
1982 return auth.ensure_logged_in(options.isolate_server) 1979 return auth.ensure_logged_in(options.isolate_server)
1983 except ValueError as e: 1980 except ValueError as e:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 return dispatcher.execute(OptionParserIsolateServer(), args) 2046 return dispatcher.execute(OptionParserIsolateServer(), args)
2050 2047
2051 2048
2052 if __name__ == '__main__': 2049 if __name__ == '__main__':
2053 subprocess42.inhibit_os_error_reporting() 2050 subprocess42.inhibit_os_error_reporting()
2054 fix_encoding.fix_encoding() 2051 fix_encoding.fix_encoding()
2055 tools.disable_buffering() 2052 tools.disable_buffering()
2056 colorama.init() 2053 colorama.init()
2057 file_path.enable_symlink() 2054 file_path.enable_symlink()
2058 sys.exit(main(sys.argv[1:])) 2055 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « client/isolate_storage.py ('k') | client/tests/isolate_storage_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698