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

Unified Diff: appengine/cr-buildbucket/swarming/swarmingcfg.py

Issue 2213723002: swarmbucket: allow overriding config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@sb-cfg-refactoring
Patch Set: security warning Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: appengine/cr-buildbucket/swarming/swarmingcfg.py
diff --git a/appengine/cr-buildbucket/swarming/swarmingcfg.py b/appengine/cr-buildbucket/swarming/swarmingcfg.py
index 7e7cd68b8538a6a499fab22652c6ccf97f56e2c3..3b7338dbd2bfe6582b191e52c85c78b4c5761e06 100644
--- a/appengine/cr-buildbucket/swarming/swarmingcfg.py
+++ b/appengine/cr-buildbucket/swarming/swarmingcfg.py
@@ -12,7 +12,6 @@ from proto import project_config_pb2
DIMENSION_KEY_RGX = re.compile(r'^[a-zA-Z\_\-]+$')
-NO_PROPERTY = object()
def read_properties(recipe):
@@ -25,10 +24,7 @@ def read_properties(recipe):
result = dict(p.split(':', 1) for p in recipe.properties)
for p in recipe.properties_j:
k, v = p.split(':', 1)
- if not v:
- parsed = NO_PROPERTY
- else:
- parsed = json.loads(v)
+ parsed = json.loads(v)
result[k] = parsed
return result
@@ -48,7 +44,7 @@ def merge_recipe(r1, r2):
r1.properties_j[:] = [
'%s:%s' % (k, json.dumps(v))
for k, v in sorted(props.iteritems())
- if v is not NO_PROPERTY
+ if v is not None
]
@@ -170,11 +166,10 @@ def validate_recipe_properties(properties, properties_j, ctx):
key, value = p.split(':', 1)
validate_key(key)
keys.add(key)
- if value:
- try:
- json.loads(value)
- except ValueError as ex:
- ctx.error(ex)
+ try:
+ json.loads(value)
+ except ValueError as ex:
+ ctx.error(ex)
def validate_builder_cfg(builder, ctx, final=True):
« no previous file with comments | « appengine/cr-buildbucket/swarming/swarming.py ('k') | appengine/cr-buildbucket/swarming/test/swarming_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698