From 9751c5f4ae68d8969e7ebc95976be6adcd31fbdc Mon Sep 17 00:00:00 2001
From: Lucas Nussbaum <lucas.nussbaum@loria.fr>
Date: Fri, 22 Sep 2023 15:14:03 +0200
Subject: [PATCH] [input_loader] Ruby3.1 compatibility: specify Date and Time
 classes as permitted

See https://stackoverflow.com/questions/71332602/upgrading-to-ruby-3-1-causes-psychdisallowedclass-exception-when-using-yaml-lo
---
 lib/refrepo/input_loader.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/refrepo/input_loader.rb b/lib/refrepo/input_loader.rb
index a5b5bd3a642..1975726f33b 100644
--- a/lib/refrepo/input_loader.rb
+++ b/lib/refrepo/input_loader.rb
@@ -21,9 +21,15 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/
         # Load YAML
         if /\.y.*ml\.erb$/.match(filename)
           # For files with .erb.yaml extensions, process the template before loading the YAML.
-          file_hash = YAML::load(ERB.new(File.read(filename)).result(binding))
+          file_hash = YAML::load(
+            ERB.new(File.read(filename)).result(binding),
+            permitted_classes: [Date, Time]
+          )
         else
-          file_hash = YAML::load_file(filename)
+          file_hash = YAML::load_file(
+            filename,
+            permitted_classes: [Date, Time]
+          )
         end
       if not file_hash
         raise StandardError.new("loaded hash is empty")
-- 
GitLab