Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """This module defines Swarming Server endpoints handlers.""" | 5 """This module defines Swarming Server endpoints handlers.""" |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 @swarming_api.api_class(resource_name='server', path='server') | 128 @swarming_api.api_class(resource_name='server', path='server') |
| 129 class SwarmingServerService(remote.Service): | 129 class SwarmingServerService(remote.Service): |
| 130 @gae_ts_mon.instrument_endpoint() | 130 @gae_ts_mon.instrument_endpoint() |
| 131 @auth.endpoints_method( | 131 @auth.endpoints_method( |
| 132 message_types.VoidMessage, swarming_rpcs.ServerDetails, | 132 message_types.VoidMessage, swarming_rpcs.ServerDetails, |
| 133 http_method='GET') | 133 http_method='GET') |
| 134 @auth.require(acl.is_bot_or_user) | 134 @auth.require(acl.is_bot_or_user) |
| 135 def details(self, _request): | 135 def details(self, _request): |
| 136 """Returns information about the server.""" | 136 """Returns information about the server.""" |
| 137 host = 'https://' + os.environ['HTTP_HOST'] | 137 host = 'https://' + os.environ['HTTP_HOST'] |
| 138 | |
| 139 mpp = "" | |
|
M-A Ruel
2016/10/11 16:26:55
Use single quotes.
kjlubick
2016/10/11 17:00:02
Done.
| |
| 140 logging.info("Settings: %s",config.settings()) | |
|
M-A Ruel
2016/10/11 16:26:55
you should log the returned object if you want to
kjlubick
2016/10/11 17:00:02
Oops, left over logging. Removed.
| |
| 141 if config.settings().mp and config.settings().mp.server: | |
| 142 mpp = config.settings().mp.server | |
| 143 | |
| 138 return swarming_rpcs.ServerDetails( | 144 return swarming_rpcs.ServerDetails( |
| 139 bot_version = bot_code.get_bot_version(host), | 145 bot_version = bot_code.get_bot_version(host), |
| 140 server_version = utils.get_app_version()) | 146 server_version = utils.get_app_version(), |
| 147 machine_provider_prefix = mpp, | |
| 148 milo_prefix = config.settings().milo_server_prefix, | |
| 149 sk_revision_prefix = config.settings().sk_revision_prefix) | |
| 141 | 150 |
| 142 @gae_ts_mon.instrument_endpoint() | 151 @gae_ts_mon.instrument_endpoint() |
| 143 @auth.endpoints_method( | 152 @auth.endpoints_method( |
| 144 message_types.VoidMessage, swarming_rpcs.BootstrapToken) | 153 message_types.VoidMessage, swarming_rpcs.BootstrapToken) |
| 145 @auth.require(acl.is_bootstrapper) | 154 @auth.require(acl.is_bootstrapper) |
| 146 def token(self, _request): | 155 def token(self, _request): |
| 147 """Returns a token to bootstrap a new bot.""" | 156 """Returns a token to bootstrap a new bot.""" |
| 148 return swarming_rpcs.BootstrapToken( | 157 return swarming_rpcs.BootstrapToken( |
| 149 bootstrap_token = bot_code.generate_bootstrap_token(), | 158 bootstrap_token = bot_code.generate_bootstrap_token(), |
| 150 ) | 159 ) |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 def get_routes(): | 738 def get_routes(): |
| 730 return ( | 739 return ( |
| 731 endpoints_webapp2.api_routes(SwarmingServerService) + | 740 endpoints_webapp2.api_routes(SwarmingServerService) + |
| 732 endpoints_webapp2.api_routes(SwarmingTaskService) + | 741 endpoints_webapp2.api_routes(SwarmingTaskService) + |
| 733 endpoints_webapp2.api_routes(SwarmingTasksService) + | 742 endpoints_webapp2.api_routes(SwarmingTasksService) + |
| 734 endpoints_webapp2.api_routes(SwarmingBotService) + | 743 endpoints_webapp2.api_routes(SwarmingBotService) + |
| 735 endpoints_webapp2.api_routes(SwarmingBotsService) + | 744 endpoints_webapp2.api_routes(SwarmingBotsService) + |
| 736 # components.config endpoints for validation and configuring of luci-config | 745 # components.config endpoints for validation and configuring of luci-config |
| 737 # service URL. | 746 # service URL. |
| 738 endpoints_webapp2.api_routes(config.ConfigApi)) | 747 endpoints_webapp2.api_routes(config.ConfigApi)) |
| OLD | NEW |