From 3d248efa6e26b4dc975399d2f1c645e5b27f1f68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gaidamour?= <jeremie.gaidamour@inria.fr>
Date: Fri, 22 Apr 2016 14:15:03 +0200
Subject: [PATCH] [dev] Check ruby version Otherwise we get inexplicable errors
 with pathname or hash.select ...

---
 dev/puppet/bind.rb        | 5 +++++
 dev/puppet/conmang5k.rb   | 5 +++++
 dev/puppet/dhcp.rb        | 5 +++++
 dev/puppet/kadeployg5k.rb | 5 +++++
 dev/puppet/lanpowerg5k.rb | 5 +++++
 5 files changed, 25 insertions(+)

diff --git a/dev/puppet/bind.rb b/dev/puppet/bind.rb
index e14dbb5bddd..2e9ba763f0a 100644
--- a/dev/puppet/bind.rb
+++ b/dev/puppet/bind.rb
@@ -1,5 +1,10 @@
 #!/usr/bin/ruby
 
+if RUBY_VERSION < "2.1"
+  puts "This script requires ruby >= 2.1"
+  exit
+end
+
 # See also: https://www.grid5000.fr/mediawiki/index.php/DNS_server
 
 require 'pp'
diff --git a/dev/puppet/conmang5k.rb b/dev/puppet/conmang5k.rb
index 8361656ae04..e011989f1ef 100644
--- a/dev/puppet/conmang5k.rb
+++ b/dev/puppet/conmang5k.rb
@@ -1,5 +1,10 @@
 #!/usr/bin/ruby
 
+if RUBY_VERSION < "2.1"
+  puts "This script requires ruby >= 2.1"
+  exit
+end
+
 # This script generates conmang5k/files/<site_uid>/conman.conf from input/, conf/console.yaml and conf/console-password.yaml
 
 require 'pp'
diff --git a/dev/puppet/dhcp.rb b/dev/puppet/dhcp.rb
index ee7a33f7b73..eb2a2bd8ca0 100644
--- a/dev/puppet/dhcp.rb
+++ b/dev/puppet/dhcp.rb
@@ -1,5 +1,10 @@
 #!/usr/bin/ruby
 
+if RUBY_VERSION < "2.1"
+  puts "This script requires ruby >= 2.1"
+  exit
+end
+
 require 'pp'
 require 'erb'
 require 'pathname'
diff --git a/dev/puppet/kadeployg5k.rb b/dev/puppet/kadeployg5k.rb
index 0770c6baaa1..16a31794f70 100644
--- a/dev/puppet/kadeployg5k.rb
+++ b/dev/puppet/kadeployg5k.rb
@@ -1,5 +1,10 @@
 #!/usr/bin/ruby
 
+if RUBY_VERSION < "2.1"
+  puts "This script requires ruby >= 2.1"
+  exit
+end
+
 # This script generates:
 # - kadeployg5k/files/<site_uid>/server_conf[_dev]/clusters.conf from input/
 # - kadeployg5k/files/<site_uid>/server_conf[_dev]/<cluster_uid>-cluster.conf from conf/kadeployg5k.yaml and template/kadeployg5k.yaml.Erb
diff --git a/dev/puppet/lanpowerg5k.rb b/dev/puppet/lanpowerg5k.rb
index 53bf1c5c42d..1cba148dab4 100644
--- a/dev/puppet/lanpowerg5k.rb
+++ b/dev/puppet/lanpowerg5k.rb
@@ -1,5 +1,10 @@
 #!/usr/bin/ruby
 
+if RUBY_VERSION < "2.1"
+  puts "This script requires ruby >= 2.1"
+  exit
+end
+
 # This script generates lanpowerg5k/files/<site_uid>/lanpower.conf from conf/console.yaml and conf/console-password.conf
 
 require 'pp'
-- 
GitLab