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

Unified Diff: scripts/slave/gatekeeper_ng_config.py

Issue 514813003: Added method for loading of the gatekeeper_trees.json config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Added a test to validate checked-in trees config Created 6 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
« no previous file with comments | « no previous file | scripts/slave/unittests/gatekeeper_ng_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/gatekeeper_ng_config.py
diff --git a/scripts/slave/gatekeeper_ng_config.py b/scripts/slave/gatekeeper_ng_config.py
index c5183d98f9b0b1a575b5d7f4fa8a0ba564619066..138e63ac70d1c21895a2b54478ebe2f780fabfb8 100755
--- a/scripts/slave/gatekeeper_ng_config.py
+++ b/scripts/slave/gatekeeper_ng_config.py
@@ -247,6 +247,38 @@ def load_gatekeeper_config(filename):
return gatekeeper_config
+def load_gatekeeper_tree_config(filename):
+ """Loads and verifies tree config json, returned loaded config json."""
+ with open(filename) as f:
+ trees_config = json.load(f)
+
+ tree_config_keys = ['masters',
+ 'build-db',
+ 'open-tree',
+ 'password-file',
+ 'revision-properties',
+ 'set-status',
+ 'status-url',
+ 'track-revisions']
+
+ for tree_name, tree_config in trees_config.iteritems():
+ allowed_keys(tree_config, *tree_config_keys)
+ assert isinstance(tree_name, basestring)
+
+ masters = tree_config.get('masters', [])
+ assert isinstance(masters, list)
+ assert all(isinstance(master, basestring) for master in masters)
+
+ assert isinstance(tree_config.get('build-db', ''), basestring)
+ assert isinstance(tree_config.get('open-tree', True), bool)
+ assert isinstance(tree_config.get('password-file', ''), basestring)
+ assert isinstance(tree_config.get('revision-properties', ''), basestring)
+ assert isinstance(tree_config.get('set-status', True), bool)
+ assert isinstance(tree_config.get('status-url', ''), basestring)
+ assert isinstance(tree_config.get('track-revisions', True), bool)
+
+ return trees_config
+
def gatekeeper_section_hash(gatekeeper_section):
st = cStringIO.StringIO()
flatten_to_json(gatekeeper_section, st)
« no previous file with comments | « no previous file | scripts/slave/unittests/gatekeeper_ng_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698