| Index: appengine/swarming/handlers_endpoints.py
|
| diff --git a/appengine/swarming/handlers_endpoints.py b/appengine/swarming/handlers_endpoints.py
|
| index 394bc408ecafa278c9c6a3213c7e8ab222bf4dd8..24c1724a34ca085a2232892d6b47d8f57d68c331 100644
|
| --- a/appengine/swarming/handlers_endpoints.py
|
| +++ b/appengine/swarming/handlers_endpoints.py
|
| @@ -77,6 +77,24 @@ def get_result_entity(task_id):
|
| return get_or_raise(key)
|
|
|
|
|
| +def apply_property_defaults(properties):
|
| + """Fills task properties with default values read from server settings."""
|
| + cfg = config.settings()
|
| + if not cfg:
|
| + return
|
| +
|
| + if cfg.isolate.default_server and cfg.isolate.default_namespace:
|
| + properties.inputs_ref = properties.inputs_ref or swarming_rpcs.FilesRef()
|
| + properties.inputs_ref.isolatedserver = (
|
| + properties.inputs_ref.isolatedserver or cfg.isolate.default_server)
|
| + properties.inputs_ref.namespace = (
|
| + properties.inputs_ref.namespace or cfg.isolate.default_namespace)
|
| +
|
| + cipd_input = properties.cipd_input
|
| + if cipd_input and not cipd_input.settings and cfg.HasField('cipd'):
|
| + cipd_input.settings = cfg.cipd.SerializeToString()
|
| +
|
| +
|
| ### API
|
|
|
|
|
| @@ -271,17 +289,7 @@ class SwarmingTasksService(remote.Service):
|
| if request.properties is None:
|
| raise endpoints.BadRequestException('properties are required')
|
|
|
| - # Apply isolate defaults.
|
| - cfg = config.settings()
|
| - if cfg.isolate.default_server and cfg.isolate.default_namespace:
|
| - request.properties.inputs_ref = (
|
| - request.properties.inputs_ref or swarming_rpcs.FilesRef())
|
| - request.properties.inputs_ref.isolatedserver = (
|
| - request.properties.inputs_ref.isolatedserver or
|
| - cfg.isolate.default_server)
|
| - request.properties.inputs_ref.namespace = (
|
| - request.properties.inputs_ref.namespace or
|
| - cfg.isolate.default_namespace)
|
| + apply_property_defaults(request.properties)
|
|
|
| try:
|
| request = message_conversion.new_task_request_from_rpc(
|
|
|