lib/kitchen/provisioner/nodes.rb in kitchen-nodes-0.2.0.dev.2 vs lib/kitchen/provisioner/nodes.rb in kitchen-nodes-0.2.0.dev.3
- old
+ new
@@ -28,10 +28,11 @@
#
# @author Matt Wrock <matt@mattwrock.com>
class Nodes < ChefZero
def create_sandbox
+ FileUtils.rm(node_file) if File.exist?(node_file)
super
create_node
end
def create_node
@@ -45,17 +46,20 @@
:ipaddress => ipaddress
},
:run_list => config[:run_list]
}
+ FileUtils.mkdir_p(node_dir) unless Dir.exist?(node_dir)
File.open(node_file, 'w') do |out|
out << JSON.pretty_generate(node)
end
end
+ def node_dir
+ File.join(config[:test_base_path], "nodes")
+ end
+
def node_file
- node_dir = File.join(config[:test_base_path], "nodes")
- Dir.mkdir(node_dir) unless Dir.exist?(node_dir)
File.join(node_dir, "#{instance.name}.json")
end
def get_reachable_guest_address(state)
active_ips(instance.transport, state).each do |address|