diff --git a/lib/refrepo/gen/puppet/bindg5k.rb b/lib/refrepo/gen/puppet/bindg5k.rb index cc2d456bac578d8013894bfbf144ddb7d6b26c75..2ae8ea2347fd824d2ba54487440fe40beb93b8ae 100644 --- a/lib/refrepo/gen/puppet/bindg5k.rb +++ b/lib/refrepo/gen/puppet/bindg5k.rb @@ -1,6 +1,7 @@ # See also: https://www.grid5000.fr/mediawiki/index.php/DNS_server require 'dns/zone' +require 'find' #Prettier aligned dump of records class DNS::Zone::RR::A @@ -436,6 +437,15 @@ def generate_puppet_bindg5k(options) dest_dir = "#{$options[:output_dir]}/platforms/production/modules/generated/files/bind/" zones_dir = File.join(dest_dir, "zones/#{site_uid}") + # Cleanup of old zone files + Find.find(zones_dir) do |path| + next if not File::file?(path) + next if path =~ /manual/ # skip *manual* files + # FIXME those files are not named *manual*, but should not be removed + next if ['nancy-laptops.db', 'toulouse-servers.db', 'toulouse.db'].include?(File::basename(path)) + FileUtils::rm(path) + end + site_records = {} # Servers