{"action":"created","comment":{"url":"https://api.github.com/repos/Yelp/paasta/pulls/comments/200522356","pull_request_review_id":134856360,"id":200522356,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDUyMjM1Ng==","diff_hunk":"@@ -209,6 +224,60 @@ def path_to_soa_dir_service(service_path):\n     return soa_dir, service\n \n \n+def validate_tron(service_path):\n+    soa_dir, service = path_to_soa_dir_service(service_path)\n+    returncode = True\n+\n+    if soa_dir.endswith('/tron'):\n+        # Makes it possible to validate files in tron/ rather than service directories\n+        # TODO: Clean up after migration to services is complete\n+        cluster = service\n+        soa_dir = soa_dir[:-5]\n+        filenames = [filename for filename in os.listdir(service_path) if filename.endswith('.yaml')]\n+        for filename in filenames:\n+            namespace = os.path.splitext(filename)[0]\n+            file_path = os.path.join(service_path, filename)\n+            if not validate_schema(file_path, 'tron'):\n+                returncode = False\n+            if not validate_tron_namespace(namespace, cluster, soa_dir, tron_dir=True):\n+                returncode = False\n+    else:\n+        # Normal service directory\n+        for cluster in list_tron_clusters(service, soa_dir):\n+            if not validate_tron_namespace(service, cluster, soa_dir):\n+                returncode = False\n+\n+    return returncode\n+\n+\n+def validate_tron_namespace(service, cluster, soa_dir, tron_dir=False):\n+    returncode = True\n+    job_configs, other_config = load_tron_service_config(service, cluster, soa_dir)\n+\n+    if tron_dir:\n+        display_name = f'{cluster}/{service}.yaml'\n+    else:\n+        display_name = f'tron-{cluster}.yaml'\n+\n+    if service != MASTER_NAMESPACE and other_config:\n+        returncode = False\n+        other_keys = list(other_config.keys())\n+        paasta_print(failure(\n+            f\"{display_name}: Non-{MASTER_NAMESPACE} namespace cannot have other config values, found {other_keys}\",\n+            \"http://tron.readthedocs.io/en/latest/jobs.html\",\n+        ))\n+\n+    for job_config in job_configs:\n+        check_msgs = job_config.validate()\n+        if check_msgs:\n+            returncode = False\n+            paasta_print(invalid_tron_job(cluster, job_config.get_name(), \"\\n  \".join(check_msgs), display_name))\n+        else:\n+            if not tron_dir:","path":"paasta_tools/cli/cmds/validate.py","position":91,"original_position":91,"commit_id":"28b51a7321127102cf2c0a684408986485e9bc7d","original_commit_id":"28b51a7321127102cf2c0a684408986485e9bc7d","user":{"login":"chlgit","id":31675758,"node_id":"MDQ6VXNlcjMxNjc1NzU4","avatar_url":"https://avatars2.githubusercontent.com/u/31675758?v=4","gravatar_id":"","url":"https://api.github.com/users/chlgit","html_url":"https://github.com/chlgit","followers_url":"https://api.github.com/users/chlgit/followers","following_url":"https://api.github.com/users/chlgit/following{/other_user}","gists_url":"https://api.github.com/users/chlgit/gists{/gist_id}","starred_url":"https://api.github.com/users/chlgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chlgit/subscriptions","organizations_url":"https://api.github.com/users/chlgit/orgs","repos_url":"https://api.github.com/users/chlgit/repos","events_url":"https://api.github.com/users/chlgit/events{/privacy}","received_events_url":"https://api.github.com/users/chlgit/received_events","type":"User","site_admin":false},"body":"What will happen if tron_dir?","created_at":"2018-07-06T00:21:34Z","updated_at":"2018-07-06T00:21:35Z","html_url":"https://github.com/Yelp/paasta/pull/1893#discussion_r200522356","pull_request_url":"https://api.github.com/repos/Yelp/paasta/pulls/1893","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/comments/200522356"},"html":{"href":"https://github.com/Yelp/paasta/pull/1893#discussion_r200522356"},"pull_request":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1893"}}},"pull_request":{"url":"https://api.github.com/repos/Yelp/paasta/pulls/1893","id":199583807,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NTgzODA3","html_url":"https://github.com/Yelp/paasta/pull/1893","diff_url":"https://github.com/Yelp/paasta/pull/1893.diff","patch_url":"https://github.com/Yelp/paasta/pull/1893.patch","issue_url":"https://api.github.com/repos/Yelp/paasta/issues/1893","number":1893,"state":"open","locked":false,"title":"[WIP] Starting point for validation of Tron configs","user":{"login":"qui","id":1322636,"node_id":"MDQ6VXNlcjEzMjI2MzY=","avatar_url":"https://avatars3.githubusercontent.com/u/1322636?v=4","gravatar_id":"","url":"https://api.github.com/users/qui","html_url":"https://github.com/qui","followers_url":"https://api.github.com/users/qui/followers","following_url":"https://api.github.com/users/qui/following{/other_user}","gists_url":"https://api.github.com/users/qui/gists{/gist_id}","starred_url":"https://api.github.com/users/qui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qui/subscriptions","organizations_url":"https://api.github.com/users/qui/orgs","repos_url":"https://api.github.com/users/qui/repos","events_url":"https://api.github.com/users/qui/events{/privacy}","received_events_url":"https://api.github.com/users/qui/received_events","type":"User","site_admin":false},"body":"Added a JSON schema for Tron configs, and `validate` methods for TronActionConfig and TronJobConfig. `paasta validate` will check the schema and call validate on the configs. Eventually, the goal is to have all of the checks that are done with our pre-commit script and `tronfig` to be included here instead. If `paasta validate` passes, we should be confident that Tron will accept the config.\r\n\r\nThere's some extra logic in the CLI to support something like `paasta validate -s tron/prod`, so that we can use this in a pre-commit hook for those files, too. Not the cleanest, but I figure it's better than maintaining multiple types of pre-commit checks.\r\n\r\nThis shows the general approach I'm going for. If this looks reasonable, I'll add tests. And then we can follow up with more check methods.","created_at":"2018-07-05T20:49:50Z","updated_at":"2018-07-06T00:21:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6448f0a5bbc8b133dbc421ed5637edb8fb16f309","assignee":{"login":"qui","id":1322636,"node_id":"MDQ6VXNlcjEzMjI2MzY=","avatar_url":"https://avatars3.githubusercontent.com/u/1322636?v=4","gravatar_id":"","url":"https://api.github.com/users/qui","html_url":"https://github.com/qui","followers_url":"https://api.github.com/users/qui/followers","following_url":"https://api.github.com/users/qui/following{/other_user}","gists_url":"https://api.github.com/users/qui/gists{/gist_id}","starred_url":"https://api.github.com/users/qui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qui/subscriptions","organizations_url":"https://api.github.com/users/qui/orgs","repos_url":"https://api.github.com/users/qui/repos","events_url":"https://api.github.com/users/qui/events{/privacy}","received_events_url":"https://api.github.com/users/qui/received_events","type":"User","site_admin":false},"assignees":[{"login":"qui","id":1322636,"node_id":"MDQ6VXNlcjEzMjI2MzY=","avatar_url":"https://avatars3.githubusercontent.com/u/1322636?v=4","gravatar_id":"","url":"https://api.github.com/users/qui","html_url":"https://github.com/qui","followers_url":"https://api.github.com/users/qui/followers","following_url":"https://api.github.com/users/qui/following{/other_user}","gists_url":"https://api.github.com/users/qui/gists{/gist_id}","starred_url":"https://api.github.com/users/qui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qui/subscriptions","organizations_url":"https://api.github.com/users/qui/orgs","repos_url":"https://api.github.com/users/qui/repos","events_url":"https://api.github.com/users/qui/events{/privacy}","received_events_url":"https://api.github.com/users/qui/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"keymone","id":7057,"node_id":"MDQ6VXNlcjcwNTc=","avatar_url":"https://avatars3.githubusercontent.com/u/7057?v=4","gravatar_id":"","url":"https://api.github.com/users/keymone","html_url":"https://github.com/keymone","followers_url":"https://api.github.com/users/keymone/followers","following_url":"https://api.github.com/users/keymone/following{/other_user}","gists_url":"https://api.github.com/users/keymone/gists{/gist_id}","starred_url":"https://api.github.com/users/keymone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keymone/subscriptions","organizations_url":"https://api.github.com/users/keymone/orgs","repos_url":"https://api.github.com/users/keymone/repos","events_url":"https://api.github.com/users/keymone/events{/privacy}","received_events_url":"https://api.github.com/users/keymone/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":279823133,"node_id":"MDU6TGFiZWwyNzk4MjMxMzM=","url":"https://api.github.com/repos/Yelp/paasta/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Yelp/paasta/pulls/1893/commits","review_comments_url":"https://api.github.com/repos/Yelp/paasta/pulls/1893/comments","review_comment_url":"https://api.github.com/repos/Yelp/paasta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yelp/paasta/issues/1893/comments","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/28b51a7321127102cf2c0a684408986485e9bc7d","head":{"label":"Yelp:validate-tron-configs","ref":"validate-tron-configs","sha":"28b51a7321127102cf2c0a684408986485e9bc7d","user":{"login":"Yelp","id":49071,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5MDcx","avatar_url":"https://avatars1.githubusercontent.com/u/49071?v=4","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":44998824,"node_id":"MDEwOlJlcG9zaXRvcnk0NDk5ODgyNA==","name":"paasta","full_name":"Yelp/paasta","owner":{"login":"Yelp","id":49071,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5MDcx","avatar_url":"https://avatars1.githubusercontent.com/u/49071?v=4","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/paasta","description":"An open, distributed platform as a service","fork":false,"url":"https://api.github.com/repos/Yelp/paasta","forks_url":"https://api.github.com/repos/Yelp/paasta/forks","keys_url":"https://api.github.com/repos/Yelp/paasta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/paasta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/paasta/teams","hooks_url":"https://api.github.com/repos/Yelp/paasta/hooks","issue_events_url":"https://api.github.com/repos/Yelp/paasta/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/paasta/events","assignees_url":"https://api.github.com/repos/Yelp/paasta/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/paasta/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/paasta/tags","blobs_url":"https://api.github.com/repos/Yelp/paasta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/paasta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/paasta/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/paasta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/paasta/languages","stargazers_url":"https://api.github.com/repos/Yelp/paasta/stargazers","contributors_url":"https://api.github.com/repos/Yelp/paasta/contributors","subscribers_url":"https://api.github.com/repos/Yelp/paasta/subscribers","subscription_url":"https://api.github.com/repos/Yelp/paasta/subscription","commits_url":"https://api.github.com/repos/Yelp/paasta/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/paasta/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/paasta/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/paasta/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/paasta/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/paasta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/paasta/merges","archive_url":"https://api.github.com/repos/Yelp/paasta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/paasta/downloads","issues_url":"https://api.github.com/repos/Yelp/paasta/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/paasta/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/paasta/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/paasta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/paasta/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/paasta/releases{/id}","deployments_url":"https://api.github.com/repos/Yelp/paasta/deployments","created_at":"2015-10-26T21:35:53Z","updated_at":"2018-07-05T10:36:10Z","pushed_at":"2018-07-05T20:49:51Z","git_url":"git://github.com/Yelp/paasta.git","ssh_url":"git@github.com:Yelp/paasta.git","clone_url":"https://github.com/Yelp/paasta.git","svn_url":"https://github.com/Yelp/paasta","homepage":"","size":56473,"stargazers_count":1247,"watchers_count":1247,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":150,"mirror_url":null,"archived":false,"open_issues_count":99,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":150,"open_issues":99,"watchers":1247,"default_branch":"master"}},"base":{"label":"Yelp:master","ref":"master","sha":"4669c5f746c7962b21052dfc7e64f82f372ff553","user":{"login":"Yelp","id":49071,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5MDcx","avatar_url":"https://avatars1.githubusercontent.com/u/49071?v=4","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":44998824,"node_id":"MDEwOlJlcG9zaXRvcnk0NDk5ODgyNA==","name":"paasta","full_name":"Yelp/paasta","owner":{"login":"Yelp","id":49071,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5MDcx","avatar_url":"https://avatars1.githubusercontent.com/u/49071?v=4","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/paasta","description":"An open, distributed platform as a service","fork":false,"url":"https://api.github.com/repos/Yelp/paasta","forks_url":"https://api.github.com/repos/Yelp/paasta/forks","keys_url":"https://api.github.com/repos/Yelp/paasta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/paasta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/paasta/teams","hooks_url":"https://api.github.com/repos/Yelp/paasta/hooks","issue_events_url":"https://api.github.com/repos/Yelp/paasta/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/paasta/events","assignees_url":"https://api.github.com/repos/Yelp/paasta/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/paasta/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/paasta/tags","blobs_url":"https://api.github.com/repos/Yelp/paasta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/paasta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/paasta/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/paasta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/paasta/languages","stargazers_url":"https://api.github.com/repos/Yelp/paasta/stargazers","contributors_url":"https://api.github.com/repos/Yelp/paasta/contributors","subscribers_url":"https://api.github.com/repos/Yelp/paasta/subscribers","subscription_url":"https://api.github.com/repos/Yelp/paasta/subscription","commits_url":"https://api.github.com/repos/Yelp/paasta/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/paasta/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/paasta/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/paasta/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/paasta/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/paasta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/paasta/merges","archive_url":"https://api.github.com/repos/Yelp/paasta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/paasta/downloads","issues_url":"https://api.github.com/repos/Yelp/paasta/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/paasta/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/paasta/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/paasta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/paasta/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/paasta/releases{/id}","deployments_url":"https://api.github.com/repos/Yelp/paasta/deployments","created_at":"2015-10-26T21:35:53Z","updated_at":"2018-07-05T10:36:10Z","pushed_at":"2018-07-05T20:49:51Z","git_url":"git://github.com/Yelp/paasta.git","ssh_url":"git@github.com:Yelp/paasta.git","clone_url":"https://github.com/Yelp/paasta.git","svn_url":"https://github.com/Yelp/paasta","homepage":"","size":56473,"stargazers_count":1247,"watchers_count":1247,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":150,"mirror_url":null,"archived":false,"open_issues_count":99,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":150,"open_issues":99,"watchers":1247,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1893"},"html":{"href":"https://github.com/Yelp/paasta/pull/1893"},"issue":{"href":"https://api.github.com/repos/Yelp/paasta/issues/1893"},"comments":{"href":"https://api.github.com/repos/Yelp/paasta/issues/1893/comments"},"review_comments":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1893/comments"},"review_comment":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1893/commits"},"statuses":{"href":"https://api.github.com/repos/Yelp/paasta/statuses/28b51a7321127102cf2c0a684408986485e9bc7d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"chlgit"}}