Commit 148e4a81 authored by Lucas Nussbaum's avatar Lucas Nussbaum

[dev] introduce get_sites convenience method

parent e39d7383
......@@ -13,7 +13,7 @@ VALIDATORS_DIR = "./generators/input-validators"
WIKI_DIR = "./generators/wiki"
# Get the list of sites as the list of directories in input/grid5000/sites
G5K_SITES = (Dir::entries('input/grid5000/sites') - ['.', '..']).sort
G5K_SITES = RefRepo::Utils::get_sites
namespace :puppet do
......
......@@ -114,7 +114,7 @@ module G5K
return Marshal.load(Marshal.dump(@@global_hash))
end
SITES = get_global_hash['sites'].keys.sort
SITES = RefRepo::Utils::get_sites
end
#Defines MediaWiki helpers
......
......@@ -17,6 +17,10 @@ module RefRepo::Utils
d = open("#{conf['uri']}/#{conf['version']}/#{path}", o).read
return JSON::parse(d)
end
def self.get_sites
return (Dir::entries('input/grid5000/sites') - ['.', '..']).sort
end
end
# Various monkey patches
......
......@@ -22,13 +22,6 @@ IGNORED_PROPERTIES=%w{chassis chunks thread}
G5K_PROPERTIES=%w{api_timestamp available_upto besteffort chunks cluster cluster_priority comment core cpu cpuarch cpucore cpufreq cpuset cputype deploy desktop_computing disk disk_reservation_count diskpath disktype drain eth_count eth_rate expiry_date finaud_decision gpu gpu_count grub host ib ib_count ib_rate id ip last_available_upto last_job_date links maintenance max_walltime memcore memcpu memnode mic myri myri_count myri_rate network_address next_finaud_decision next_state nodemodel production rconsole scheduler_priority slash_16 slash_17 slash_18 slash_19 slash_20 slash_21 slash_22 state state_num subnet_address subnet_prefix suspended_jobs switch type virtual vlan wattmeter opa opa_count opa_rate}.sort - IGNORED_PROPERTIES
class Hash
def slice(*extract)
h2 = self.select{|key, value| extract.include?(key) }
h2
end
end
module RefRepo::Valid::OarProperties
def self.check(options)
ret = true
......
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