Skip to content

Commit

Permalink
Use appropriate function call for chef 12
Browse files Browse the repository at this point in the history
In chef12 the function locate_config_file in Chef::Knife was renamed
to chef_config_dir.  This patch adds a conditional to check for chef12
and apply the appropriate function call.
  • Loading branch information
Elliott Davis committed Jan 25, 2015
1 parent cb8f259 commit fe71797
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ rvm:
- 2.1.1

script: bundle exec rake spec

6 changes: 5 additions & 1 deletion lib/cheffish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def self.profiled_config(config = Chef::Config)
end

def self.load_chef_config(chef_config = Chef::Config)
chef_config.config_file = Chef::Knife.locate_config_file
if ::Gem::Version.new(::Chef::VERSION) >= ::Gem::Version.new('12.0.0')
chef_config.config_file = ::Chef::Knife.chef_config_dir
else
chef_config.config_file = ::Chef::Knife.locate_config_file
end
config_fetcher = Chef::ConfigFetcher.new(chef_config.config_file, chef_config.config_file_jail)
if chef_config.config_file.nil?
Chef::Log.warn("No config file found or specified on command line, using command line options.")
Expand Down

0 comments on commit fe71797

Please sign in to comment.