June 2016
Intermediate to advanced
262 pages
5h 55m
English
Sometimes, you will be dealing with unique situations and need to create your own knife plugin. In this section, we will review how that is accomplished.
A custom knife plugin begins by creating a new plugin ruby file. The plugin file has to have a specific format. That format, in its simplest form, looks like this:
require 'chef/knife' module ModuleName class SubclassName < Chef::Knife deps do require 'chef/dependency' end banner 'knife subcommand argument VALUE (options)' option :name_of_option, :short => "-l VALUE", :long => "--long-option-name VALUE", :description => "The description for the option.", :proc => Proc.new { code_to_run } :boolean => true | false :default => default_value def ...Read now
Unlock full access