{"action":"created","comment":{"url":"https://api.github.com/repos/rthallisey/clapper/pulls/comments/59200465","id":59200465,"diff_hunk":"@@ -135,6 +139,56 @@ def check_allocation_pools_pairing(filedata, pools):\n     return errors\n \n \n+def check_static_ip_pool_collision(static_ips, pools):\n+    \"\"\"Statically defined IP address must not conflict with allocation pools.\n+\n+    The allocation pools come as a dict of items in the following format:\n+\n+    InternalApiAllocationPools: [{'start': '10.35.191.150', 'end': '10.35.191.240'}]\n+\n+    The static IP addresses are dicts of:\n+\n+    ComputeIPs: {\n+        'internal_api': ['10.35.191.100', etc.],\n+        'storage': ['192.168.100.45', etc.]\n+    }\n+    \"\"\"\n+    errors = []\n+\n+    pool_ranges = []\n+    for pool_name, ranges in six.iteritems(pools):\n+        for allocation_range in ranges:\n+            ip_range = netaddr.IPRange(allocation_range['start'],\n+                                allocation_range['end'])\n+            pool_ranges.append((pool_name, ip_range))\n+    for role, services in six.iteritems(static_ips):\n+        for service, ips in six.iteritems(services):\n+            for ip in ips:\n+                ranges_with_conflict = ip_conflicts_with_ranges(ip, pool_ranges)\n+                if ranges_with_conflict:\n+                    for pool_name, ip_range in ranges_with_conflict:\n+                        msg = \"IP address {} from {}[{}] is in the {} pool.\"\n+                    errors.append(msg.format(\n+                        ip, role, service, pool_name))\n+    return errors\n+\n+\n+def ip_conflicts_with_ranges(ip_address, ip_ranges):\n+    \"\"\"Check for all conflicts of the IP address conflicts.\n+\n+    This takes a single IP address and a list of `(pool_name,\n+    netenv.IPRange)`s.\n+\n+    We return all ranges that the IP address conflicts with. This is to\n+    improve the final error messages.\n+    \"\"\"\n+    results = []","path":"ansible-tests/validations/library/validate_network_environment.py","position":72,"original_position":72,"commit_id":"77db621724bb10f73371003aa57e1c360f2a3f14","original_commit_id":"77db621724bb10f73371003aa57e1c360f2a3f14","user":{"login":"mandre","id":225909,"avatar_url":"https://avatars.githubusercontent.com/u/225909?v=3","gravatar_id":"","url":"https://api.github.com/users/mandre","html_url":"https://github.com/mandre","followers_url":"https://api.github.com/users/mandre/followers","following_url":"https://api.github.com/users/mandre/following{/other_user}","gists_url":"https://api.github.com/users/mandre/gists{/gist_id}","starred_url":"https://api.github.com/users/mandre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mandre/subscriptions","organizations_url":"https://api.github.com/users/mandre/orgs","repos_url":"https://api.github.com/users/mandre/repos","events_url":"https://api.github.com/users/mandre/events{/privacy}","received_events_url":"https://api.github.com/users/mandre/received_events","type":"User","site_admin":false},"body":"A list comprehension would do wonder here.","created_at":"2016-04-11T13:10:27Z","updated_at":"2016-04-11T13:10:27Z","html_url":"https://github.com/rthallisey/clapper/pull/55#discussion_r59200465","pull_request_url":"https://api.github.com/repos/rthallisey/clapper/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/comments/59200465"},"html":{"href":"https://github.com/rthallisey/clapper/pull/55#discussion_r59200465"},"pull_request":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/rthallisey/clapper/pulls/55","id":64952648,"html_url":"https://github.com/rthallisey/clapper/pull/55","diff_url":"https://github.com/rthallisey/clapper/pull/55.diff","patch_url":"https://github.com/rthallisey/clapper/pull/55.patch","issue_url":"https://api.github.com/repos/rthallisey/clapper/issues/55","number":55,"state":"open","locked":false,"title":"Validate static IPs are not inside allocation pools","user":{"login":"tomassedovic","id":104339,"avatar_url":"https://avatars.githubusercontent.com/u/104339?v=3","gravatar_id":"","url":"https://api.github.com/users/tomassedovic","html_url":"https://github.com/tomassedovic","followers_url":"https://api.github.com/users/tomassedovic/followers","following_url":"https://api.github.com/users/tomassedovic/following{/other_user}","gists_url":"https://api.github.com/users/tomassedovic/gists{/gist_id}","starred_url":"https://api.github.com/users/tomassedovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomassedovic/subscriptions","organizations_url":"https://api.github.com/users/tomassedovic/orgs","repos_url":"https://api.github.com/users/tomassedovic/repos","events_url":"https://api.github.com/users/tomassedovic/events{/privacy}","received_events_url":"https://api.github.com/users/tomassedovic/received_events","type":"User","site_admin":false},"body":"When entering static IP addresses for the various endpoints, these should not be taken from the allocation pools as that could result in IP conflict during the deployment.","created_at":"2016-04-01T14:26:59Z","updated_at":"2016-04-11T13:10:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dda0f8bb2cb1893270dd16edbc1cc20b289f230d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rthallisey/clapper/pulls/55/commits","review_comments_url":"https://api.github.com/repos/rthallisey/clapper/pulls/55/comments","review_comment_url":"https://api.github.com/repos/rthallisey/clapper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rthallisey/clapper/issues/55/comments","statuses_url":"https://api.github.com/repos/rthallisey/clapper/statuses/77db621724bb10f73371003aa57e1c360f2a3f14","head":{"label":"rthallisey:static-ip","ref":"static-ip","sha":"77db621724bb10f73371003aa57e1c360f2a3f14","user":{"login":"rthallisey","id":6795213,"avatar_url":"https://avatars.githubusercontent.com/u/6795213?v=3","gravatar_id":"","url":"https://api.github.com/users/rthallisey","html_url":"https://github.com/rthallisey","followers_url":"https://api.github.com/users/rthallisey/followers","following_url":"https://api.github.com/users/rthallisey/following{/other_user}","gists_url":"https://api.github.com/users/rthallisey/gists{/gist_id}","starred_url":"https://api.github.com/users/rthallisey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rthallisey/subscriptions","organizations_url":"https://api.github.com/users/rthallisey/orgs","repos_url":"https://api.github.com/users/rthallisey/repos","events_url":"https://api.github.com/users/rthallisey/events{/privacy}","received_events_url":"https://api.github.com/users/rthallisey/received_events","type":"User","site_admin":false},"repo":{"id":39218737,"name":"clapper","full_name":"rthallisey/clapper","owner":{"login":"rthallisey","id":6795213,"avatar_url":"https://avatars.githubusercontent.com/u/6795213?v=3","gravatar_id":"","url":"https://api.github.com/users/rthallisey","html_url":"https://github.com/rthallisey","followers_url":"https://api.github.com/users/rthallisey/followers","following_url":"https://api.github.com/users/rthallisey/following{/other_user}","gists_url":"https://api.github.com/users/rthallisey/gists{/gist_id}","starred_url":"https://api.github.com/users/rthallisey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rthallisey/subscriptions","organizations_url":"https://api.github.com/users/rthallisey/orgs","repos_url":"https://api.github.com/users/rthallisey/repos","events_url":"https://api.github.com/users/rthallisey/events{/privacy}","received_events_url":"https://api.github.com/users/rthallisey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rthallisey/clapper","description":"Synchronize setup and deployment for the Director.","fork":false,"url":"https://api.github.com/repos/rthallisey/clapper","forks_url":"https://api.github.com/repos/rthallisey/clapper/forks","keys_url":"https://api.github.com/repos/rthallisey/clapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rthallisey/clapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rthallisey/clapper/teams","hooks_url":"https://api.github.com/repos/rthallisey/clapper/hooks","issue_events_url":"https://api.github.com/repos/rthallisey/clapper/issues/events{/number}","events_url":"https://api.github.com/repos/rthallisey/clapper/events","assignees_url":"https://api.github.com/repos/rthallisey/clapper/assignees{/user}","branches_url":"https://api.github.com/repos/rthallisey/clapper/branches{/branch}","tags_url":"https://api.github.com/repos/rthallisey/clapper/tags","blobs_url":"https://api.github.com/repos/rthallisey/clapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rthallisey/clapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rthallisey/clapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/rthallisey/clapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rthallisey/clapper/statuses/{sha}","languages_url":"https://api.github.com/repos/rthallisey/clapper/languages","stargazers_url":"https://api.github.com/repos/rthallisey/clapper/stargazers","contributors_url":"https://api.github.com/repos/rthallisey/clapper/contributors","subscribers_url":"https://api.github.com/repos/rthallisey/clapper/subscribers","subscription_url":"https://api.github.com/repos/rthallisey/clapper/subscription","commits_url":"https://api.github.com/repos/rthallisey/clapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/rthallisey/clapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/rthallisey/clapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/rthallisey/clapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/rthallisey/clapper/contents/{+path}","compare_url":"https://api.github.com/repos/rthallisey/clapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rthallisey/clapper/merges","archive_url":"https://api.github.com/repos/rthallisey/clapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rthallisey/clapper/downloads","issues_url":"https://api.github.com/repos/rthallisey/clapper/issues{/number}","pulls_url":"https://api.github.com/repos/rthallisey/clapper/pulls{/number}","milestones_url":"https://api.github.com/repos/rthallisey/clapper/milestones{/number}","notifications_url":"https://api.github.com/repos/rthallisey/clapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rthallisey/clapper/labels{/name}","releases_url":"https://api.github.com/repos/rthallisey/clapper/releases{/id}","deployments_url":"https://api.github.com/repos/rthallisey/clapper/deployments","created_at":"2015-07-16T20:24:08Z","updated_at":"2016-04-07T15:33:17Z","pushed_at":"2016-04-08T10:51:31Z","git_url":"git://github.com/rthallisey/clapper.git","ssh_url":"git@github.com:rthallisey/clapper.git","clone_url":"https://github.com/rthallisey/clapper.git","svn_url":"https://github.com/rthallisey/clapper","homepage":null,"size":238,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":4,"forks":10,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"rthallisey:master","ref":"master","sha":"6222c7c4f1909223b481fc2e546b7e060c47bf33","user":{"login":"rthallisey","id":6795213,"avatar_url":"https://avatars.githubusercontent.com/u/6795213?v=3","gravatar_id":"","url":"https://api.github.com/users/rthallisey","html_url":"https://github.com/rthallisey","followers_url":"https://api.github.com/users/rthallisey/followers","following_url":"https://api.github.com/users/rthallisey/following{/other_user}","gists_url":"https://api.github.com/users/rthallisey/gists{/gist_id}","starred_url":"https://api.github.com/users/rthallisey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rthallisey/subscriptions","organizations_url":"https://api.github.com/users/rthallisey/orgs","repos_url":"https://api.github.com/users/rthallisey/repos","events_url":"https://api.github.com/users/rthallisey/events{/privacy}","received_events_url":"https://api.github.com/users/rthallisey/received_events","type":"User","site_admin":false},"repo":{"id":39218737,"name":"clapper","full_name":"rthallisey/clapper","owner":{"login":"rthallisey","id":6795213,"avatar_url":"https://avatars.githubusercontent.com/u/6795213?v=3","gravatar_id":"","url":"https://api.github.com/users/rthallisey","html_url":"https://github.com/rthallisey","followers_url":"https://api.github.com/users/rthallisey/followers","following_url":"https://api.github.com/users/rthallisey/following{/other_user}","gists_url":"https://api.github.com/users/rthallisey/gists{/gist_id}","starred_url":"https://api.github.com/users/rthallisey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rthallisey/subscriptions","organizations_url":"https://api.github.com/users/rthallisey/orgs","repos_url":"https://api.github.com/users/rthallisey/repos","events_url":"https://api.github.com/users/rthallisey/events{/privacy}","received_events_url":"https://api.github.com/users/rthallisey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rthallisey/clapper","description":"Synchronize setup and deployment for the Director.","fork":false,"url":"https://api.github.com/repos/rthallisey/clapper","forks_url":"https://api.github.com/repos/rthallisey/clapper/forks","keys_url":"https://api.github.com/repos/rthallisey/clapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rthallisey/clapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rthallisey/clapper/teams","hooks_url":"https://api.github.com/repos/rthallisey/clapper/hooks","issue_events_url":"https://api.github.com/repos/rthallisey/clapper/issues/events{/number}","events_url":"https://api.github.com/repos/rthallisey/clapper/events","assignees_url":"https://api.github.com/repos/rthallisey/clapper/assignees{/user}","branches_url":"https://api.github.com/repos/rthallisey/clapper/branches{/branch}","tags_url":"https://api.github.com/repos/rthallisey/clapper/tags","blobs_url":"https://api.github.com/repos/rthallisey/clapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rthallisey/clapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rthallisey/clapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/rthallisey/clapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rthallisey/clapper/statuses/{sha}","languages_url":"https://api.github.com/repos/rthallisey/clapper/languages","stargazers_url":"https://api.github.com/repos/rthallisey/clapper/stargazers","contributors_url":"https://api.github.com/repos/rthallisey/clapper/contributors","subscribers_url":"https://api.github.com/repos/rthallisey/clapper/subscribers","subscription_url":"https://api.github.com/repos/rthallisey/clapper/subscription","commits_url":"https://api.github.com/repos/rthallisey/clapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/rthallisey/clapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/rthallisey/clapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/rthallisey/clapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/rthallisey/clapper/contents/{+path}","compare_url":"https://api.github.com/repos/rthallisey/clapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rthallisey/clapper/merges","archive_url":"https://api.github.com/repos/rthallisey/clapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rthallisey/clapper/downloads","issues_url":"https://api.github.com/repos/rthallisey/clapper/issues{/number}","pulls_url":"https://api.github.com/repos/rthallisey/clapper/pulls{/number}","milestones_url":"https://api.github.com/repos/rthallisey/clapper/milestones{/number}","notifications_url":"https://api.github.com/repos/rthallisey/clapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rthallisey/clapper/labels{/name}","releases_url":"https://api.github.com/repos/rthallisey/clapper/releases{/id}","deployments_url":"https://api.github.com/repos/rthallisey/clapper/deployments","created_at":"2015-07-16T20:24:08Z","updated_at":"2016-04-07T15:33:17Z","pushed_at":"2016-04-08T10:51:31Z","git_url":"git://github.com/rthallisey/clapper.git","ssh_url":"git@github.com:rthallisey/clapper.git","clone_url":"https://github.com/rthallisey/clapper.git","svn_url":"https://github.com/rthallisey/clapper","homepage":null,"size":238,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":4,"forks":10,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/55"},"html":{"href":"https://github.com/rthallisey/clapper/pull/55"},"issue":{"href":"https://api.github.com/repos/rthallisey/clapper/issues/55"},"comments":{"href":"https://api.github.com/repos/rthallisey/clapper/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rthallisey/clapper/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/rthallisey/clapper/statuses/77db621724bb10f73371003aa57e1c360f2a3f14"}}}}