Commit bc8fbc1b authored by Simon Delamare's avatar Simon Delamare Committed by simfu
Browse files

[generator] Support for sites without cluster

parent 30a31b24
---
clusters: required_hash
networks: required_hash
clusters: optional_hash
networks: optional_hash
servers:
<optional_hash>:
<multi>:
......
......@@ -21,7 +21,7 @@ input_data_dir = "../../input/grid5000/"
refapi = load_yaml_file_hierarchy(File.expand_path(input_data_dir, File.dirname(__FILE__)))
$options = {}
$options[:sites] = %w{grenoble lille luxembourg lyon nancy nantes rennes sophia}
$options[:sites] = %w{grenoble lille luxembourg lyon nancy nantes rennes sophia toulouse}
$options[:output_dir] = "/tmp/puppet"
$options[:verbose] = false
......@@ -388,7 +388,7 @@ def set_zone_header_records(zone, site)
zone.mx = DNS::Zone::RR::MX.new
zone.mx.priority = 10
zone.mx.exchange = "mail.#{zone.site_uid}.grid5000.fr."
if (File.basename(zone.file_path) == "#{zone.site_uid}.db")
if (File.basename(zone.file_path) == "#{zone.site_uid}.db" && site['frontend_ip'])
zone.at = DNS::Zone::RR::A.new
zone.at.address = site['frontend_ip']
end
......@@ -494,7 +494,7 @@ refapi["sites"].each { |site_uid, site|
site_records['networks'] = get_networks_records(site, 'networks') unless site['networks'].nil?
site_records['laptops'] = get_networks_records(site, 'laptops') unless site['laptops'].nil?
site.fetch("clusters").sort.each { |cluster_uid, cluster|
site.fetch("clusters", []).sort.each { |cluster_uid, cluster|
cluster.fetch('nodes').select { |node_uid, node|
node != nil && node["status"] != "retired" && node.has_key?('network_adapters')
......
......@@ -30,7 +30,7 @@ subnet <%= kavlan_ip.network.to_addr %> netmask <%= kavlan_ip.netmask.to_addr %>
<%
refapi['sites'].sort.to_h.each_key do |site|
next if kavlan_id.to_i.between?(1, 9) and site != site_uid
refapi['sites'][site]['clusters'].sort.to_h.each do |cluster_uid, cluster|
refapi['sites'][site].fetch('clusters', []).sort.to_h.each do |cluster_uid, cluster|
cluster['nodes'].sort.to_h.each do |node_uid, node|
next if node['status'] and node['status'] == 'retired'
node['network_adapters'].each do |interface_uid, interface|
......
......@@ -185,11 +185,11 @@ global_hash["sites"].each do |site_uid, site|
# Write network info
#
site["networks"].sort.each do |network_uid, network|
site.fetch("networks", []).sort.each do |network_uid, network|
create_network_equipment(network_uid, network, refapi_path, site_uid)
end
site["clusters"].sort.each do |cluster_uid, cluster|
site.fetch("clusters", []).sort.each do |cluster_uid, cluster|
puts " #{cluster_uid}"
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment