{"action":"opened","number":927,"pull_request":{"url":"https://api.github.com/repos/Netflix/security_monkey/pulls/927","id":166695439,"html_url":"https://github.com/Netflix/security_monkey/pull/927","diff_url":"https://github.com/Netflix/security_monkey/pull/927.diff","patch_url":"https://github.com/Netflix/security_monkey/pull/927.patch","issue_url":"https://api.github.com/repos/Netflix/security_monkey/issues/927","number":927,"state":"open","locked":false,"title":"fix KeyError when services in SWAG account is not defined","user":{"login":"mark-ignacio","id":4490736,"avatar_url":"https://avatars0.githubusercontent.com/u/4490736?v=4","gravatar_id":"","url":"https://api.github.com/users/mark-ignacio","html_url":"https://github.com/mark-ignacio","followers_url":"https://api.github.com/users/mark-ignacio/followers","following_url":"https://api.github.com/users/mark-ignacio/following{/other_user}","gists_url":"https://api.github.com/users/mark-ignacio/gists{/gist_id}","starred_url":"https://api.github.com/users/mark-ignacio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mark-ignacio/subscriptions","organizations_url":"https://api.github.com/users/mark-ignacio/orgs","repos_url":"https://api.github.com/users/mark-ignacio/repos","events_url":"https://api.github.com/users/mark-ignacio/events{/privacy}","received_events_url":"https://api.github.com/users/mark-ignacio/received_events","type":"User","site_admin":false},"body":"We're using [SWAG](https://github.com/Netflix-Skunkworks/swag-client) but don't define services on all of our accounts. Some of them look like this:\r\n\r\n```\r\n    {\r\n        \"aliases\": [\"alias\"],\r\n        \"contacts\": [],\r\n        \"description\": [],\r\n        \"email\": \"\",\r\n        \"id\": \"86753098675\",\r\n        \"name\": \"oh yes\",\r\n        \"owner\": \"ukno\",\r\n        \"provider\": \"aws\",\r\n        \"sensitive\": true\r\n    }\r\n```\r\n\r\nSWAG spec says that the services key is optional: https://github.com/Netflix-Skunkworks/swag-client/blob/538366cedfe8536fc24705f3439a4d16a5e7dc7c/swag_client/schemas/v2.py#L55\r\n\r\nSo this PR fixes the following error and allows the command to complete:\r\n\r\n```\r\n$ monkey sync_swag -b our-bucket -p the-goods.json -o ukno                                              \r\nTraceback (most recent call last):\r\n  File \"/usr/local/src/security_monkey/venv/bin/monkey\", line 11, in <module>\r\n    load_entry_point('security-monkey', 'console_scripts', 'monkey')()\r\n  File \"/usr/local/src/security_monkey/security_monkey/manage.py\", line 728, in main\r\n    manager.run()\r\n  File \"/usr/local/src/security_monkey/venv/lib/python2.7/site-packages/Flask_Script-0.6.3-py2.7.egg/flask_script/__init__.py\", line 397, in run\r\n    result = self.handle(sys.argv[0], sys.argv[1:])\r\n  File \"/usr/local/src/security_monkey/venv/lib/python2.7/site-packages/Flask_Script-0.6.3-py2.7.egg/flask_script/__init__.py\", line 376, in handle\r\n    return handle(app, *positional_args, **kwargs)\r\n  File \"/usr/local/src/security_monkey/venv/lib/python2.7/site-packages/Flask_Script-0.6.3-py2.7.egg/flask_script/commands.py\", line 145, in handle\r\n    return self.run(*args, **kwargs)\r\n  File \"/usr/local/src/security_monkey/security_monkey/manage.py\", line 640, in sync_swag\r\n    for s in account['services']:\r\nKeyError: 'services'\r\n\r\n```","created_at":"2018-02-02T01:16:07Z","updated_at":"2018-02-02T01:16:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/Netflix/security_monkey/pulls/927/commits","review_comments_url":"https://api.github.com/repos/Netflix/security_monkey/pulls/927/comments","review_comment_url":"https://api.github.com/repos/Netflix/security_monkey/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Netflix/security_monkey/issues/927/comments","statuses_url":"https://api.github.com/repos/Netflix/security_monkey/statuses/b2990f8b06ff94e45841b02ce61eeab0082df7a4","head":{"label":"mark-ignacio:swag-fix","ref":"swag-fix","sha":"b2990f8b06ff94e45841b02ce61eeab0082df7a4","user":{"login":"mark-ignacio","id":4490736,"avatar_url":"https://avatars0.githubusercontent.com/u/4490736?v=4","gravatar_id":"","url":"https://api.github.com/users/mark-ignacio","html_url":"https://github.com/mark-ignacio","followers_url":"https://api.github.com/users/mark-ignacio/followers","following_url":"https://api.github.com/users/mark-ignacio/following{/other_user}","gists_url":"https://api.github.com/users/mark-ignacio/gists{/gist_id}","starred_url":"https://api.github.com/users/mark-ignacio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mark-ignacio/subscriptions","organizations_url":"https://api.github.com/users/mark-ignacio/orgs","repos_url":"https://api.github.com/users/mark-ignacio/repos","events_url":"https://api.github.com/users/mark-ignacio/events{/privacy}","received_events_url":"https://api.github.com/users/mark-ignacio/received_events","type":"User","site_admin":false},"repo":{"id":108049046,"name":"security_monkey","full_name":"mark-ignacio/security_monkey","owner":{"login":"mark-ignacio","id":4490736,"avatar_url":"https://avatars0.githubusercontent.com/u/4490736?v=4","gravatar_id":"","url":"https://api.github.com/users/mark-ignacio","html_url":"https://github.com/mark-ignacio","followers_url":"https://api.github.com/users/mark-ignacio/followers","following_url":"https://api.github.com/users/mark-ignacio/following{/other_user}","gists_url":"https://api.github.com/users/mark-ignacio/gists{/gist_id}","starred_url":"https://api.github.com/users/mark-ignacio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mark-ignacio/subscriptions","organizations_url":"https://api.github.com/users/mark-ignacio/orgs","repos_url":"https://api.github.com/users/mark-ignacio/repos","events_url":"https://api.github.com/users/mark-ignacio/events{/privacy}","received_events_url":"https://api.github.com/users/mark-ignacio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mark-ignacio/security_monkey","description":"Security Monkey","fork":true,"url":"https://api.github.com/repos/mark-ignacio/security_monkey","forks_url":"https://api.github.com/repos/mark-ignacio/security_monkey/forks","keys_url":"https://api.github.com/repos/mark-ignacio/security_monkey/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mark-ignacio/security_monkey/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mark-ignacio/security_monkey/teams","hooks_url":"https://api.github.com/repos/mark-ignacio/security_monkey/hooks","issue_events_url":"https://api.github.com/repos/mark-ignacio/security_monkey/issues/events{/number}","events_url":"https://api.github.com/repos/mark-ignacio/security_monkey/events","assignees_url":"https://api.github.com/repos/mark-ignacio/security_monkey/assignees{/user}","branches_url":"https://api.github.com/repos/mark-ignacio/security_monkey/branches{/branch}","tags_url":"https://api.github.com/repos/mark-ignacio/security_monkey/tags","blobs_url":"https://api.github.com/repos/mark-ignacio/security_monkey/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mark-ignacio/security_monkey/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mark-ignacio/security_monkey/git/refs{/sha}","trees_url":"https://api.github.com/repos/mark-ignacio/security_monkey/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mark-ignacio/security_monkey/statuses/{sha}","languages_url":"https://api.github.com/repos/mark-ignacio/security_monkey/languages","stargazers_url":"https://api.github.com/repos/mark-ignacio/security_monkey/stargazers","contributors_url":"https://api.github.com/repos/mark-ignacio/security_monkey/contributors","subscribers_url":"https://api.github.com/repos/mark-ignacio/security_monkey/subscribers","subscription_url":"https://api.github.com/repos/mark-ignacio/security_monkey/subscription","commits_url":"https://api.github.com/repos/mark-ignacio/security_monkey/commits{/sha}","git_commits_url":"https://api.github.com/repos/mark-ignacio/security_monkey/git/commits{/sha}","comments_url":"https://api.github.com/repos/mark-ignacio/security_monkey/comments{/number}","issue_comment_url":"https://api.github.com/repos/mark-ignacio/security_monkey/issues/comments{/number}","contents_url":"https://api.github.com/repos/mark-ignacio/security_monkey/contents/{+path}","compare_url":"https://api.github.com/repos/mark-ignacio/security_monkey/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mark-ignacio/security_monkey/merges","archive_url":"https://api.github.com/repos/mark-ignacio/security_monkey/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mark-ignacio/security_monkey/downloads","issues_url":"https://api.github.com/repos/mark-ignacio/security_monkey/issues{/number}","pulls_url":"https://api.github.com/repos/mark-ignacio/security_monkey/pulls{/number}","milestones_url":"https://api.github.com/repos/mark-ignacio/security_monkey/milestones{/number}","notifications_url":"https://api.github.com/repos/mark-ignacio/security_monkey/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mark-ignacio/security_monkey/labels{/name}","releases_url":"https://api.github.com/repos/mark-ignacio/security_monkey/releases{/id}","deployments_url":"https://api.github.com/repos/mark-ignacio/security_monkey/deployments","created_at":"2017-10-23T22:50:36Z","updated_at":"2017-10-23T22:50:39Z","pushed_at":"2018-02-02T01:11:06Z","git_url":"git://github.com/mark-ignacio/security_monkey.git","ssh_url":"git@github.com:mark-ignacio/security_monkey.git","clone_url":"https://github.com/mark-ignacio/security_monkey.git","svn_url":"https://github.com/mark-ignacio/security_monkey","homepage":null,"size":12884,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"Netflix:develop","ref":"develop","sha":"ec90e981c8465bf262b43d304de6845c861871a4","user":{"login":"Netflix","id":913567,"avatar_url":"https://avatars3.githubusercontent.com/u/913567?v=4","gravatar_id":"","url":"https://api.github.com/users/Netflix","html_url":"https://github.com/Netflix","followers_url":"https://api.github.com/users/Netflix/followers","following_url":"https://api.github.com/users/Netflix/following{/other_user}","gists_url":"https://api.github.com/users/Netflix/gists{/gist_id}","starred_url":"https://api.github.com/users/Netflix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Netflix/subscriptions","organizations_url":"https://api.github.com/users/Netflix/orgs","repos_url":"https://api.github.com/users/Netflix/repos","events_url":"https://api.github.com/users/Netflix/events{/privacy}","received_events_url":"https://api.github.com/users/Netflix/received_events","type":"Organization","site_admin":false},"repo":{"id":21290287,"name":"security_monkey","full_name":"Netflix/security_monkey","owner":{"login":"Netflix","id":913567,"avatar_url":"https://avatars3.githubusercontent.com/u/913567?v=4","gravatar_id":"","url":"https://api.github.com/users/Netflix","html_url":"https://github.com/Netflix","followers_url":"https://api.github.com/users/Netflix/followers","following_url":"https://api.github.com/users/Netflix/following{/other_user}","gists_url":"https://api.github.com/users/Netflix/gists{/gist_id}","starred_url":"https://api.github.com/users/Netflix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Netflix/subscriptions","organizations_url":"https://api.github.com/users/Netflix/orgs","repos_url":"https://api.github.com/users/Netflix/repos","events_url":"https://api.github.com/users/Netflix/events{/privacy}","received_events_url":"https://api.github.com/users/Netflix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Netflix/security_monkey","description":"Security Monkey","fork":false,"url":"https://api.github.com/repos/Netflix/security_monkey","forks_url":"https://api.github.com/repos/Netflix/security_monkey/forks","keys_url":"https://api.github.com/repos/Netflix/security_monkey/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Netflix/security_monkey/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Netflix/security_monkey/teams","hooks_url":"https://api.github.com/repos/Netflix/security_monkey/hooks","issue_events_url":"https://api.github.com/repos/Netflix/security_monkey/issues/events{/number}","events_url":"https://api.github.com/repos/Netflix/security_monkey/events","assignees_url":"https://api.github.com/repos/Netflix/security_monkey/assignees{/user}","branches_url":"https://api.github.com/repos/Netflix/security_monkey/branches{/branch}","tags_url":"https://api.github.com/repos/Netflix/security_monkey/tags","blobs_url":"https://api.github.com/repos/Netflix/security_monkey/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Netflix/security_monkey/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Netflix/security_monkey/git/refs{/sha}","trees_url":"https://api.github.com/repos/Netflix/security_monkey/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Netflix/security_monkey/statuses/{sha}","languages_url":"https://api.github.com/repos/Netflix/security_monkey/languages","stargazers_url":"https://api.github.com/repos/Netflix/security_monkey/stargazers","contributors_url":"https://api.github.com/repos/Netflix/security_monkey/contributors","subscribers_url":"https://api.github.com/repos/Netflix/security_monkey/subscribers","subscription_url":"https://api.github.com/repos/Netflix/security_monkey/subscription","commits_url":"https://api.github.com/repos/Netflix/security_monkey/commits{/sha}","git_commits_url":"https://api.github.com/repos/Netflix/security_monkey/git/commits{/sha}","comments_url":"https://api.github.com/repos/Netflix/security_monkey/comments{/number}","issue_comment_url":"https://api.github.com/repos/Netflix/security_monkey/issues/comments{/number}","contents_url":"https://api.github.com/repos/Netflix/security_monkey/contents/{+path}","compare_url":"https://api.github.com/repos/Netflix/security_monkey/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Netflix/security_monkey/merges","archive_url":"https://api.github.com/repos/Netflix/security_monkey/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Netflix/security_monkey/downloads","issues_url":"https://api.github.com/repos/Netflix/security_monkey/issues{/number}","pulls_url":"https://api.github.com/repos/Netflix/security_monkey/pulls{/number}","milestones_url":"https://api.github.com/repos/Netflix/security_monkey/milestones{/number}","notifications_url":"https://api.github.com/repos/Netflix/security_monkey/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Netflix/security_monkey/labels{/name}","releases_url":"https://api.github.com/repos/Netflix/security_monkey/releases{/id}","deployments_url":"https://api.github.com/repos/Netflix/security_monkey/deployments","created_at":"2014-06-27T21:49:56Z","updated_at":"2018-02-01T21:37:42Z","pushed_at":"2018-02-01T18:43:09Z","git_url":"git://github.com/Netflix/security_monkey.git","ssh_url":"git@github.com:Netflix/security_monkey.git","clone_url":"https://github.com/Netflix/security_monkey.git","svn_url":"https://github.com/Netflix/security_monkey","homepage":null,"size":13711,"stargazers_count":1978,"watchers_count":1978,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":409,"mirror_url":null,"archived":false,"open_issues_count":63,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":409,"open_issues":63,"watchers":1978,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Netflix/security_monkey/pulls/927"},"html":{"href":"https://github.com/Netflix/security_monkey/pull/927"},"issue":{"href":"https://api.github.com/repos/Netflix/security_monkey/issues/927"},"comments":{"href":"https://api.github.com/repos/Netflix/security_monkey/issues/927/comments"},"review_comments":{"href":"https://api.github.com/repos/Netflix/security_monkey/pulls/927/comments"},"review_comment":{"href":"https://api.github.com/repos/Netflix/security_monkey/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Netflix/security_monkey/pulls/927/commits"},"statuses":{"href":"https://api.github.com/repos/Netflix/security_monkey/statuses/b2990f8b06ff94e45841b02ce61eeab0082df7a4"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":3,"deletions":2,"changed_files":1}}
{"actor":{"display_login":"mark-ignacio"}}