{"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments/156356619","pull_request_review_id":82818657,"id":156356619,"diff_hunk":"@@ -16,6 +16,7 @@ class DiscoveryRule < ApplicationRecord\n   validates_lengths_from_database\n   before_validation :default_int_attributes\n   before_validation :enforce_taxonomy\n+  before_validation :hostgroup_present","path":"app/models/discovery_rule.rb","position":4,"original_position":4,"commit_id":"b8148718672a693e644b25c1bf72e41e6ffd7a88","original_commit_id":"b8148718672a693e644b25c1bf72e41e6ffd7a88","user":{"login":"timogoebel","id":4107560,"avatar_url":"https://avatars0.githubusercontent.com/u/4107560?v=4","gravatar_id":"","url":"https://api.github.com/users/timogoebel","html_url":"https://github.com/timogoebel","followers_url":"https://api.github.com/users/timogoebel/followers","following_url":"https://api.github.com/users/timogoebel/following{/other_user}","gists_url":"https://api.github.com/users/timogoebel/gists{/gist_id}","starred_url":"https://api.github.com/users/timogoebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timogoebel/subscriptions","organizations_url":"https://api.github.com/users/timogoebel/orgs","repos_url":"https://api.github.com/users/timogoebel/repos","events_url":"https://api.github.com/users/timogoebel/events{/privacy}","received_events_url":"https://api.github.com/users/timogoebel/received_events","type":"User","site_admin":false},"body":"Why not `validates_presence_of :hostgroup`?","created_at":"2017-12-12T12:50:58Z","updated_at":"2017-12-12T12:53:18Z","html_url":"https://github.com/theforeman/foreman_discovery/pull/395#discussion_r156356619","pull_request_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments/156356619"},"html":{"href":"https://github.com/theforeman/foreman_discovery/pull/395#discussion_r156356619"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395","id":157793380,"html_url":"https://github.com/theforeman/foreman_discovery/pull/395","diff_url":"https://github.com/theforeman/foreman_discovery/pull/395.diff","patch_url":"https://github.com/theforeman/foreman_discovery/pull/395.patch","issue_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues/395","number":395,"state":"open","locked":false,"title":"Fixes #21941 - [Discovery Rule] Add validation for Host Group","user":{"login":"rahulbajaj0509","id":10976840,"avatar_url":"https://avatars2.githubusercontent.com/u/10976840?v=4","gravatar_id":"","url":"https://api.github.com/users/rahulbajaj0509","html_url":"https://github.com/rahulbajaj0509","followers_url":"https://api.github.com/users/rahulbajaj0509/followers","following_url":"https://api.github.com/users/rahulbajaj0509/following{/other_user}","gists_url":"https://api.github.com/users/rahulbajaj0509/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulbajaj0509/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulbajaj0509/subscriptions","organizations_url":"https://api.github.com/users/rahulbajaj0509/orgs","repos_url":"https://api.github.com/users/rahulbajaj0509/repos","events_url":"https://api.github.com/users/rahulbajaj0509/events{/privacy}","received_events_url":"https://api.github.com/users/rahulbajaj0509/received_events","type":"User","site_admin":false},"body":"We are just checking whether the `hostgroup_id` is being passed from hammer but we are not checking whether that hostgroup_id has a corresponding hostgroup in the database or not. \r\n\r\nThis patch makes sure, only valid hostgroup_id's are passed which correspond to a valid hostgroup.","created_at":"2017-12-12T10:44:18Z","updated_at":"2017-12-12T12:53:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73d63a7d944d4a3ccf4890043f5c5d46aedace89","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395/comments","review_comment_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues/395/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman_discovery/statuses/b8148718672a693e644b25c1bf72e41e6ffd7a88","head":{"label":"rahulbajaj0509:21941-discovery-rule","ref":"21941-discovery-rule","sha":"b8148718672a693e644b25c1bf72e41e6ffd7a88","user":{"login":"rahulbajaj0509","id":10976840,"avatar_url":"https://avatars2.githubusercontent.com/u/10976840?v=4","gravatar_id":"","url":"https://api.github.com/users/rahulbajaj0509","html_url":"https://github.com/rahulbajaj0509","followers_url":"https://api.github.com/users/rahulbajaj0509/followers","following_url":"https://api.github.com/users/rahulbajaj0509/following{/other_user}","gists_url":"https://api.github.com/users/rahulbajaj0509/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulbajaj0509/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulbajaj0509/subscriptions","organizations_url":"https://api.github.com/users/rahulbajaj0509/orgs","repos_url":"https://api.github.com/users/rahulbajaj0509/repos","events_url":"https://api.github.com/users/rahulbajaj0509/events{/privacy}","received_events_url":"https://api.github.com/users/rahulbajaj0509/received_events","type":"User","site_admin":false},"repo":{"id":95639871,"name":"foreman_discovery","full_name":"rahulbajaj0509/foreman_discovery","owner":{"login":"rahulbajaj0509","id":10976840,"avatar_url":"https://avatars2.githubusercontent.com/u/10976840?v=4","gravatar_id":"","url":"https://api.github.com/users/rahulbajaj0509","html_url":"https://github.com/rahulbajaj0509","followers_url":"https://api.github.com/users/rahulbajaj0509/followers","following_url":"https://api.github.com/users/rahulbajaj0509/following{/other_user}","gists_url":"https://api.github.com/users/rahulbajaj0509/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulbajaj0509/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulbajaj0509/subscriptions","organizations_url":"https://api.github.com/users/rahulbajaj0509/orgs","repos_url":"https://api.github.com/users/rahulbajaj0509/repos","events_url":"https://api.github.com/users/rahulbajaj0509/events{/privacy}","received_events_url":"https://api.github.com/users/rahulbajaj0509/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rahulbajaj0509/foreman_discovery","description":"A plugin to enable Metal-as-a-Service discovery functionality in foreman","fork":true,"url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery","forks_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/forks","keys_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/teams","hooks_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/hooks","issue_events_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/issues/events{/number}","events_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/events","assignees_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/assignees{/user}","branches_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/branches{/branch}","tags_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/tags","blobs_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/languages","stargazers_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/stargazers","contributors_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/contributors","subscribers_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/subscribers","subscription_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/subscription","commits_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/contents/{+path}","compare_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/merges","archive_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/downloads","issues_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/issues{/number}","pulls_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/labels{/name}","releases_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/releases{/id}","deployments_url":"https://api.github.com/repos/rahulbajaj0509/foreman_discovery/deployments","created_at":"2017-06-28T07:08:48Z","updated_at":"2017-06-28T07:08:50Z","pushed_at":"2017-12-12T11:49:22Z","git_url":"git://github.com/rahulbajaj0509/foreman_discovery.git","ssh_url":"git@github.com:rahulbajaj0509/foreman_discovery.git","clone_url":"https://github.com/rahulbajaj0509/foreman_discovery.git","svn_url":"https://github.com/rahulbajaj0509/foreman_discovery","homepage":null,"size":2273,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"theforeman:develop","ref":"develop","sha":"4d32e2978beb1a7c102aa07e3cb2e277ae6f23a2","user":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars2.githubusercontent.com/u/1439844?v=4","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"repo":{"id":8454019,"name":"foreman_discovery","full_name":"theforeman/foreman_discovery","owner":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars2.githubusercontent.com/u/1439844?v=4","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/theforeman/foreman_discovery","description":"A plugin to enable Metal-as-a-Service discovery functionality in foreman","fork":false,"url":"https://api.github.com/repos/theforeman/foreman_discovery","forks_url":"https://api.github.com/repos/theforeman/foreman_discovery/forks","keys_url":"https://api.github.com/repos/theforeman/foreman_discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theforeman/foreman_discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theforeman/foreman_discovery/teams","hooks_url":"https://api.github.com/repos/theforeman/foreman_discovery/hooks","issue_events_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues/events{/number}","events_url":"https://api.github.com/repos/theforeman/foreman_discovery/events","assignees_url":"https://api.github.com/repos/theforeman/foreman_discovery/assignees{/user}","branches_url":"https://api.github.com/repos/theforeman/foreman_discovery/branches{/branch}","tags_url":"https://api.github.com/repos/theforeman/foreman_discovery/tags","blobs_url":"https://api.github.com/repos/theforeman/foreman_discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theforeman/foreman_discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theforeman/foreman_discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/theforeman/foreman_discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theforeman/foreman_discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/theforeman/foreman_discovery/languages","stargazers_url":"https://api.github.com/repos/theforeman/foreman_discovery/stargazers","contributors_url":"https://api.github.com/repos/theforeman/foreman_discovery/contributors","subscribers_url":"https://api.github.com/repos/theforeman/foreman_discovery/subscribers","subscription_url":"https://api.github.com/repos/theforeman/foreman_discovery/subscription","commits_url":"https://api.github.com/repos/theforeman/foreman_discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/theforeman/foreman_discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/theforeman/foreman_discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/theforeman/foreman_discovery/contents/{+path}","compare_url":"https://api.github.com/repos/theforeman/foreman_discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theforeman/foreman_discovery/merges","archive_url":"https://api.github.com/repos/theforeman/foreman_discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theforeman/foreman_discovery/downloads","issues_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues{/number}","pulls_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/theforeman/foreman_discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/theforeman/foreman_discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theforeman/foreman_discovery/labels{/name}","releases_url":"https://api.github.com/repos/theforeman/foreman_discovery/releases{/id}","deployments_url":"https://api.github.com/repos/theforeman/foreman_discovery/deployments","created_at":"2013-02-27T10:45:55Z","updated_at":"2017-09-07T10:18:10Z","pushed_at":"2017-12-12T10:44:19Z","git_url":"git://github.com/theforeman/foreman_discovery.git","ssh_url":"git@github.com:theforeman/foreman_discovery.git","clone_url":"https://github.com/theforeman/foreman_discovery.git","svn_url":"https://github.com/theforeman/foreman_discovery","homepage":null,"size":2380,"stargazers_count":39,"watchers_count":39,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":62,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":62,"open_issues":9,"watchers":39,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395"},"html":{"href":"https://github.com/theforeman/foreman_discovery/pull/395"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/issues/395"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/issues/395/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395/comments"},"review_comment":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/395/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/statuses/b8148718672a693e644b25c1bf72e41e6ffd7a88"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"timogoebel"}}