{"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/32218613","id":32218613,"diff_hunk":"@@ -0,0 +1,19 @@\n+module Foreman\n+  class Deprecation\n+    #aviliable options: controller, method, info, callstack\n+    #deadline_version is the last version the method could be used\n+    def self.deprecation_warning(foreman_version_deadline, options = {})\n+      raise Foreman::Exception, N_(\"Invalid version format, please enter in x.y.z\") unless foreman_version_deadline.to_s.match(/\\A\\d[.]\\d+[.]\\d\\z/)\n+      callstack = options[:callstack] || caller\n+      log_msg = \"You are using a deprecated behavior, #{foreman_version_deadline} is the last version it will be available for use.\"\n+      log_msg += \" Use #{options[:controller]}##{options[:method]} instead.\" if options[:controller] && options[:method]\n+      log_msg += \" #{options[:info]}.\" if options[:info]\n+      ActiveSupport::Deprecation.warn(log_msg, callstack)\n+      raise Foreman::Exception, N_(\"You are using a deprecated behavior, for more information check log file. %{callstack}\") % {:callstack => ActiveSupport::Deprecation.send(:deprecation_caller_message, callstack)} if version_is_outdated?(foreman_version_deadline)\n+    end\n+\n+    def self.version_is_outdated?(deadline_version)\n+      Gem::Dependency.new('', \"< #{SETTINGS[:version].notag}\").match?('', deadline_version)","path":"app/services/foreman/deprecation.rb","position":16,"original_position":16,"commit_id":"5a2bb5f472e720cea754fd9867e60efde2772fcb","original_commit_id":"5a2bb5f472e720cea754fd9867e60efde2772fcb","user":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"body":"I think we can decide on two things, first is that the deprecation will take effect only in major versions release(ignoring the patch releases), second is the \"deadline\" version will be the version we delete the deprecations.\r\nagree?","created_at":"2015-06-11T13:17:26Z","updated_at":"2015-06-11T13:17:26Z","html_url":"https://github.com/theforeman/foreman/pull/2444#discussion_r32218613","pull_request_url":"https://api.github.com/repos/theforeman/foreman/pulls/2444","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/32218613"},"html":{"href":"https://github.com/theforeman/foreman/pull/2444#discussion_r32218613"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2444"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/2444","id":37239871,"html_url":"https://github.com/theforeman/foreman/pull/2444","diff_url":"https://github.com/theforeman/foreman/pull/2444.diff","patch_url":"https://github.com/theforeman/foreman/pull/2444.patch","issue_url":"https://api.github.com/repos/theforeman/foreman/issues/2444","number":2444,"state":"open","locked":false,"title":"Fixes #10635 - Formalize deprecation warning","user":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"body":"I have added Foreman::Deprecation service which wraps ActiveSupport::Deprecation that we are currently using, formalizing the messages and enforces deprecation.\r\nI have changed all the deprecations calls on the core to the new format and placed a default\r\ntwo versions up (1.10.0) as a deadline, once calling a deprecated function where the deadline version is lower then the current version it will throw an error.","created_at":"2015-06-09T10:39:49Z","updated_at":"2015-06-11T13:17:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"908b847a46581c131d182c3cf01b3eb3a7eb2544","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/theforeman/foreman/pulls/2444/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman/pulls/2444/comments","review_comment_url":"https://api.github.com/repos/theforeman/foreman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/theforeman/foreman/issues/2444/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/5a2bb5f472e720cea754fd9867e60efde2772fcb","head":{"label":"alongoldboim:10635","ref":"10635","sha":"5a2bb5f472e720cea754fd9867e60efde2772fcb","user":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"repo":{"id":34898602,"name":"foreman","full_name":"alongoldboim/foreman","owner":{"login":"alongoldboim","id":11405684,"avatar_url":"https://avatars.githubusercontent.com/u/11405684?v=3","gravatar_id":"","url":"https://api.github.com/users/alongoldboim","html_url":"https://github.com/alongoldboim","followers_url":"https://api.github.com/users/alongoldboim/followers","following_url":"https://api.github.com/users/alongoldboim/following{/other_user}","gists_url":"https://api.github.com/users/alongoldboim/gists{/gist_id}","starred_url":"https://api.github.com/users/alongoldboim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alongoldboim/subscriptions","organizations_url":"https://api.github.com/users/alongoldboim/orgs","repos_url":"https://api.github.com/users/alongoldboim/repos","events_url":"https://api.github.com/users/alongoldboim/events{/privacy}","received_events_url":"https://api.github.com/users/alongoldboim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alongoldboim/foreman","description":"an application that automates the lifecycle of servers ","fork":true,"url":"https://api.github.com/repos/alongoldboim/foreman","forks_url":"https://api.github.com/repos/alongoldboim/foreman/forks","keys_url":"https://api.github.com/repos/alongoldboim/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alongoldboim/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alongoldboim/foreman/teams","hooks_url":"https://api.github.com/repos/alongoldboim/foreman/hooks","issue_events_url":"https://api.github.com/repos/alongoldboim/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/alongoldboim/foreman/events","assignees_url":"https://api.github.com/repos/alongoldboim/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/alongoldboim/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/alongoldboim/foreman/tags","blobs_url":"https://api.github.com/repos/alongoldboim/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alongoldboim/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alongoldboim/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/alongoldboim/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alongoldboim/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/alongoldboim/foreman/languages","stargazers_url":"https://api.github.com/repos/alongoldboim/foreman/stargazers","contributors_url":"https://api.github.com/repos/alongoldboim/foreman/contributors","subscribers_url":"https://api.github.com/repos/alongoldboim/foreman/subscribers","subscription_url":"https://api.github.com/repos/alongoldboim/foreman/subscription","commits_url":"https://api.github.com/repos/alongoldboim/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/alongoldboim/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/alongoldboim/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/alongoldboim/foreman/issues/comments{/number}","contents_url":"https://api.github.com/repos/alongoldboim/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/alongoldboim/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alongoldboim/foreman/merges","archive_url":"https://api.github.com/repos/alongoldboim/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alongoldboim/foreman/downloads","issues_url":"https://api.github.com/repos/alongoldboim/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/alongoldboim/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/alongoldboim/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/alongoldboim/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alongoldboim/foreman/labels{/name}","releases_url":"https://api.github.com/repos/alongoldboim/foreman/releases{/id}","created_at":"2015-05-01T10:37:21Z","updated_at":"2015-05-01T10:37:25Z","pushed_at":"2015-06-11T11:25:03Z","git_url":"git://github.com/alongoldboim/foreman.git","ssh_url":"git@github.com:alongoldboim/foreman.git","clone_url":"https://github.com/alongoldboim/foreman.git","svn_url":"https://github.com/alongoldboim/foreman","homepage":"http://theforeman.org","size":33483,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"9926db4274e2d9d01466676116a9c001f473f1a4","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":258750,"name":"foreman","full_name":"theforeman/foreman","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","description":"an application that automates the lifecycle of servers ","fork":false,"url":"https://api.github.com/repos/theforeman/foreman","forks_url":"https://api.github.com/repos/theforeman/foreman/forks","keys_url":"https://api.github.com/repos/theforeman/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theforeman/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theforeman/foreman/teams","hooks_url":"https://api.github.com/repos/theforeman/foreman/hooks","issue_events_url":"https://api.github.com/repos/theforeman/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/theforeman/foreman/events","assignees_url":"https://api.github.com/repos/theforeman/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/theforeman/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/theforeman/foreman/tags","blobs_url":"https://api.github.com/repos/theforeman/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theforeman/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theforeman/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/theforeman/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/theforeman/foreman/languages","stargazers_url":"https://api.github.com/repos/theforeman/foreman/stargazers","contributors_url":"https://api.github.com/repos/theforeman/foreman/contributors","subscribers_url":"https://api.github.com/repos/theforeman/foreman/subscribers","subscription_url":"https://api.github.com/repos/theforeman/foreman/subscription","commits_url":"https://api.github.com/repos/theforeman/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/theforeman/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/theforeman/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/theforeman/foreman/issues/comments{/number}","contents_url":"https://api.github.com/repos/theforeman/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/theforeman/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theforeman/foreman/merges","archive_url":"https://api.github.com/repos/theforeman/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theforeman/foreman/downloads","issues_url":"https://api.github.com/repos/theforeman/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/theforeman/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/theforeman/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/theforeman/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theforeman/foreman/labels{/name}","releases_url":"https://api.github.com/repos/theforeman/foreman/releases{/id}","created_at":"2009-07-23T15:07:00Z","updated_at":"2015-06-10T11:18:47Z","pushed_at":"2015-06-11T13:11:26Z","git_url":"git://github.com/theforeman/foreman.git","ssh_url":"git@github.com:theforeman/foreman.git","clone_url":"https://github.com/theforeman/foreman.git","svn_url":"https://github.com/theforeman/foreman","homepage":"http://theforeman.org","size":79080,"stargazers_count":774,"watchers_count":774,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":398,"mirror_url":null,"open_issues_count":80,"forks":398,"open_issues":80,"watchers":774,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2444"},"html":{"href":"https://github.com/theforeman/foreman/pull/2444"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2444"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2444/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2444/comments"},"review_comment":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2444/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman/statuses/5a2bb5f472e720cea754fd9867e60efde2772fcb"}}}}