{"action":"created","issue":{"url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/7","labels_url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/7/comments","events_url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/7/events","html_url":"https://github.com/chef-cookbooks/compat_resource/issues/7","id":113964704,"number":7,"title":"Missing check for existence of method log_deprecation before calling it","user":{"login":"jmanero-r7","id":8549280,"avatar_url":"https://avatars.githubusercontent.com/u/8549280?v=3","gravatar_id":"","url":"https://api.github.com/users/jmanero-r7","html_url":"https://github.com/jmanero-r7","followers_url":"https://api.github.com/users/jmanero-r7/followers","following_url":"https://api.github.com/users/jmanero-r7/following{/other_user}","gists_url":"https://api.github.com/users/jmanero-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/jmanero-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmanero-r7/subscriptions","organizations_url":"https://api.github.com/users/jmanero-r7/orgs","repos_url":"https://api.github.com/users/jmanero-r7/repos","events_url":"https://api.github.com/users/jmanero-r7/events{/privacy}","received_events_url":"https://api.github.com/users/jmanero-r7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-10-29T02:19:27Z","updated_at":"2015-10-30T14:42:10Z","closed_at":null,"body":"The change committed in 3139258 does not check for the existence of method `log_deprecation` before attempting to fetch it from `superclass`, resulting in exceptions when `superclass.log_deprecation` is not defined.\r\n\r\nIn this case, `superclass` is actually `Class`, which most certainly does not have a `log_deprecation` method. I'm not sure that you're ever actually going to have a `super` of `log_deprecation` for this module because of the way it's being instantiated and injected into `class Chef`'s class-methods. As far as I can tell, `module ChefCompatDeprecation` never gets injected into a class that has `class Chef` as a super. Rather, you may need to use an alias idiom like \r\n\r\n```\r\nif respond_to?(:log_deprecation) ## && Maybe some other conditions\r\n  alias_method :__to_another_place, :log_deprecation\r\nelse\r\n  def __to_another_place; end\r\nend\r\n\r\ndef log_deprecation(...)\r\n    ## Do things and/or call `__to_another_place`\r\nend\r\n```\r\n\r\n### Environment:\r\n\r\n* Chef `chef_12.5.1-1_amd64`\r\n* Ubuntu 14.04\r\n* Cookbook `compat_resource@12.5.11`\r\n* Cookbook `python@1.4.6`\r\n\r\n### Stack Trace\r\n\r\n```\r\n================================================================================\r\nRecipe Compile Error in [...]\r\n================================================================================\r\nNameError\r\n---------\r\nundefined method `log_deprecation' for class `Class'\r\nCookbook Trace:\r\n---------------\r\n/var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb:6:in `method'\r\n/var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb:6:in `log_deprecation'\r\n/var/chef/cookbooks/python/recipes/pip.rb:52:in `block in from_file'\r\n/var/chef/cookbooks/python/recipes/pip.rb:50:in `from_file'\r\n[...]\r\n\r\nRelevant File Content:\r\n----------------------\r\n/var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb:\r\n\r\n1:  class Chef\r\n2:    NOT_PASSED = Object.new if !defined?(NOT_PASSED)\r\n3:    # Earlier versions of Chef didn't have this message\r\n4:    module ChefCompatDeprecation\r\n5:      def log_deprecation(message, location=nil)\r\n6>>       if superclass.method(:log_deprecation).owner != ChefCompatDeprecation\r\n7:          if !location\r\n8:            # Pick the first caller that is *not* part of the Chef or ChefCompat gem,\r\n9:            # that's the thing the user wrote.\r\n10:            chef_compat_gem_path = File.expand_path(\"../../..\", __FILE__)\r\n11:            chef_gem_path = File.expand_path(\"../..\",::Chef::Resource.instance_method(:initialize).source_location[0])\r\n12:            caller(0..10).each do |c|\r\n13:              if !c.start_with?(chef_gem_path) && !c.start_with?(chef_compat_gem_path)\r\n14:                location = c\r\n15:                break\r\n\r\n[2015-10-28T23:20:01+00:00] ERROR: Running exception handlers\r\n[2015-10-28T23:20:01+00:00] ERROR: Exception handlers complete\r\n```"},"comment":{"url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/comments/152544035","html_url":"https://github.com/chef-cookbooks/compat_resource/issues/7#issuecomment-152544035","issue_url":"https://api.github.com/repos/chef-cookbooks/compat_resource/issues/7","id":152544035,"user":{"login":"donwitti","id":6582649,"avatar_url":"https://avatars.githubusercontent.com/u/6582649?v=3","gravatar_id":"","url":"https://api.github.com/users/donwitti","html_url":"https://github.com/donwitti","followers_url":"https://api.github.com/users/donwitti/followers","following_url":"https://api.github.com/users/donwitti/following{/other_user}","gists_url":"https://api.github.com/users/donwitti/gists{/gist_id}","starred_url":"https://api.github.com/users/donwitti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donwitti/subscriptions","organizations_url":"https://api.github.com/users/donwitti/orgs","repos_url":"https://api.github.com/users/donwitti/repos","events_url":"https://api.github.com/users/donwitti/events{/privacy}","received_events_url":"https://api.github.com/users/donwitti/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T14:42:10Z","updated_at":"2015-10-30T14:42:10Z","body":"+1"}}