class Chef::Knife::NodeTarDownload
Public Class Methods
download_nodes(tar_file)
click to toggle source
# File lib/chef/knife/node_tar_download.rb, line 27 def self.download_nodes(tar_file) dir = tar_file.nodes_path Chef::Node.list.each do |component_name, url| Chef::Log.info("Backing up node #{component_name}") component_obj = Chef::Node.load(component_name) File.open(File.join(dir, "#{component_name}.json"), "w") do |component_file| component_file.print(component_obj.to_json) end end end
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/node_tar_download.rb, line 13 def run #Get Arguments if @name_args.size != 1 ui.info("Please specify a tar path") show_usage exit 1 end tar_file = Chef::TarFile.new(@name_args.first, true) NodeTarDownload.download_nodes tar_file tar_file.save end