Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit af715bc0 authored by LOUP David's avatar LOUP David
Browse files

[generator] Add generator for oxidized

parent 8932cb85
Pipeline #133555 passed with stages
in 4 minutes and 9 seconds
......@@ -203,7 +203,7 @@ namespace :gen do
namespace :puppet do
all_puppet_tasks = [:bindg5k, :conmang5k, :dhcpg5k, :kadeployg5k, :lanpowerg5k, :kavlang5k, :kwollectg5k, :network_monitoring, :'refapi-subset']
all_puppet_tasks = [:bindg5k, :conmang5k, :dhcpg5k, :kadeployg5k, :lanpowerg5k, :kavlang5k, :kwollectg5k, :network_monitoring, :'refapi-subset', :'oxidizedg5k']
all_puppet_tasks.each { |t|
generated_desc = (t == :'refapi-subset') ? 'description' : 'configuration'
require 'refrepo'
def generate_puppet_oxidizedg5k(options)
if not options[:conf_dir]
options[:conf_dir] = "#{options[:output_dir]}/platforms/production/generators/oxidized"
raise("Error: #{options[:conf_dir]} does not exist. The given configuration path is incorrect") unless Pathname(options[:conf_dir].to_s).exist?
puts "Writing oxidized database to: #{options[:output_dir]}/platforms/production/modules/generated/files/grid5000/oxidized/oxidized.db"
puts "Using configuration directory: #{options[:conf_dir]}"
if options[:sites] != RefRepo::Utils::get_sites
puts "WARNING : Sites options is specified but has no impact on generated files (one file generated for all sites)"
conf = YAML::load("#{options[:conf_dir]}/oxidizedg5k.yaml"))
if not conf
warn "No generator configuration for oxidized found in #{options[:conf_dir]}/oxidizedg5k.yaml, skipping oxidized"
output ='templates/oxidized.db.erb', File.dirname(__FILE__))), nil, '-').result(binding)
output_file = Pathname("#{options[:output_dir]}//platforms/production/modules/generated/files/grid5000/oxidized/oxidized.db")
File.write(output_file, output)
# device : group : driver : username : password : enable
# group = site-kind, ex: grenoble-admin
# driver : see
# enable :
### false = already in exec mode
### true = need the "enable" cmd without password
### p4ssword : the enable password
conf.each do |site, groups|
groups.each do |g,devices|
devices.each do |d,v|
missing_info = ["driver","user","password"] - v.keys
if missing_info.length != 0
puts "Skipping #{d}.#{site}, missing #{missing_info.to_s}"
enable = v.has_key?('enable') ? v['enable'] : false
<%=[d+'.'+site,site+"-"+g,v['driver'],v['user'],v['password'],enable].join(':') %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- end -%>
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