Created
December 12, 2013 18:14
-
-
Save dhoer/7932646 to your computer and use it in GitHub Desktop.
Invokes knife deps in a ruby class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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