Sha256: 8b4c4252e908e002667630c961b14ef2abb865b00956d4a8d0c4bc224aa70b87
Contents?: true
Size: 1.1 KB
Versions: 14
Compression:
Stored size: 1.1 KB
Contents
require 'chef/knife' module KnifeSpork class SporkNodeEdit < Chef::Knife deps do require 'chef/knife/core/node_editor' require 'knife-spork/runner' end banner 'knife spork node edit NODE (options)' option :all_attributes, :short => "-a", :long => "--all", :boolean => true, :description => "Display all attributes when editing" def run self.class.send(:include, KnifeSpork::Runner) self.config = Chef::Config.merge!(config) if @name_args.empty? show_usage ui.error("You must specify a node name") exit 1 end @object_name = @name_args.first run_plugins(:before_nodeedit) pre_node = load_node(@object_name) node_edit post_node = load_node(@object_name) @object_difference = json_diff(pre_node,post_node).to_s run_plugins(:after_nodeedit) end private def node_edit ne = Chef::Knife::NodeEdit.new ne.name_args = @name_args ne.config[:editor] = config[:editor] ne.config[:all] = config[:all] ne.run end end end
Version data entries
14 entries across 14 versions & 1 rubygems