{"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments/32729290","id":32729290,"diff_hunk":"@@ -24,12 +23,43 @@ class HostDiscoveredTest < ActiveSupport::TestCase\n     assert Host::Discovered.find_by_name('mace41f13cc3658')\n   end\n \n+  test \"should setup subnet\" do\n+    raw = parse_json_fixture('/facts.json')\n+    subnet = FactoryGirl.create(:subnet)\n+    Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)\n+    subnet.stubs(:organizations).returns([Organization.first])\n+    subnet.stubs(:locations).returns([Location.first])\n+    host = Host::Discovered.import_host_and_facts(raw['facts']).first\n+    assert_equal subnet, host.primary_interface.subnet\n+  end\n+\n+  test \"should setup subnet with org and loc\" do\n+    org = FactoryGirl.create(:organization, :name => \"subnet_org\")\n+    loc = FactoryGirl.create(:location, :name => \"subnet_loc\")\n+    FactoryGirl.create(:setting,\n+                       :name => 'discovery_organization',\n+                       :value => org.name,\n+                       :category => 'Setting::Discovered')\n+    FactoryGirl.create(:setting,\n+                       :name => 'discovery_location',\n+                       :value => loc.name,\n+                       :category => 'Setting::Discovered')\n+    raw = parse_json_fixture('/facts.json')\n+    subnet = FactoryGirl.create(:subnet)\n+    Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)\n+    subnet.stubs(:organizations).returns([org])\n+    subnet.stubs(:locations).returns([loc])","path":"test/unit/host_discovered_test.rb","position":37,"original_position":37,"commit_id":"923b1dcc6e0ad8d54cb4b40dec09d0d537f096d5","original_commit_id":"923b1dcc6e0ad8d54cb4b40dec09d0d537f096d5","user":{"login":"stbenjam","id":429763,"avatar_url":"https://avatars.githubusercontent.com/u/429763?v=3","gravatar_id":"","url":"https://api.github.com/users/stbenjam","html_url":"https://github.com/stbenjam","followers_url":"https://api.github.com/users/stbenjam/followers","following_url":"https://api.github.com/users/stbenjam/following{/other_user}","gists_url":"https://api.github.com/users/stbenjam/gists{/gist_id}","starred_url":"https://api.github.com/users/stbenjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stbenjam/subscriptions","organizations_url":"https://api.github.com/users/stbenjam/orgs","repos_url":"https://api.github.com/users/stbenjam/repos","events_url":"https://api.github.com/users/stbenjam/events{/privacy}","received_events_url":"https://api.github.com/users/stbenjam/received_events","type":"User","site_admin":false},"body":"Ditto","created_at":"2015-06-18T13:31:03Z","updated_at":"2015-06-18T13:31:03Z","html_url":"https://github.com/theforeman/foreman_discovery/pull/193#discussion_r32729290","pull_request_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/comments/32729290"},"html":{"href":"https://github.com/theforeman/foreman_discovery/pull/193#discussion_r32729290"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193","id":37893796,"html_url":"https://github.com/theforeman/foreman_discovery/pull/193","diff_url":"https://github.com/theforeman/foreman_discovery/pull/193.diff","patch_url":"https://github.com/theforeman/foreman_discovery/pull/193.patch","issue_url":"https://api.github.com/repos/theforeman/foreman_discovery/issues/193","number":193,"state":"open","locked":false,"title":"Fixes #9857 - facter extensions now compatible with 1.8+","user":{"login":"lzap","id":49752,"avatar_url":"https://avatars.githubusercontent.com/u/49752?v=3","gravatar_id":"","url":"https://api.github.com/users/lzap","html_url":"https://github.com/lzap","followers_url":"https://api.github.com/users/lzap/followers","following_url":"https://api.github.com/users/lzap/following{/other_user}","gists_url":"https://api.github.com/users/lzap/gists{/gist_id}","starred_url":"https://api.github.com/users/lzap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzap/subscriptions","organizations_url":"https://api.github.com/users/lzap/orgs","repos_url":"https://api.github.com/users/lzap/repos","events_url":"https://api.github.com/users/lzap/events{/privacy}","received_events_url":"https://api.github.com/users/lzap/received_events","type":"User","site_admin":false},"body":"Because of this patch that is in core develop and 1.8:\n\nhttps://github.com/theforeman/foreman/commit/43c4bd72e4646cc9b2b4cb0533e84e08825eadda\n\nOur facter extensions were no longer called. Since we had poor test coverage,\nwe found out too late. Puppet extensions were no longer active essentially.\n\nThis patch corrects this and fails early when extensions are not properly\nincluded. Also test coverage is now better with more edge cases. We raise more\nfailures and also if `discovery_bootif` fact is missing/incorrect, we\nexplicitly error out instead of trying to fallback. This fact is now burnt into\nthe image and required to successfully discover a host.\n\nTests will fail because of:\nhttps://github.com/theforeman/foreman_discovery/pull/191","created_at":"2015-06-17T12:13:14Z","updated_at":"2015-06-18T13:31:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c643526ba48753dcf536603112895589eac2b7e2","assignee":null,"milestone":{"url":"https://api.github.com/repos/theforeman/foreman_discovery/milestones/5","html_url":"https://github.com/theforeman/foreman_discovery/milestones/3.0.1","labels_url":"https://api.github.com/repos/theforeman/foreman_discovery/milestones/5/labels","id":1050361,"number":5,"title":"3.0.1","description":"","creator":{"login":"lzap","id":49752,"avatar_url":"https://avatars.githubusercontent.com/u/49752?v=3","gravatar_id":"","url":"https://api.github.com/users/lzap","html_url":"https://github.com/lzap","followers_url":"https://api.github.com/users/lzap/followers","following_url":"https://api.github.com/users/lzap/following{/other_user}","gists_url":"https://api.github.com/users/lzap/gists{/gist_id}","starred_url":"https://api.github.com/users/lzap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzap/subscriptions","organizations_url":"https://api.github.com/users/lzap/orgs","repos_url":"https://api.github.com/users/lzap/repos","events_url":"https://api.github.com/users/lzap/events{/privacy}","received_events_url":"https://api.github.com/users/lzap/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":2,"state":"open","created_at":"2015-04-02T13:43:31Z","updated_at":"2015-06-17T12:31:07Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193/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/193/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman_discovery/statuses/923b1dcc6e0ad8d54cb4b40dec09d0d537f096d5","head":{"label":"lzap:facter-ext-9857","ref":"facter-ext-9857","sha":"923b1dcc6e0ad8d54cb4b40dec09d0d537f096d5","user":{"login":"lzap","id":49752,"avatar_url":"https://avatars.githubusercontent.com/u/49752?v=3","gravatar_id":"","url":"https://api.github.com/users/lzap","html_url":"https://github.com/lzap","followers_url":"https://api.github.com/users/lzap/followers","following_url":"https://api.github.com/users/lzap/following{/other_user}","gists_url":"https://api.github.com/users/lzap/gists{/gist_id}","starred_url":"https://api.github.com/users/lzap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzap/subscriptions","organizations_url":"https://api.github.com/users/lzap/orgs","repos_url":"https://api.github.com/users/lzap/repos","events_url":"https://api.github.com/users/lzap/events{/privacy}","received_events_url":"https://api.github.com/users/lzap/received_events","type":"User","site_admin":false},"repo":{"id":11420293,"name":"foreman_discovery","full_name":"lzap/foreman_discovery","owner":{"login":"lzap","id":49752,"avatar_url":"https://avatars.githubusercontent.com/u/49752?v=3","gravatar_id":"","url":"https://api.github.com/users/lzap","html_url":"https://github.com/lzap","followers_url":"https://api.github.com/users/lzap/followers","following_url":"https://api.github.com/users/lzap/following{/other_user}","gists_url":"https://api.github.com/users/lzap/gists{/gist_id}","starred_url":"https://api.github.com/users/lzap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzap/subscriptions","organizations_url":"https://api.github.com/users/lzap/orgs","repos_url":"https://api.github.com/users/lzap/repos","events_url":"https://api.github.com/users/lzap/events{/privacy}","received_events_url":"https://api.github.com/users/lzap/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lzap/foreman_discovery","description":"A plugin to enable Metal-as-a-Service discovery functionality in foreman","fork":true,"url":"https://api.github.com/repos/lzap/foreman_discovery","forks_url":"https://api.github.com/repos/lzap/foreman_discovery/forks","keys_url":"https://api.github.com/repos/lzap/foreman_discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lzap/foreman_discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lzap/foreman_discovery/teams","hooks_url":"https://api.github.com/repos/lzap/foreman_discovery/hooks","issue_events_url":"https://api.github.com/repos/lzap/foreman_discovery/issues/events{/number}","events_url":"https://api.github.com/repos/lzap/foreman_discovery/events","assignees_url":"https://api.github.com/repos/lzap/foreman_discovery/assignees{/user}","branches_url":"https://api.github.com/repos/lzap/foreman_discovery/branches{/branch}","tags_url":"https://api.github.com/repos/lzap/foreman_discovery/tags","blobs_url":"https://api.github.com/repos/lzap/foreman_discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lzap/foreman_discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lzap/foreman_discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/lzap/foreman_discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lzap/foreman_discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/lzap/foreman_discovery/languages","stargazers_url":"https://api.github.com/repos/lzap/foreman_discovery/stargazers","contributors_url":"https://api.github.com/repos/lzap/foreman_discovery/contributors","subscribers_url":"https://api.github.com/repos/lzap/foreman_discovery/subscribers","subscription_url":"https://api.github.com/repos/lzap/foreman_discovery/subscription","commits_url":"https://api.github.com/repos/lzap/foreman_discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/lzap/foreman_discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/lzap/foreman_discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/lzap/foreman_discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/lzap/foreman_discovery/contents/{+path}","compare_url":"https://api.github.com/repos/lzap/foreman_discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lzap/foreman_discovery/merges","archive_url":"https://api.github.com/repos/lzap/foreman_discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lzap/foreman_discovery/downloads","issues_url":"https://api.github.com/repos/lzap/foreman_discovery/issues{/number}","pulls_url":"https://api.github.com/repos/lzap/foreman_discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/lzap/foreman_discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/lzap/foreman_discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lzap/foreman_discovery/labels{/name}","releases_url":"https://api.github.com/repos/lzap/foreman_discovery/releases{/id}","created_at":"2013-07-15T10:06:41Z","updated_at":"2014-11-26T16:17:53Z","pushed_at":"2015-06-18T12:58:32Z","git_url":"git://github.com/lzap/foreman_discovery.git","ssh_url":"git@github.com:lzap/foreman_discovery.git","clone_url":"https://github.com/lzap/foreman_discovery.git","svn_url":"https://github.com/lzap/foreman_discovery","homepage":null,"size":1200,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"theforeman:develop","ref":"develop","sha":"2bb19c23490a4672474571b5b0e5091ce44a04d5","user":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","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://avatars.githubusercontent.com/u/1439844?v=3","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}","created_at":"2013-02-27T10:45:55Z","updated_at":"2015-05-27T19:52:44Z","pushed_at":"2015-06-18T12:58:32Z","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":2883,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":13,"forks":30,"open_issues":13,"watchers":24,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193"},"html":{"href":"https://github.com/theforeman/foreman_discovery/pull/193"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/issues/193"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/issues/193/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/pulls/193/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/193/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman_discovery/statuses/923b1dcc6e0ad8d54cb4b40dec09d0d537f096d5"}}}}