lib/chef/knife/topo_import.rb in knife-topo-0.0.10 vs lib/chef/knife/topo_import.rb in knife-topo-0.0.11
- old
+ new
@@ -61,10 +61,11 @@
topologies.each do |topo_data|
topo_name = topo_data['name'] || topo_data['id']
topo_data['id'] ||= topo_name
+ topo_data['name'] ||= topo_name
if (!topo_name)
ui.error "Could not find a topology name - #{topo_file} does not appear to be a valid topology JSON file"
exit(1)
end
@@ -81,20 +82,22 @@
# write the databag for this topology
path = File.join(topologies_path, bag_name, topo_name + '.json')
File.open(path,"w") do |f|
f.write(Chef::JSONCompat.to_json_pretty(topo_data))
f.close()
- ui.info "Imported topology #{display_name(topo_data)} into #{path}"
+ ui.info "Created topology data bag in #{path}"
end
# run topo cookbook to generate the cookbooks for this topology
@topo_cookbook_args[2] = topo_name
@topo_cookbook_args[3] = topo_file
run_cmd(Chef::Knife::TopoCookbookCreate, @topo_cookbook_args)
-
+ ui.info "Imported topology #{display_name(topo_data)}"
+ ui.info("Build information: " + topo_data['buildstamp']) if topo_data['buildstamp']
+
end
- ui.info "Did not find topologies #{topo_names.join(', ')} in the exchange file" if topo_names && topo_names.length > 0
+ ui.info "Did not find topologies #{topo_names.join(', ')} in the topology json file" if topo_names && topo_names.length > 0
ui.info "Import finished"
end
include Chef::Knife::TopologyHelper