Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 2c9b9c02 authored by Lucas Nussbaum's avatar Lucas Nussbaum

[dev] simplify requires

parent 7f891c3f
# load gems used by most of refrepo scripts
require 'erb'
require 'fileutils'
require 'json'
require 'net/http'
require 'net/https'
require 'open-uri'
require 'optparse'
require 'pathname'
require 'pp'
require 'set'
require 'time'
require 'uri'
require 'yaml'
# pre-declare those modules here # pre-declare those modules here
module RefRepo module RefRepo
end end
...@@ -5,4 +21,6 @@ module RefRepo::Gen ...@@ -5,4 +21,6 @@ module RefRepo::Gen
end end
module RefRepo::Valid module RefRepo::Valid
end end
# load sub-parts that are used by many scripts anyway
require 'refrepo/utils' require 'refrepo/utils'
require 'refrepo/input_loader'
#!/usr/bin/ruby
# coding: utf-8 # coding: utf-8
require 'pp'
require 'erb'
require 'fileutils'
require 'pathname'
require 'json'
require 'time'
require 'yaml'
require 'hashdiff' require 'hashdiff'
require 'set'
require 'uri'
require 'net/https'
require 'refrepo/input_loader'
class MissingProperty < StandardError; end class MissingProperty < StandardError; end
......
# See also: https://www.grid5000.fr/mediawiki/index.php/DNS_server # See also: https://www.grid5000.fr/mediawiki/index.php/DNS_server
require 'pp'
require 'erb'
require 'pathname'
require 'fileutils'
require 'optparse'
require 'dns/zone' require 'dns/zone'
require 'refrepo/input_loader'
#Prettier aligned dump of records #Prettier aligned dump of records
class DNS::Zone::RR::A class DNS::Zone::RR::A
......
# This script generates conmang5k/files/<site_uid>/conman.conf from input/, conf/console.yaml and conf/console-password.yaml # This script generates conmang5k/files/<site_uid>/conman.conf from input/, conf/console.yaml and conf/console-password.yaml
require 'pp'
require 'erb'
require 'pathname'
require 'optparse'
require 'refrepo/input_loader'
require 'refrepo/hash/hash' require 'refrepo/hash/hash'
# Apply ERB template and save result to file # Apply ERB template and save result to file
......
require 'pp'
require 'erb'
require 'pathname'
require 'optparse'
require 'refrepo/input_loader'
# Get the mac and ip of a node. Throw exception if error. # Get the mac and ip of a node. Throw exception if error.
def get_network_info(node_hash, network_interface) def get_network_info(node_hash, network_interface)
# Get node_hash["network_adapters"][network_interface]["ip"] and node_hash["network_adapters"][network_interface]["mac"] # Get node_hash["network_adapters"][network_interface]["ip"] and node_hash["network_adapters"][network_interface]["mac"]
......
require 'pp'
require 'erb'
require 'pathname'
require 'optparse'
require 'refrepo/input_loader'
require 'refrepo/hash/hash' require 'refrepo/hash/hash'
# Compute cluster prefix # Compute cluster prefix
......
# !!! Require to "gem install ruby-ip", do not install "ip" gem !!! # !!! Require to "gem install ruby-ip", do not install "ip" gem !!!
require 'json'
require 'fileutils'
require 'pp'
require 'yaml'
require 'pathname'
require 'optparse'
require 'refrepo/input_loader'
require 'refrepo/hash/hash' require 'refrepo/hash/hash'
def generate_puppet_kavlang5k(options) def generate_puppet_kavlang5k(options)
......
# This script generates lanpowerg5k/files/<site_uid>/lanpower.conf from conf/console.yaml and conf/console-password.conf # This script generates lanpowerg5k/files/<site_uid>/lanpower.conf from conf/console.yaml and conf/console-password.conf
require 'pp'
require 'yaml'
require 'pathname'
require 'optparse'
require 'refrepo/input_loader'
require 'refrepo/hash/hash' require 'refrepo/hash/hash'
def generate_puppet_lanpowerg5k(options) def generate_puppet_lanpowerg5k(options)
......
#!/usr/bin/ruby
require 'pp'
require 'optparse'
require 'erb'
require 'fileutils'
require 'pathname'
require 'json'
require 'time'
require 'refrepo/input_loader'
require 'refrepo/valid/input/schema' require 'refrepo/valid/input/schema'
require 'refrepo/valid/homogeneity' require 'refrepo/valid/homogeneity'
require 'refrepo/valid/input/monitoring' require 'refrepo/valid/input/monitoring'
......
# coding: utf-8 # coding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'refrepo/gen/wiki/wiki_generator' require 'refrepo/gen/wiki/wiki_generator'
require_relative './site_hardware.rb' require 'refrepo/gen/wiki/generators/site_hardware'
class G5KHardwareGenerator < WikiGenerator class G5KHardwareGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
require 'refrepo/gen/wiki/wiki_generator' require 'refrepo/gen/wiki/wiki_generator'
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../../../../generators/oar-properties/lib'))) require 'refrepo/gen/oar-properties'
require 'lib-oar-properties'
class OarPropertiesGenerator < WikiGenerator class OarPropertiesGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'refrepo/gen/wiki/wiki_generator' require 'refrepo/gen/wiki/wiki_generator'
class SiteHardwareGenerator < WikiGenerator class SiteHardwareGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'refrepo/gen/wiki/wiki_generator' require 'refrepo/gen/wiki/wiki_generator'
require 'refrepo/valid/network'
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../../../../generators')))
require 'input-validators/check-network-description'
# This class generates the network description of each site, in .dot # This class generates the network description of each site, in .dot
# and .png format # and .png format
......
require 'pp'
require 'open-uri'
require 'uri'
require 'net/http'
require 'net/https'
require 'mediawiki_api' require 'mediawiki_api'
#Adding method to mediawiki_api client #Adding method to mediawiki_api client
......
# also add generators/lib to load path
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../lib')))
require 'refrepo/input_loader'
require "optparse"
require "mediawiki_api" require "mediawiki_api"
require "diffy" require "diffy"
require 'date'
require 'pp'
class WikiGenerator class WikiGenerator
......
# Load a hierarchy of YAML file into a Ruby hash # Load a hierarchy of YAML file into a Ruby hash
require 'yaml' require 'refrepo/hash/hash'
require 'erb'
require 'refrepo/hash/hash.rb'
def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/", File.dirname(__FILE__))) def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/", File.dirname(__FILE__)))
......
#!/usr/bin/ruby
# This script checks the cluster homogeneity # This script checks the cluster homogeneity
require 'pp'
require 'fileutils'
require 'pathname'
require 'hashdiff' require 'hashdiff'
require 'json'
require 'uri'
require 'net/https'
require 'refrepo/input_loader'
def global_ignore_keys def global_ignore_keys
......
#!/usr/bin/ruby
require 'pp'
require 'refrepo/input_loader'
# replace default deep_merge before calling load_yaml_file_hierarchy # replace default deep_merge before calling load_yaml_file_hierarchy
class ::Hash class ::Hash
def deep_merge(other_hash) def deep_merge(other_hash)
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
dir = Pathname(__FILE__).parent dir = Pathname(__FILE__).parent
require 'json'
require 'hash_validator' # https://github.com/jamesbrooks/hash_validator require 'hash_validator' # https://github.com/jamesbrooks/hash_validator
require "#{dir}/multihash_validator" # custom validator for <multi>-keys Hash support require "#{dir}/multihash_validator" # custom validator for <multi>-keys Hash support
require "#{dir}/array_validator" # custom validator for <array> support require "#{dir}/array_validator" # custom validator for <array> support
......
#!/usr/bin/ruby
require 'fileutils'
require 'pathname'
require 'refrepo/input_loader'
require_relative "./lib/schema_validator" require_relative "./lib/schema_validator"
def run_validator(uid, data, schema) def run_validator(uid, data, schema)
......
#!/usr/bin/ruby
# coding: utf-8 # coding: utf-8
# This script checks the network description for inconsistencies # This script checks the network description for inconsistencies
# This script needs 'nodeset' and 'dot' programs, which are available # This script needs 'nodeset' and 'dot' programs, which are available
# in clustershell and graphviz debian packages # in clustershell and graphviz debian packages
require 'json'
require 'pp'
# FIXME infiniband equipment is not completely described in the ref-api yet. See Bug 8586 # FIXME infiniband equipment is not completely described in the ref-api yet. See Bug 8586
HPC_SWITCHES = ['ib-grenoble', 'voltaire-1', 'voltaire-2', 'voltaire-3', 'sgraoullyib', 'sgrapheneib', 'sw-myrinet', 'sgrele-opf'] HPC_SWITCHES = ['ib-grenoble', 'voltaire-1', 'voltaire-2', 'voltaire-3', 'sgraoullyib', 'sgrapheneib', 'sw-myrinet', 'sgrele-opf']
......
#!/usr/bin/ruby
# coding: utf-8 # coding: utf-8
require 'pp'
require 'erb'
require 'fileutils'
require 'pathname'
require 'json'
require 'time'
require 'yaml'
require 'set'
require 'hashdiff'
require 'optparse'
require 'net/ssh' require 'net/ssh'
require 'open-uri' require 'hashdiff'
require 'refrepo/utils'
# propriétés ignorées # propriétés ignorées
IGNORED_PROPERTIES=%w{chassis chunks thread} IGNORED_PROPERTIES=%w{chassis chunks thread}
......
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