diff --git a/share/hooks/ft/host_error.rb b/share/hooks/ft/host_error.rb index ee15a4a2c7..b35a4838a5 100755 --- a/share/hooks/ft/host_error.rb +++ b/share/hooks/ft/host_error.rb @@ -49,14 +49,25 @@ end FENCE_HOST = File.dirname(__FILE__) + '/fence_host.sh' +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/share/hooks/vcenter/create_vcenter_net.rb b/share/hooks/vcenter/create_vcenter_net.rb index 18b8ca0300..8eeda602fd 100755 --- a/share/hooks/vcenter/create_vcenter_net.rb +++ b/share/hooks/vcenter/create_vcenter_net.rb @@ -31,14 +31,25 @@ else CONFIG_FILE = ONE_LOCATION + '/var/config' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/share/hooks/vcenter/delete_vcenter_net.rb b/share/hooks/vcenter/delete_vcenter_net.rb index 2354119002..b10a79cc95 100755 --- a/share/hooks/vcenter/delete_vcenter_net.rb +++ b/share/hooks/vcenter/delete_vcenter_net.rb @@ -30,14 +30,25 @@ else CONFIG_FILE = ONE_LOCATION + '/var/config' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/share/misc/update_rubygems_setup b/share/misc/update_rubygems_setup new file mode 100755 index 0000000000..ba46563ed0 --- /dev/null +++ b/share/misc/update_rubygems_setup @@ -0,0 +1,92 @@ +#!/usr/bin/env ruby + +# -------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# Reads all files in **CURRENT DIRECTORY and SUBDIRECTORIES** and looks +# for the section labels which contain the setup code of the bundled +# Ruby gems. Replaces the content with the one configured below. + +# Section begin and end labels +RG_SETUP_BEGIN = '%%RUBYGEMS_SETUP_BEGIN%%' +RG_SETUP_END = '%%RUBYGEMS_SETUP_END%%' + +# Bundled Ruby gems loader code. +# IMPORTANT: Update here and commit into Git as well! +# rubocop:disable Layout/HeredocIndentation +RG_SETUP = <<-'EOT' +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end + end +end +EOT +# rubocop:enable Layout/HeredocIndentation + +##### + +SCRIPT_FILE = File.expand_path(__FILE__) + +updated = [] + +# iterate over all files +Dir.glob('**/*') do |name| + next if File.directory?(name) || File.expand_path(name) == SCRIPT_FILE + + old = File.read(name, :encoding => 'iso-8859-1') + + # detect right files by checking for the begin section label + if old.include?(RG_SETUP_BEGIN) + unless old.include?(RG_SETUP_END) + STDERR.puts "ERROR: File #{name} doesn't contain RG end label" + exit 1 + end + + # replace all text inside labels by RG_SETUP code + new = old.gsub( + /(#{RG_SETUP_BEGIN}[^\n]*).*\n([^\n]*#{RG_SETUP_END})/m, + "\\1\n#{RG_SETUP.chomp}\n\\2" + ) + + if new != old + updated << name + + File.open(name, 'w') do |f| + f.write(new) + end + end + end +end + +# report +if updated.empty? + STDERR.puts 'WARNING: No files updated' +else + STDERR.puts "Updated #{updated.length} files:" + puts updated.join("\n") +end diff --git a/src/authm_mad/one_auth_mad.rb b/src/authm_mad/one_auth_mad.rb index 0d318a9680..4466abb6c0 100755 --- a/src/authm_mad/one_auth_mad.rb +++ b/src/authm_mad/one_auth_mad.rb @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/dummy/authenticate b/src/authm_mad/remotes/dummy/authenticate index 3429162d84..3cb6b72475 100755 --- a/src/authm_mad/remotes/dummy/authenticate +++ b/src/authm_mad/remotes/dummy/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/ldap/authenticate b/src/authm_mad/remotes/ldap/authenticate index 929012e893..dcce7fc4d9 100755 --- a/src/authm_mad/remotes/ldap/authenticate +++ b/src/authm_mad/remotes/ldap/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/plain/authenticate b/src/authm_mad/remotes/plain/authenticate index 958625f822..cf7b6687f9 100755 --- a/src/authm_mad/remotes/plain/authenticate +++ b/src/authm_mad/remotes/plain/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/server_cipher/authenticate b/src/authm_mad/remotes/server_cipher/authenticate index 194d611f60..f53f429ad1 100755 --- a/src/authm_mad/remotes/server_cipher/authenticate +++ b/src/authm_mad/remotes/server_cipher/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/server_x509/authenticate b/src/authm_mad/remotes/server_x509/authenticate index 9d2119b88f..2a29df7aff 100755 --- a/src/authm_mad/remotes/server_x509/authenticate +++ b/src/authm_mad/remotes/server_x509/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/ssh/authenticate b/src/authm_mad/remotes/ssh/authenticate index 7f0ff08777..5926508510 100755 --- a/src/authm_mad/remotes/ssh/authenticate +++ b/src/authm_mad/remotes/ssh/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/authm_mad/remotes/x509/authenticate b/src/authm_mad/remotes/x509/authenticate index ca19e96c45..2768e82f54 100755 --- a/src/authm_mad/remotes/x509/authenticate +++ b/src/authm_mad/remotes/x509/authenticate @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/cli/oneacct b/src/cli/oneacct index 3804348565..ca923d9dc1 100755 --- a/src/cli/oneacct +++ b/src/cli/oneacct @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneacl b/src/cli/oneacl index 306f62431f..e8eb5e8c8f 100755 --- a/src/cli/oneacl +++ b/src/cli/oneacl @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onecluster b/src/cli/onecluster index 97d624f996..1473e1c65b 100755 --- a/src/cli/onecluster +++ b/src/cli/onecluster @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onedatastore b/src/cli/onedatastore index a3baf90692..1ef0216099 100755 --- a/src/cli/onedatastore +++ b/src/cli/onedatastore @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneflow b/src/cli/oneflow index 8fd5291941..192a6c05a9 100755 --- a/src/cli/oneflow +++ b/src/cli/oneflow @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneflow-template b/src/cli/oneflow-template index 3989b530b2..3aadaea1ee 100755 --- a/src/cli/oneflow-template +++ b/src/cli/oneflow-template @@ -28,14 +28,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << ONEFLOW_LOCATION diff --git a/src/cli/onegroup b/src/cli/onegroup index 225278588e..af66bfc4af 100755 --- a/src/cli/onegroup +++ b/src/cli/onegroup @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onehook b/src/cli/onehook index 68ecb63794..fa2c249d16 100755 --- a/src/cli/onehook +++ b/src/cli/onehook @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onehost b/src/cli/onehost index 95304ffb88..d9b83236ed 100755 --- a/src/cli/onehost +++ b/src/cli/onehost @@ -28,14 +28,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneimage b/src/cli/oneimage index b55b822581..4608ab8ee5 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onemarket b/src/cli/onemarket index 3d653d79ac..b412766425 100755 --- a/src/cli/onemarket +++ b/src/cli/onemarket @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onemarketapp b/src/cli/onemarketapp index dd32341a9b..3d621feaa8 100755 --- a/src/cli/onemarketapp +++ b/src/cli/onemarketapp @@ -28,14 +28,25 @@ else VAR_LOCATION = ONE_LOCATION + '/var' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneprovider b/src/cli/oneprovider index 39653048c2..abf05351e9 100755 --- a/src/cli/oneprovider +++ b/src/cli/oneprovider @@ -28,14 +28,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneprovision b/src/cli/oneprovision index ea8e5526da..584f5c8f7b 100755 --- a/src/cli/oneprovision +++ b/src/cli/oneprovision @@ -30,14 +30,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneprovision-template b/src/cli/oneprovision-template index df02ad5e45..b9c31b46f1 100755 --- a/src/cli/oneprovision-template +++ b/src/cli/oneprovision-template @@ -30,14 +30,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onesecgroup b/src/cli/onesecgroup index dc6cd6f5e8..44b03571b9 100755 --- a/src/cli/onesecgroup +++ b/src/cli/onesecgroup @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneshowback b/src/cli/oneshowback index 3a4f206436..4f6be50654 100755 --- a/src/cli/oneshowback +++ b/src/cli/oneshowback @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onetemplate b/src/cli/onetemplate index 8cfcb20a10..ae0639d1c4 100755 --- a/src/cli/onetemplate +++ b/src/cli/onetemplate @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/oneuser b/src/cli/oneuser index 3a00760502..06c096d107 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevcenter b/src/cli/onevcenter index 9301348291..41dab12b78 100755 --- a/src/cli/onevcenter +++ b/src/cli/onevcenter @@ -28,14 +28,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevdc b/src/cli/onevdc index 1b704e21e8..b946a0e360 100755 --- a/src/cli/onevdc +++ b/src/cli/onevdc @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevm b/src/cli/onevm index 82ce3dc66b..67646119db 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevmgroup b/src/cli/onevmgroup index 709047d184..3ad614a144 100755 --- a/src/cli/onevmgroup +++ b/src/cli/onevmgroup @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevnet b/src/cli/onevnet index 5a750b0fad..195dddaa4e 100755 --- a/src/cli/onevnet +++ b/src/cli/onevnet @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevntemplate b/src/cli/onevntemplate index 110d111001..ad2c346836 100755 --- a/src/cli/onevntemplate +++ b/src/cli/onevntemplate @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onevrouter b/src/cli/onevrouter index 64a993c0c0..47c2230a71 100755 --- a/src/cli/onevrouter +++ b/src/cli/onevrouter @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/cli/onezone b/src/cli/onezone index 65f16c9988..ced86f97fa 100755 --- a/src/cli/onezone +++ b/src/cli/onezone @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/datastore_mad/one_datastore.rb b/src/datastore_mad/one_datastore.rb index 7fe01536e2..5f5accffad 100755 --- a/src/datastore_mad/one_datastore.rb +++ b/src/datastore_mad/one_datastore.rb @@ -31,14 +31,25 @@ else VAR_LOCATION = ONE_LOCATION + '/var' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/datastore_mad/remotes/vcenter/clone b/src/datastore_mad/remotes/vcenter/clone index 999907c459..2715e49907 100755 --- a/src/datastore_mad/remotes/vcenter/clone +++ b/src/datastore_mad/remotes/vcenter/clone @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/cp b/src/datastore_mad/remotes/vcenter/cp index 07179f19b5..66836acef6 100755 --- a/src/datastore_mad/remotes/vcenter/cp +++ b/src/datastore_mad/remotes/vcenter/cp @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/export b/src/datastore_mad/remotes/vcenter/export index 98e973345a..864d673f0f 100755 --- a/src/datastore_mad/remotes/vcenter/export +++ b/src/datastore_mad/remotes/vcenter/export @@ -30,14 +30,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/mkfs b/src/datastore_mad/remotes/vcenter/mkfs index 9a88101a89..cf082d76c8 100755 --- a/src/datastore_mad/remotes/vcenter/mkfs +++ b/src/datastore_mad/remotes/vcenter/mkfs @@ -30,14 +30,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/monitor b/src/datastore_mad/remotes/vcenter/monitor index 2b3027d43e..5969459d9a 100755 --- a/src/datastore_mad/remotes/vcenter/monitor +++ b/src/datastore_mad/remotes/vcenter/monitor @@ -30,14 +30,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/rm b/src/datastore_mad/remotes/vcenter/rm index d01fe19af3..65057c866a 100755 --- a/src/datastore_mad/remotes/vcenter/rm +++ b/src/datastore_mad/remotes/vcenter/rm @@ -30,14 +30,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter/stat b/src/datastore_mad/remotes/vcenter/stat index 2edc35a498..b31aca8fbc 100755 --- a/src/datastore_mad/remotes/vcenter/stat +++ b/src/datastore_mad/remotes/vcenter/stat @@ -30,14 +30,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter_downloader.rb b/src/datastore_mad/remotes/vcenter_downloader.rb index 5a0e367277..7cd93c7485 100755 --- a/src/datastore_mad/remotes/vcenter_downloader.rb +++ b/src/datastore_mad/remotes/vcenter_downloader.rb @@ -28,14 +28,25 @@ else VAR_LOCATION ||= ONE_LOCATION + '/var' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/datastore_mad/remotes/vcenter_uploader.rb b/src/datastore_mad/remotes/vcenter_uploader.rb index 6bf26449c4..a6f59f37d4 100755 --- a/src/datastore_mad/remotes/vcenter_uploader.rb +++ b/src/datastore_mad/remotes/vcenter_uploader.rb @@ -30,14 +30,25 @@ else ONE_LOCATION + '/share/gems' unless defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/flow/oneflow-server.rb b/src/flow/oneflow-server.rb index 4b9501cd9d..e21c50f873 100644 --- a/src/flow/oneflow-server.rb +++ b/src/flow/oneflow-server.rb @@ -37,14 +37,25 @@ ONEFLOW_AUTH = VAR_LOCATION + '/.one/oneflow_auth' ONEFLOW_LOG = LOG_LOCATION + '/oneflow.log' CONFIGURATION_FILE = ETC_LOCATION + '/oneflow-server.conf' +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cloud' diff --git a/src/hem/onehem-server.rb b/src/hem/onehem-server.rb index b089bff3bb..c75ed90657 100755 --- a/src/hem/onehem-server.rb +++ b/src/hem/onehem-server.rb @@ -38,14 +38,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/hm_mad/one_hm.rb b/src/hm_mad/one_hm.rb index 540026f7b1..632add3a3f 100755 --- a/src/hm_mad/one_hm.rb +++ b/src/hm_mad/one_hm.rb @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/im_exec/one_im_exec.rb b/src/im_mad/im_exec/one_im_exec.rb index 82501a789c..fb3416238a 100755 --- a/src/im_mad/im_exec/one_im_exec.rb +++ b/src/im_mad/im_exec/one_im_exec.rb @@ -30,14 +30,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/az-probes.d/host/monitor/probe_host_monitor.rb b/src/im_mad/remotes/az-probes.d/host/monitor/probe_host_monitor.rb index 70c1d6b678..a0d17dfbc5 100755 --- a/src/im_mad/remotes/az-probes.d/host/monitor/probe_host_monitor.rb +++ b/src/im_mad/remotes/az-probes.d/host/monitor/probe_host_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/az-probes.d/host/system/probe_host_system.rb b/src/im_mad/remotes/az-probes.d/host/system/probe_host_system.rb index 331d227dfe..92d187c6a3 100755 --- a/src/im_mad/remotes/az-probes.d/host/system/probe_host_system.rb +++ b/src/im_mad/remotes/az-probes.d/host/system/probe_host_system.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/az-probes.d/vm/monitor/probe_vm_monitor.rb b/src/im_mad/remotes/az-probes.d/vm/monitor/probe_vm_monitor.rb index dd19275c01..dc400c77b7 100755 --- a/src/im_mad/remotes/az-probes.d/vm/monitor/probe_vm_monitor.rb +++ b/src/im_mad/remotes/az-probes.d/vm/monitor/probe_vm_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/az-probes.d/vm/status/probe_vm_status.rb b/src/im_mad/remotes/az-probes.d/vm/status/probe_vm_status.rb index d2760320ef..c5d6477ca1 100755 --- a/src/im_mad/remotes/az-probes.d/vm/status/probe_vm_status.rb +++ b/src/im_mad/remotes/az-probes.d/vm/status/probe_vm_status.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/dummy-probes.d/vm/monitor/monitor.rb b/src/im_mad/remotes/dummy-probes.d/vm/monitor/monitor.rb index 48a94caef2..c05275f669 100755 --- a/src/im_mad/remotes/dummy-probes.d/vm/monitor/monitor.rb +++ b/src/im_mad/remotes/dummy-probes.d/vm/monitor/monitor.rb @@ -27,14 +27,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/ec2-probes.d/host/monitor/probe_host_monitor.rb b/src/im_mad/remotes/ec2-probes.d/host/monitor/probe_host_monitor.rb index ef8fe6845a..6cd8dd28c1 100755 --- a/src/im_mad/remotes/ec2-probes.d/host/monitor/probe_host_monitor.rb +++ b/src/im_mad/remotes/ec2-probes.d/host/monitor/probe_host_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/ec2-probes.d/host/system/probe_host_system.rb b/src/im_mad/remotes/ec2-probes.d/host/system/probe_host_system.rb index 585f87d84b..73fea13e3d 100755 --- a/src/im_mad/remotes/ec2-probes.d/host/system/probe_host_system.rb +++ b/src/im_mad/remotes/ec2-probes.d/host/system/probe_host_system.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/ec2-probes.d/vm/monitor/probe_vm_monitor.rb b/src/im_mad/remotes/ec2-probes.d/vm/monitor/probe_vm_monitor.rb index 5a06eb21cb..0379ddd77a 100755 --- a/src/im_mad/remotes/ec2-probes.d/vm/monitor/probe_vm_monitor.rb +++ b/src/im_mad/remotes/ec2-probes.d/vm/monitor/probe_vm_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/ec2-probes.d/vm/status/probe_vm_status.rb b/src/im_mad/remotes/ec2-probes.d/vm/status/probe_vm_status.rb index dad217ffc6..e7603e8ebc 100755 --- a/src/im_mad/remotes/ec2-probes.d/vm/status/probe_vm_status.rb +++ b/src/im_mad/remotes/ec2-probes.d/vm/status/probe_vm_status.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/lib/probe_db.rb b/src/im_mad/remotes/lib/probe_db.rb index 247b8f1418..a768e61841 100644 --- a/src/im_mad/remotes/lib/probe_db.rb +++ b/src/im_mad/remotes/lib/probe_db.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/im_mad/remotes/lib/vcenter_monitor.rb b/src/im_mad/remotes/lib/vcenter_monitor.rb index 485c63b62a..eafb4c4cd7 100644 --- a/src/im_mad/remotes/lib/vcenter_monitor.rb +++ b/src/im_mad/remotes/lib/vcenter_monitor.rb @@ -30,14 +30,25 @@ else RUN_LOCATION ||= ONE_LOCATION + '/var/run' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/lib/vcenter_monitor_vms.rb b/src/im_mad/remotes/lib/vcenter_monitor_vms.rb index 012c0ab058..67dbf8c2e2 100755 --- a/src/im_mad/remotes/lib/vcenter_monitor_vms.rb +++ b/src/im_mad/remotes/lib/vcenter_monitor_vms.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/im_mad/remotes/one-probes.d/host/monitor/probe_host_monitor.rb b/src/im_mad/remotes/one-probes.d/host/monitor/probe_host_monitor.rb index ae74a6a3c3..c105b8916a 100755 --- a/src/im_mad/remotes/one-probes.d/host/monitor/probe_host_monitor.rb +++ b/src/im_mad/remotes/one-probes.d/host/monitor/probe_host_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/one-probes.d/host/system/probe_host_system.rb b/src/im_mad/remotes/one-probes.d/host/system/probe_host_system.rb index 3ec7a52f76..a87bdc92a7 100755 --- a/src/im_mad/remotes/one-probes.d/host/system/probe_host_system.rb +++ b/src/im_mad/remotes/one-probes.d/host/system/probe_host_system.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/one-probes.d/vm/monitor/probe_vm_monitor.rb b/src/im_mad/remotes/one-probes.d/vm/monitor/probe_vm_monitor.rb index 07601ec541..a403531524 100755 --- a/src/im_mad/remotes/one-probes.d/vm/monitor/probe_vm_monitor.rb +++ b/src/im_mad/remotes/one-probes.d/vm/monitor/probe_vm_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/one-probes.d/vm/status/probe_vm_status.rb b/src/im_mad/remotes/one-probes.d/vm/status/probe_vm_status.rb index a4d8be4ec1..aaefdf81e8 100755 --- a/src/im_mad/remotes/one-probes.d/vm/status/probe_vm_status.rb +++ b/src/im_mad/remotes/one-probes.d/vm/status/probe_vm_status.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/packet-probes.d/host/monitor/probe_host_monitor.rb b/src/im_mad/remotes/packet-probes.d/host/monitor/probe_host_monitor.rb index f974b353ad..d9e09ab85b 100755 --- a/src/im_mad/remotes/packet-probes.d/host/monitor/probe_host_monitor.rb +++ b/src/im_mad/remotes/packet-probes.d/host/monitor/probe_host_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/packet-probes.d/host/system/probe_host_system.rb b/src/im_mad/remotes/packet-probes.d/host/system/probe_host_system.rb index 1de744e0ae..be62624668 100755 --- a/src/im_mad/remotes/packet-probes.d/host/system/probe_host_system.rb +++ b/src/im_mad/remotes/packet-probes.d/host/system/probe_host_system.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/packet-probes.d/vm/monitor/probe_vm_monitor.rb b/src/im_mad/remotes/packet-probes.d/vm/monitor/probe_vm_monitor.rb index 83beb88bab..acfd1b84fd 100755 --- a/src/im_mad/remotes/packet-probes.d/vm/monitor/probe_vm_monitor.rb +++ b/src/im_mad/remotes/packet-probes.d/vm/monitor/probe_vm_monitor.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/im_mad/remotes/packet-probes.d/vm/status/probe_vm_status.rb b/src/im_mad/remotes/packet-probes.d/vm/status/probe_vm_status.rb index 7f177c0277..da5465fb10 100755 --- a/src/im_mad/remotes/packet-probes.d/vm/status/probe_vm_status.rb +++ b/src/im_mad/remotes/packet-probes.d/vm/status/probe_vm_status.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/ipamm_mad/one_ipam.rb b/src/ipamm_mad/one_ipam.rb index dddf85dcf0..fe32c7078e 100755 --- a/src/ipamm_mad/one_ipam.rb +++ b/src/ipamm_mad/one_ipam.rb @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/ipamm_mad/remotes/aws/get_address b/src/ipamm_mad/remotes/aws/get_address index e915fbf98d..c33cf6011a 100755 --- a/src/ipamm_mad/remotes/aws/get_address +++ b/src/ipamm_mad/remotes/aws/get_address @@ -57,14 +57,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/ipamm_mad/remotes/aws/register_address_range b/src/ipamm_mad/remotes/aws/register_address_range index 449f09ae4c..005c0d1ef1 100755 --- a/src/ipamm_mad/remotes/aws/register_address_range +++ b/src/ipamm_mad/remotes/aws/register_address_range @@ -75,14 +75,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << LIB_LOCATION + '/oneprovision/lib' diff --git a/src/ipamm_mad/remotes/aws/unregister_address_range b/src/ipamm_mad/remotes/aws/unregister_address_range index 3e6d0797d2..b6d41bf7f0 100755 --- a/src/ipamm_mad/remotes/aws/unregister_address_range +++ b/src/ipamm_mad/remotes/aws/unregister_address_range @@ -51,14 +51,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << LIB_LOCATION + '/oneprovision/lib' diff --git a/src/ipamm_mad/remotes/packet/get_address b/src/ipamm_mad/remotes/packet/get_address index 9b6e6e2c07..1b32aac83b 100755 --- a/src/ipamm_mad/remotes/packet/get_address +++ b/src/ipamm_mad/remotes/packet/get_address @@ -55,14 +55,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/ipamm_mad/remotes/packet/register_address_range b/src/ipamm_mad/remotes/packet/register_address_range index ecd2857f5e..18416eaa6b 100755 --- a/src/ipamm_mad/remotes/packet/register_address_range +++ b/src/ipamm_mad/remotes/packet/register_address_range @@ -78,14 +78,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << PACKET_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/ipamm_mad/remotes/packet/unregister_address_range b/src/ipamm_mad/remotes/packet/unregister_address_range index 49559d8ff8..3e23ff3973 100755 --- a/src/ipamm_mad/remotes/packet/unregister_address_range +++ b/src/ipamm_mad/remotes/packet/unregister_address_range @@ -45,14 +45,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << PACKET_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/market_mad/one_market.rb b/src/market_mad/one_market.rb index f5b6885444..095204ea12 100755 --- a/src/market_mad/one_market.rb +++ b/src/market_mad/one_market.rb @@ -31,14 +31,25 @@ else VAR_LOCATION = ONE_LOCATION + '/var' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/market_mad/remotes/s3/delete b/src/market_mad/remotes/s3/delete index 89b1b912a2..e1192f1f5c 100755 --- a/src/market_mad/remotes/s3/delete +++ b/src/market_mad/remotes/s3/delete @@ -34,14 +34,25 @@ end UTILS_PATH = File.join(File.dirname(__FILE__), '../../datastore') +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/market_mad/remotes/s3/import b/src/market_mad/remotes/s3/import index 1d9f0e25cb..4dea1e30a4 100755 --- a/src/market_mad/remotes/s3/import +++ b/src/market_mad/remotes/s3/import @@ -34,14 +34,25 @@ end UTILS_PATH = File.join(File.dirname(__FILE__), '../../datastore') +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/market_mad/remotes/s3/monitor b/src/market_mad/remotes/s3/monitor index 57fa0d414d..94a559fcb3 100755 --- a/src/market_mad/remotes/s3/monitor +++ b/src/market_mad/remotes/s3/monitor @@ -34,14 +34,25 @@ end UTILS_PATH = File.join(File.dirname(__FILE__), '../../datastore') +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/market_mad/remotes/turnkeylinux/monitor b/src/market_mad/remotes/turnkeylinux/monitor index d4f7cfffa0..f00a7159e5 100755 --- a/src/market_mad/remotes/turnkeylinux/monitor +++ b/src/market_mad/remotes/turnkeylinux/monitor @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/onecfg/bin/onecfg b/src/onecfg/bin/onecfg index 76888b8d31..f13564629f 100755 --- a/src/onecfg/bin/onecfg +++ b/src/onecfg/bin/onecfg @@ -28,14 +28,25 @@ else GEMS_LOCATION = '/usr/share/one/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/onedb/onedb b/src/onedb/onedb index 6af92e1fdc..1d88b74a06 100755 --- a/src/onedb/onedb +++ b/src/onedb/onedb @@ -46,14 +46,25 @@ end ONED_CONF = "#{ETC_LOCATION}/oned.conf" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/onedb' diff --git a/src/onedb/vcenter_one54_pre.rb b/src/onedb/vcenter_one54_pre.rb index 3f2fe9993e..caa882c4f4 100644 --- a/src/onedb/vcenter_one54_pre.rb +++ b/src/onedb/vcenter_one54_pre.rb @@ -28,14 +28,25 @@ else REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cli' diff --git a/src/onegate/onegate-server.rb b/src/onegate/onegate-server.rb index c5efe3c5f8..653291143b 100644 --- a/src/onegate/onegate-server.rb +++ b/src/onegate/onegate-server.rb @@ -37,14 +37,25 @@ ONEGATE_AUTH = VAR_LOCATION + "/.one/onegate_auth" ONEGATE_LOG = LOG_LOCATION + "/onegate.log" CONFIGURATION_FILE = ETC_LOCATION + "/onegate-server.conf" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cloud' diff --git a/src/sunstone/bin/novnc-server b/src/sunstone/bin/novnc-server index e5df0a4855..e2533710b7 100755 --- a/src/sunstone/bin/novnc-server +++ b/src/sunstone/bin/novnc-server @@ -41,14 +41,25 @@ VNC_LOG = LOG_LOCATION + "/novnc.log" CONFIGURATION_FILE = ETC_LOCATION + "/sunstone-server.conf" PLUGIN_CONFIGURATION_FILE = ETC_LOCATION + "/sunstone-plugins.yaml" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << RUBY_LIB_LOCATION + '/cloud' diff --git a/src/sunstone/routes/nsx.rb b/src/sunstone/routes/nsx.rb index 49301c756d..e1d8a2dc4f 100644 --- a/src/sunstone/routes/nsx.rb +++ b/src/sunstone/routes/nsx.rb @@ -28,14 +28,25 @@ else unless defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 7362512e17..a78611fc8c 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -45,21 +45,35 @@ LOGOS_CONFIGURATION_FILE = ETC_LOCATION + '/sunstone-logos.yaml' SUNSTONE_ROOT_DIR = File.dirname(__FILE__) +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) - # for some platforms, we redistribute newer base Ruby gems which - # should be loaded instead of default ones in the distributions - %w[openssl json].each do |name| - begin - gem name - rescue LoadError - # ignore - end + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end + end +end +# %%RUBYGEMS_SETUP_END%% + +# Extra bundled gems initialization +if File.directory?(GEMS_LOCATION) + # for some platforms, we redistribute newer base Ruby gems which + # should be loaded instead of default ones in the distributions + %w[openssl json].each do |name| + begin + gem name + rescue LoadError + # ignore end end end diff --git a/src/tm_mad/one_tm.rb b/src/tm_mad/one_tm.rb index d2bd162376..3ea3e1f05d 100755 --- a/src/tm_mad/one_tm.rb +++ b/src/tm_mad/one_tm.rb @@ -30,14 +30,25 @@ if !defined? ONE_LOCATION end end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/tm_mad/vcenter/clone b/src/tm_mad/vcenter/clone index e32e93cf4d..3de6a6a3c6 100755 --- a/src/tm_mad/vcenter/clone +++ b/src/tm_mad/vcenter/clone @@ -34,14 +34,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/cpds b/src/tm_mad/vcenter/cpds index c224b5deef..c66d0a87d0 100755 --- a/src/tm_mad/vcenter/cpds +++ b/src/tm_mad/vcenter/cpds @@ -33,14 +33,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/delete b/src/tm_mad/vcenter/delete index cdc3471edf..06829dbb13 100755 --- a/src/tm_mad/vcenter/delete +++ b/src/tm_mad/vcenter/delete @@ -33,14 +33,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/mkimage b/src/tm_mad/vcenter/mkimage index b66bfe640f..7265e2570e 100755 --- a/src/tm_mad/vcenter/mkimage +++ b/src/tm_mad/vcenter/mkimage @@ -34,14 +34,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/mv b/src/tm_mad/vcenter/mv index 26703a7fd2..692a953c71 100755 --- a/src/tm_mad/vcenter/mv +++ b/src/tm_mad/vcenter/mv @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/mvds b/src/tm_mad/vcenter/mvds index e63c3a5d00..c81a6b2c13 100755 --- a/src/tm_mad/vcenter/mvds +++ b/src/tm_mad/vcenter/mvds @@ -34,14 +34,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/tm_mad/vcenter/resize b/src/tm_mad/vcenter/resize index 80a4033804..037c9f885d 100755 --- a/src/tm_mad/vcenter/resize +++ b/src/tm_mad/vcenter/resize @@ -28,14 +28,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/dummy/one_vmm_dummy.rb b/src/vmm_mad/dummy/one_vmm_dummy.rb index aaf044508c..bf12b07d1d 100755 --- a/src/vmm_mad/dummy/one_vmm_dummy.rb +++ b/src/vmm_mad/dummy/one_vmm_dummy.rb @@ -28,14 +28,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index a6854cccaf..ae86db7666 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -32,14 +32,25 @@ else ETC_LOCATION = ONE_LOCATION + '/etc/' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << MAD_LOCATION diff --git a/src/vmm_mad/remotes/az/az_driver.rb b/src/vmm_mad/remotes/az/az_driver.rb index e1405efa1a..0478261d86 100755 --- a/src/vmm_mad/remotes/az/az_driver.rb +++ b/src/vmm_mad/remotes/az/az_driver.rb @@ -33,14 +33,25 @@ AZ_DRIVER_CONF = "#{ETC_LOCATION}/az_driver.conf" AZ_DRIVER_DEFAULT = "#{ETC_LOCATION}/az_driver.default" AZ_DATABASE_PATH = "#{VAR_LOCATION}/remotes/im/az.d/az-cache.db" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/az/cancel b/src/vmm_mad/remotes/az/cancel index eacc73d781..c16f05a162 100755 --- a/src/vmm_mad/remotes/az/cancel +++ b/src/vmm_mad/remotes/az/cancel @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/az/deploy b/src/vmm_mad/remotes/az/deploy index 5eb2fdd46d..5627fa6696 100755 --- a/src/vmm_mad/remotes/az/deploy +++ b/src/vmm_mad/remotes/az/deploy @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/az/poll b/src/vmm_mad/remotes/az/poll index eb36cd4fdf..6a18960f40 100755 --- a/src/vmm_mad/remotes/az/poll +++ b/src/vmm_mad/remotes/az/poll @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/az/reboot b/src/vmm_mad/remotes/az/reboot index ec587b4f8b..b1b71d3e66 100755 --- a/src/vmm_mad/remotes/az/reboot +++ b/src/vmm_mad/remotes/az/reboot @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/az/restore b/src/vmm_mad/remotes/az/restore index b87087894d..526f850d9f 100755 --- a/src/vmm_mad/remotes/az/restore +++ b/src/vmm_mad/remotes/az/restore @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/az/shutdown b/src/vmm_mad/remotes/az/shutdown index 0aedae9bcc..44ad361689 100755 --- a/src/vmm_mad/remotes/az/shutdown +++ b/src/vmm_mad/remotes/az/shutdown @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/cancel b/src/vmm_mad/remotes/ec2/cancel index 7efd47431a..06f34ab6ee 100755 --- a/src/vmm_mad/remotes/ec2/cancel +++ b/src/vmm_mad/remotes/ec2/cancel @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/deploy b/src/vmm_mad/remotes/ec2/deploy index 2b6c6c2bf2..f734de32db 100755 --- a/src/vmm_mad/remotes/ec2/deploy +++ b/src/vmm_mad/remotes/ec2/deploy @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/ec2_driver.rb b/src/vmm_mad/remotes/ec2/ec2_driver.rb index 147ee1cc42..8871fe9229 100755 --- a/src/vmm_mad/remotes/ec2/ec2_driver.rb +++ b/src/vmm_mad/remotes/ec2/ec2_driver.rb @@ -33,14 +33,25 @@ EC2_DRIVER_CONF = "#{ETC_LOCATION}/ec2_driver.conf" EC2_DRIVER_DEFAULT = "#{ETC_LOCATION}/ec2_driver.default" EC2_DATABASE_PATH = "#{VAR_LOCATION}/remotes/im/ec2.d/ec2-cache.db" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/ec2/poll b/src/vmm_mad/remotes/ec2/poll index 5932f65e76..bcffab7325 100755 --- a/src/vmm_mad/remotes/ec2/poll +++ b/src/vmm_mad/remotes/ec2/poll @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/reboot b/src/vmm_mad/remotes/ec2/reboot index 90fd3baeef..3858499045 100755 --- a/src/vmm_mad/remotes/ec2/reboot +++ b/src/vmm_mad/remotes/ec2/reboot @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/restore b/src/vmm_mad/remotes/ec2/restore index 7614daf7d3..706e338765 100755 --- a/src/vmm_mad/remotes/ec2/restore +++ b/src/vmm_mad/remotes/ec2/restore @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/ec2/shutdown b/src/vmm_mad/remotes/ec2/shutdown index 929a4c5f61..bb3b72eb3c 100755 --- a/src/vmm_mad/remotes/ec2/shutdown +++ b/src/vmm_mad/remotes/ec2/shutdown @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/lib/nsx_driver/distributed_firewall.rb b/src/vmm_mad/remotes/lib/nsx_driver/distributed_firewall.rb index ccea92f61f..e1bc2e2ee7 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/distributed_firewall.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/distributed_firewall.rb @@ -29,14 +29,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/nsx_driver/nsx_client.rb b/src/vmm_mad/remotes/lib/nsx_driver/nsx_client.rb index e9a1803a79..2d11a63777 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/nsx_client.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/nsx_client.rb @@ -29,14 +29,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/nsx_driver/nsx_constants.rb b/src/vmm_mad/remotes/lib/nsx_driver/nsx_constants.rb index ceb787f350..5445efd6be 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/nsx_constants.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/nsx_constants.rb @@ -6,7 +6,7 @@ # a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # -# # +# # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # @@ -29,14 +29,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/nsx_driver/nsx_rule.rb b/src/vmm_mad/remotes/lib/nsx_driver/nsx_rule.rb index fb59b4170a..f09a8df159 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/nsx_rule.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/nsx_rule.rb @@ -33,14 +33,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/nsx_driver/nsxt_client.rb b/src/vmm_mad/remotes/lib/nsx_driver/nsxt_client.rb index 0035604487..fcd77f8708 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/nsxt_client.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/nsxt_client.rb @@ -29,14 +29,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/nsx_driver/nsxv_client.rb b/src/vmm_mad/remotes/lib/nsx_driver/nsxv_client.rb index 472e4f89a0..c858e1673d 100644 --- a/src/vmm_mad/remotes/lib/nsx_driver/nsxv_client.rb +++ b/src/vmm_mad/remotes/lib/nsx_driver/nsxv_client.rb @@ -29,14 +29,27 @@ module NSXDriver unless defined?(GEMS_LOCATION) end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb index 3753041261..bcce7cfa59 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb @@ -33,14 +33,27 @@ module VCenterDriver end end - if File.directory?(GEMS_LOCATION) - real_gems_path = File.realpath(GEMS_LOCATION) - if !defined?(Gem) || Gem.path != [real_gems_path] - $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% +if File.directory?(GEMS_LOCATION) + real_gems_path = File.realpath(GEMS_LOCATION) + if !defined?(Gem) || Gem.path != [real_gems_path] + $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil require 'rubygems' Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb end end +end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/nsx/nsx_driver.rb b/src/vmm_mad/remotes/nsx/nsx_driver.rb index 6333114bde..3ba72f6ea5 100644 --- a/src/vmm_mad/remotes/nsx/nsx_driver.rb +++ b/src/vmm_mad/remotes/nsx/nsx_driver.rb @@ -36,14 +36,27 @@ end ENV['LANG'] = 'C' +# rubocop: disable all +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% +# rubocop: enable all $LOAD_PATH << LIB_LOCATION + '/ruby' $LOAD_PATH << LIB_LOCATION + '/ruby/nsx_driver' diff --git a/src/vmm_mad/remotes/one/cancel b/src/vmm_mad/remotes/one/cancel index 882f2c277d..0f8dccc9d9 100755 --- a/src/vmm_mad/remotes/one/cancel +++ b/src/vmm_mad/remotes/one/cancel @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/deploy b/src/vmm_mad/remotes/one/deploy index 4d5aa538c8..f4bc6b2d8e 100755 --- a/src/vmm_mad/remotes/one/deploy +++ b/src/vmm_mad/remotes/one/deploy @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/opennebula_driver.rb b/src/vmm_mad/remotes/one/opennebula_driver.rb index 9ca963ba05..fd9646a3b5 100755 --- a/src/vmm_mad/remotes/one/opennebula_driver.rb +++ b/src/vmm_mad/remotes/one/opennebula_driver.rb @@ -31,14 +31,25 @@ end # Load credentials and environment require 'yaml' +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/one/poll b/src/vmm_mad/remotes/one/poll index 3e126aa0fa..dcfa0b20c4 100755 --- a/src/vmm_mad/remotes/one/poll +++ b/src/vmm_mad/remotes/one/poll @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/reboot b/src/vmm_mad/remotes/one/reboot index 9451897870..398e6f6468 100755 --- a/src/vmm_mad/remotes/one/reboot +++ b/src/vmm_mad/remotes/one/reboot @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/reset b/src/vmm_mad/remotes/one/reset index 5bd06d989f..c6940b6721 100755 --- a/src/vmm_mad/remotes/one/reset +++ b/src/vmm_mad/remotes/one/reset @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/restore b/src/vmm_mad/remotes/one/restore index 155535ec02..ab0a51b8f9 100755 --- a/src/vmm_mad/remotes/one/restore +++ b/src/vmm_mad/remotes/one/restore @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/save b/src/vmm_mad/remotes/one/save index 767a853ea9..7899deaeb9 100755 --- a/src/vmm_mad/remotes/one/save +++ b/src/vmm_mad/remotes/one/save @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/one/shutdown b/src/vmm_mad/remotes/one/shutdown index 01a769d064..3c1a537029 100755 --- a/src/vmm_mad/remotes/one/shutdown +++ b/src/vmm_mad/remotes/one/shutdown @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/packet/cancel b/src/vmm_mad/remotes/packet/cancel index 1123370857..c04eb70f88 100755 --- a/src/vmm_mad/remotes/packet/cancel +++ b/src/vmm_mad/remotes/packet/cancel @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << File.dirname(__FILE__) $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/packet/deploy b/src/vmm_mad/remotes/packet/deploy index 36ac35c68b..8044579bae 100755 --- a/src/vmm_mad/remotes/packet/deploy +++ b/src/vmm_mad/remotes/packet/deploy @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << File.dirname(__FILE__) $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/packet/packet_driver.rb b/src/vmm_mad/remotes/packet/packet_driver.rb index b6d8743ffa..7cb958f97f 100644 --- a/src/vmm_mad/remotes/packet/packet_driver.rb +++ b/src/vmm_mad/remotes/packet/packet_driver.rb @@ -30,14 +30,25 @@ end PACKET_DATABASE_PATH = "#{VAR_LOCATION}/remotes/im/packet.d/packet-cache.db" +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << PACKET_LOCATION diff --git a/src/vmm_mad/remotes/packet/poll b/src/vmm_mad/remotes/packet/poll index cd95cb6f58..724afb4ecb 100755 --- a/src/vmm_mad/remotes/packet/poll +++ b/src/vmm_mad/remotes/packet/poll @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/packet/reboot b/src/vmm_mad/remotes/packet/reboot index 11948054c5..f5d17dcb27 100755 --- a/src/vmm_mad/remotes/packet/reboot +++ b/src/vmm_mad/remotes/packet/reboot @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << File.dirname(__FILE__) $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/packet/reset b/src/vmm_mad/remotes/packet/reset index 41a8f2fd56..0e3a167451 100755 --- a/src/vmm_mad/remotes/packet/reset +++ b/src/vmm_mad/remotes/packet/reset @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << File.dirname(__FILE__) $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vmm_mad/remotes/packet/shutdown b/src/vmm_mad/remotes/packet/shutdown index 69cb6c0c94..242209d16a 100755 --- a/src/vmm_mad/remotes/packet/shutdown +++ b/src/vmm_mad/remotes/packet/shutdown @@ -26,14 +26,25 @@ else GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION) end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/attach_disk b/src/vmm_mad/remotes/vcenter/attach_disk index 2d85c0e06f..3f6d9fbd29 100755 --- a/src/vmm_mad/remotes/vcenter/attach_disk +++ b/src/vmm_mad/remotes/vcenter/attach_disk @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/attach_nic b/src/vmm_mad/remotes/vcenter/attach_nic index e9d49fd380..eb5d2d0adf 100755 --- a/src/vmm_mad/remotes/vcenter/attach_nic +++ b/src/vmm_mad/remotes/vcenter/attach_nic @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/cancel b/src/vmm_mad/remotes/vcenter/cancel index 100d45967c..37adcfebd6 100755 --- a/src/vmm_mad/remotes/vcenter/cancel +++ b/src/vmm_mad/remotes/vcenter/cancel @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/deploy b/src/vmm_mad/remotes/vcenter/deploy index 8acb9df807..444aee89f0 100755 --- a/src/vmm_mad/remotes/vcenter/deploy +++ b/src/vmm_mad/remotes/vcenter/deploy @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/detach_nic b/src/vmm_mad/remotes/vcenter/detach_nic index 736227c698..0684debb90 100755 --- a/src/vmm_mad/remotes/vcenter/detach_nic +++ b/src/vmm_mad/remotes/vcenter/detach_nic @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/migrate b/src/vmm_mad/remotes/vcenter/migrate index 729500244b..41e3d0d71d 100755 --- a/src/vmm_mad/remotes/vcenter/migrate +++ b/src/vmm_mad/remotes/vcenter/migrate @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/reboot b/src/vmm_mad/remotes/vcenter/reboot index 215c040849..650471acd4 100755 --- a/src/vmm_mad/remotes/vcenter/reboot +++ b/src/vmm_mad/remotes/vcenter/reboot @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/reconfigure b/src/vmm_mad/remotes/vcenter/reconfigure index 7fe04dfb73..8bd80ca317 100755 --- a/src/vmm_mad/remotes/vcenter/reconfigure +++ b/src/vmm_mad/remotes/vcenter/reconfigure @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/reset b/src/vmm_mad/remotes/vcenter/reset index e3bda579a8..91894f55a9 100755 --- a/src/vmm_mad/remotes/vcenter/reset +++ b/src/vmm_mad/remotes/vcenter/reset @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/resize b/src/vmm_mad/remotes/vcenter/resize index e241b4079f..7050c59074 100755 --- a/src/vmm_mad/remotes/vcenter/resize +++ b/src/vmm_mad/remotes/vcenter/resize @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= '/usr/share/one/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/restore b/src/vmm_mad/remotes/vcenter/restore index c1b7c3cb98..1bc2de4e25 100755 --- a/src/vmm_mad/remotes/vcenter/restore +++ b/src/vmm_mad/remotes/vcenter/restore @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/save b/src/vmm_mad/remotes/vcenter/save index 3faaf8ecd7..65b3327809 100755 --- a/src/vmm_mad/remotes/vcenter/save +++ b/src/vmm_mad/remotes/vcenter/save @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/shutdown b/src/vmm_mad/remotes/vcenter/shutdown index dcd40b9a7a..c924ab135e 100755 --- a/src/vmm_mad/remotes/vcenter/shutdown +++ b/src/vmm_mad/remotes/vcenter/shutdown @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/snapshot_create b/src/vmm_mad/remotes/vcenter/snapshot_create index ad24c74bb8..f49e955f2d 100755 --- a/src/vmm_mad/remotes/vcenter/snapshot_create +++ b/src/vmm_mad/remotes/vcenter/snapshot_create @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/snapshot_delete b/src/vmm_mad/remotes/vcenter/snapshot_delete index 434070b7d6..b5bafae4e7 100755 --- a/src/vmm_mad/remotes/vcenter/snapshot_delete +++ b/src/vmm_mad/remotes/vcenter/snapshot_delete @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/snapshot_revert b/src/vmm_mad/remotes/vcenter/snapshot_revert index 5f8a6e54b4..3835d37a6a 100755 --- a/src/vmm_mad/remotes/vcenter/snapshot_revert +++ b/src/vmm_mad/remotes/vcenter/snapshot_revert @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb index 3044d99bd3..9c7cd0c51d 100644 --- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb +++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb @@ -36,14 +36,25 @@ end ENV['LANG'] = 'C' +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << LIB_LOCATION + '/ruby/vendors/rbvmomi/lib' $LOAD_PATH << LIB_LOCATION + '/ruby' diff --git a/src/vnm_mad/remotes/elastic/aws_vnm.rb b/src/vnm_mad/remotes/elastic/aws_vnm.rb index 7e07bc0f72..6f3ff8d6c0 100644 --- a/src/vnm_mad/remotes/elastic/aws_vnm.rb +++ b/src/vnm_mad/remotes/elastic/aws_vnm.rb @@ -26,14 +26,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << LIB_LOCATION + '/oneprovision/lib' diff --git a/src/vnm_mad/remotes/elastic/clean b/src/vnm_mad/remotes/elastic/clean index 35856a5bd9..eab98c1c85 100755 --- a/src/vnm_mad/remotes/elastic/clean +++ b/src/vnm_mad/remotes/elastic/clean @@ -28,14 +28,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vnm_mad/remotes/elastic/packet_vnm.rb b/src/vnm_mad/remotes/elastic/packet_vnm.rb index 40250ea5fc..23fa3ce2d3 100644 --- a/src/vnm_mad/remotes/elastic/packet_vnm.rb +++ b/src/vnm_mad/remotes/elastic/packet_vnm.rb @@ -28,14 +28,25 @@ else PACKET_LOCATION ||= ONE_LOCATION + '/lib/ruby/vendors/packethost/lib' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << PACKET_LOCATION diff --git a/src/vnm_mad/remotes/elastic/post b/src/vnm_mad/remotes/elastic/post index fea33d0680..58bf13fdbc 100755 --- a/src/vnm_mad/remotes/elastic/post +++ b/src/vnm_mad/remotes/elastic/post @@ -28,14 +28,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vnm_mad/remotes/elastic/pre b/src/vnm_mad/remotes/elastic/pre index 55c94e60ce..2f31524923 100755 --- a/src/vnm_mad/remotes/elastic/pre +++ b/src/vnm_mad/remotes/elastic/pre @@ -28,14 +28,25 @@ else GEMS_LOCATION ||= ONE_LOCATION + '/share/gems' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION $LOAD_PATH << File.dirname(__FILE__) diff --git a/src/vnm_mad/remotes/vcenter/clean b/src/vnm_mad/remotes/vcenter/clean index 5463b00274..ddfb4caea5 100755 --- a/src/vnm_mad/remotes/vcenter/clean +++ b/src/vnm_mad/remotes/vcenter/clean @@ -30,14 +30,25 @@ else CONFIG_FILE = ONE_LOCATION + '/var/config' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vnm_mad/remotes/vcenter/post b/src/vnm_mad/remotes/vcenter/post index ba8b6ecda0..27818e7b73 100755 --- a/src/vnm_mad/remotes/vcenter/post +++ b/src/vnm_mad/remotes/vcenter/post @@ -30,14 +30,25 @@ else CONFIG_FILE = ONE_LOCATION + '/var/config' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION diff --git a/src/vnm_mad/remotes/vcenter/update_sg b/src/vnm_mad/remotes/vcenter/update_sg index a055c612bd..3c86c83dc2 100755 --- a/src/vnm_mad/remotes/vcenter/update_sg +++ b/src/vnm_mad/remotes/vcenter/update_sg @@ -30,14 +30,25 @@ else CONFIG_FILE = ONE_LOCATION + '/var/config' end +# %%RUBYGEMS_SETUP_BEGIN%% if File.directory?(GEMS_LOCATION) real_gems_path = File.realpath(GEMS_LOCATION) if !defined?(Gem) || Gem.path != [real_gems_path] $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ } - require 'rubygems' - Gem.use_paths(real_gems_path) + + # Suppress warnings from Rubygems + # https://github.com/OpenNebula/one/issues/5379 + begin + verb = $VERBOSE + $VERBOSE = nil + require 'rubygems' + Gem.use_paths(real_gems_path) + ensure + $VERBOSE = verb + end end end +# %%RUBYGEMS_SETUP_END%% $LOAD_PATH << RUBY_LIB_LOCATION