13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/chef/knife/spork-node-fromfile.rb', line 13
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 filename")
exit 1
end
@object_name = JSON.parse(File.read(@name_args.first))["name"]
ui.info @object_name
run_plugins(:before_nodefromfile)
begin
pre_node = load_node(@object_name.gsub(".json",""))
rescue
pre_node = {}
end
node_fromfile
post_node = load_node(@object_name.gsub(".json",""))
@object_difference = json_diff(pre_node,post_node).to_s
run_plugins(:after_nodefromfile)
end
|