Skip to content

Instantly share code, notes, and snippets.

@dhoer
Created December 12, 2013 18:14
Show Gist options
  • Save dhoer/7932646 to your computer and use it in GitHub Desktop.
Save dhoer/7932646 to your computer and use it in GitHub Desktop.
Invokes knife deps in a ruby class
require 'chef/knife/bootstrap'
class MyKnife
class MyCLI
include Mixlib::CLI
end
def deps(knife_config_path, cookbooks)
Dir.chdir(File.dirname(knife_config_path))
Chef::Config.from_file(knife_config_path)
MyCLI.option(:config_file, :long => "--config #{knife_config_path}")
args = ['deps', cookbooks, '--remote', '--tree', '--recurse', '--config', knife_config_path].flatten
Chef::Knife.run(args, MyCLI.options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment