diff --git a/share/install_gems/AlmaLinux8/Gemfile.lock b/share/install_gems/AlmaLinux8/Gemfile.lock index 7371e1169b..23125ac596 100644 --- a/share/install_gems/AlmaLinux8/Gemfile.lock +++ b/share/install_gems/AlmaLinux8/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -115,6 +115,7 @@ GEM nokogiri (~> 1.12, >= 1.12.5) optimist (~> 3.0) rchardet (1.8.0) + rexml (3.4.1) ruby2_keywords (0.0.5) sequel (5.91.0) bigdecimal @@ -174,6 +175,7 @@ DEPENDENCIES public_suffix rack rbvmomi2 + rexml sequel sinatra (< 4.0.0) sqlite3 (<= 1.6.9) diff --git a/share/install_gems/AlmaLinux9/Gemfile.lock b/share/install_gems/AlmaLinux9/Gemfile.lock index 5861c7306d..97773ca12c 100644 --- a/share/install_gems/AlmaLinux9/Gemfile.lock +++ b/share/install_gems/AlmaLinux9/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -107,7 +107,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.13) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) diff --git a/share/install_gems/Debian11/Gemfile.lock b/share/install_gems/Debian11/Gemfile.lock index b396d33c2b..2669d4e203 100644 --- a/share/install_gems/Debian11/Gemfile.lock +++ b/share/install_gems/Debian11/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -117,6 +117,7 @@ GEM nokogiri (~> 1.12, >= 1.12.5) optimist (~> 3.0) rchardet (1.8.0) + rexml (3.4.1) ruby2_keywords (0.0.5) sequel (5.91.0) bigdecimal @@ -174,6 +175,7 @@ DEPENDENCIES public_suffix rack rbvmomi2 + rexml sequel sinatra (< 4.0.0) sqlite3 (<= 1.6.9) diff --git a/share/install_gems/Debian12/Gemfile.lock b/share/install_gems/Debian12/Gemfile.lock index 7dcc43e70c..d430dcf98e 100644 --- a/share/install_gems/Debian12/Gemfile.lock +++ b/share/install_gems/Debian12/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -74,7 +74,7 @@ GEM ffi fiber-local (1.1.0) fiber-storage - fiber-storage (1.0.0) + fiber-storage (1.0.1) git (1.19.1) addressable (~> 2.8) rchardet (~> 1.8) @@ -94,12 +94,12 @@ GEM mysql2 (0.5.6) net-ldap (0.19.0) nio4r (2.7.4) - nokogiri (1.18.7) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.7-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) opennebula-augeas (0.6.6) optimist (3.2.1) @@ -113,7 +113,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.13) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) @@ -207,4 +207,4 @@ RUBY VERSION ruby 3.1.2p20 BUNDLED WITH - 2.6.7 + 2.6.8 diff --git a/share/install_gems/Gemfile b/share/install_gems/Gemfile index 39cde1abc2..4b4dcad313 100644 --- a/share/install_gems/Gemfile +++ b/share/install_gems/Gemfile @@ -35,10 +35,6 @@ if ruby_version < Gem::Version.new('2.1.0') gem 'scrub_rb' end -if ruby_version >= Gem::Version.new('3.0.0') - gem 'rexml' -end - if ruby_version < Gem::Version.new('2.6.0') gem 'unf', '< 0.2.0' end @@ -78,6 +74,7 @@ gem 'ffi-rzmq', '~> 2.0.7' gem 'net-ldap' gem 'nokogiri', nokogiri gem 'public_suffix', ps +gem 'rexml' gem 'aws-sdk-ec2', '>=1.151' gem 'aws-sdk-s3' diff --git a/share/install_gems/RedHat8/Gemfile.lock b/share/install_gems/RedHat8/Gemfile.lock index 7371e1169b..23125ac596 100644 --- a/share/install_gems/RedHat8/Gemfile.lock +++ b/share/install_gems/RedHat8/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -115,6 +115,7 @@ GEM nokogiri (~> 1.12, >= 1.12.5) optimist (~> 3.0) rchardet (1.8.0) + rexml (3.4.1) ruby2_keywords (0.0.5) sequel (5.91.0) bigdecimal @@ -174,6 +175,7 @@ DEPENDENCIES public_suffix rack rbvmomi2 + rexml sequel sinatra (< 4.0.0) sqlite3 (<= 1.6.9) diff --git a/share/install_gems/RedHat9/Gemfile.lock b/share/install_gems/RedHat9/Gemfile.lock index 5861c7306d..97773ca12c 100644 --- a/share/install_gems/RedHat9/Gemfile.lock +++ b/share/install_gems/RedHat9/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -107,7 +107,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.13) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) diff --git a/share/install_gems/Ubuntu2204/Gemfile.lock b/share/install_gems/Ubuntu2204/Gemfile.lock index 1a04890c0f..c168c298fe 100644 --- a/share/install_gems/Ubuntu2204/Gemfile.lock +++ b/share/install_gems/Ubuntu2204/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -107,7 +107,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.13) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) diff --git a/share/install_gems/Ubuntu2404/Gemfile.lock b/share/install_gems/Ubuntu2404/Gemfile.lock index be2d04d7a3..3f48c4a1e1 100644 --- a/share/install_gems/Ubuntu2404/Gemfile.lock +++ b/share/install_gems/Ubuntu2404/Gemfile.lock @@ -15,15 +15,15 @@ GEM async-io (1.32.1) async (~> 1.14) aws-eventstream (1.3.2) - aws-partitions (1.1084.0) - aws-sdk-core (3.222.1) + aws-partitions (1.1090.0) + aws-sdk-core (3.222.2) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) base64 jmespath (~> 1, >= 1.6.1) logger - aws-sdk-ec2 (1.515.0) + aws-sdk-ec2 (1.516.0) aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) aws-sdk-kms (1.99.0) @@ -67,24 +67,24 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.1) faraday (~> 1.0) - ffi (1.17.1) - ffi (1.17.1-aarch64-linux-gnu) - ffi (1.17.1-aarch64-linux-musl) - ffi (1.17.1-arm-linux-gnu) - ffi (1.17.1-arm-linux-musl) - ffi (1.17.1-arm64-darwin) - ffi (1.17.1-x86-linux-gnu) - ffi (1.17.1-x86-linux-musl) - ffi (1.17.1-x86_64-darwin) - ffi (1.17.1-x86_64-linux-gnu) - ffi (1.17.1-x86_64-linux-musl) + ffi (1.17.2) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86-linux-gnu) + ffi (1.17.2-x86-linux-musl) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) ffi-rzmq (2.0.7) ffi-rzmq-core (>= 1.0.7) ffi-rzmq-core (1.0.7) ffi fiber-local (1.1.0) fiber-storage - fiber-storage (1.0.0) + fiber-storage (1.0.1) git (1.19.1) addressable (~> 2.8) rchardet (~> 1.8) @@ -104,24 +104,24 @@ GEM mysql2 (0.5.6) net-ldap (0.19.0) nio4r (2.7.4) - nokogiri (1.18.7) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.7-aarch64-linux-gnu) + nokogiri (1.18.8-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-aarch64-linux-musl) + nokogiri (1.18.8-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.18.7-arm-linux-gnu) + nokogiri (1.18.8-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-arm-linux-musl) + nokogiri (1.18.8-arm-linux-musl) racc (~> 1.4) - nokogiri (1.18.7-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-linux-gnu) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-x86_64-linux-musl) + nokogiri (1.18.8-x86_64-linux-musl) racc (~> 1.4) opennebula-augeas (0.6.6) optimist (3.2.1) @@ -135,7 +135,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.12) + rack (3.1.13) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) @@ -240,4 +240,4 @@ RUBY VERSION ruby 3.2.3p157 BUNDLED WITH - 2.6.7 + 2.6.8 diff --git a/src/datastore_mad/remotes/xpath.rb b/src/datastore_mad/remotes/xpath.rb index eb9066fc75..9dafe42737 100755 --- a/src/datastore_mad/remotes/xpath.rb +++ b/src/datastore_mad/remotes/xpath.rb @@ -19,6 +19,41 @@ # Simple command to parse an XML document (b64 encoded) and return one or more # elements (refer by xpath) # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'base64' require 'rexml/document' require 'getoptlong' diff --git a/src/flow/lib/models/vrrole.rb b/src/flow/lib/models/vrrole.rb index 29acd3e657..b50e224bbf 100644 --- a/src/flow/lib/models/vrrole.rb +++ b/src/flow/lib/models/vrrole.rb @@ -244,7 +244,7 @@ module OpenNebula # - Array of VM IDs that were associated with the Virtual Router # # If the router could not be deleted, returns `false` and an empty list. - def shutdown_nodes(nodes, n_nodes, _) + def shutdown_nodes(_nodes, n_nodes, _) vrouter_id = @body['vrouter_id'] return [true, []] if vrouter_id.nil? diff --git a/src/im_mad/remotes/common.d/monitord-client.rb b/src/im_mad/remotes/common.d/monitord-client.rb index c64bf4aa43..447b45d4f4 100644 --- a/src/im_mad/remotes/common.d/monitord-client.rb +++ b/src/im_mad/remotes/common.d/monitord-client.rb @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'base64' require 'yaml' require 'open3' diff --git a/src/im_mad/remotes/kvm-probes.d/host/monitor/linux_usage.rb b/src/im_mad/remotes/kvm-probes.d/host/monitor/linux_usage.rb index 6b01504ed2..3c2c912deb 100755 --- a/src/im_mad/remotes/kvm-probes.d/host/monitor/linux_usage.rb +++ b/src/im_mad/remotes/kvm-probes.d/host/monitor/linux_usage.rb @@ -16,6 +16,40 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../../../lib/linux' diff --git a/src/im_mad/remotes/kvm-probes.d/host/system/machines_models.rb b/src/im_mad/remotes/kvm-probes.d/host/system/machines_models.rb index 25d00dc02c..40a1e9b3d6 100755 --- a/src/im_mad/remotes/kvm-probes.d/host/system/machines_models.rb +++ b/src/im_mad/remotes/kvm-probes.d/host/system/machines_models.rb @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'open3' diff --git a/src/im_mad/remotes/kvm-probes.d/host/system/wild_vm.rb b/src/im_mad/remotes/kvm-probes.d/host/system/wild_vm.rb index ea9229b45a..4dcca61b66 100755 --- a/src/im_mad/remotes/kvm-probes.d/host/system/wild_vm.rb +++ b/src/im_mad/remotes/kvm-probes.d/host/system/wild_vm.rb @@ -1,5 +1,39 @@ #!/usr/bin/ruby +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require_relative '../../../lib/kvm' KVM.load_conf diff --git a/src/im_mad/remotes/kvm-probes.d/vm/monitor/poll.rb b/src/im_mad/remotes/kvm-probes.d/vm/monitor/poll.rb index 849d516d9d..6b5878d1a4 100755 --- a/src/im_mad/remotes/kvm-probes.d/vm/monitor/poll.rb +++ b/src/im_mad/remotes/kvm-probes.d/vm/monitor/poll.rb @@ -1,5 +1,39 @@ #!/usr/bin/ruby +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require_relative '../../../lib/kvm' KVM.load_conf diff --git a/src/im_mad/remotes/kvm-probes.d/vm/snapshot/recovery.rb b/src/im_mad/remotes/kvm-probes.d/vm/snapshot/recovery.rb index dcf620fcf6..3e408c4998 100755 --- a/src/im_mad/remotes/kvm-probes.d/vm/snapshot/recovery.rb +++ b/src/im_mad/remotes/kvm-probes.d/vm/snapshot/recovery.rb @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'fileutils' require 'open3' diff --git a/src/im_mad/remotes/kvm-probes.d/vm/status/state.rb b/src/im_mad/remotes/kvm-probes.d/vm/status/state.rb index e76c1aed62..f5fc061ed3 100755 --- a/src/im_mad/remotes/kvm-probes.d/vm/status/state.rb +++ b/src/im_mad/remotes/kvm-probes.d/vm/status/state.rb @@ -1,4 +1,37 @@ #!/usr/bin/ruby +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 require_relative '../../../lib/kvm' require_relative '../../../lib/probe_db' diff --git a/src/im_mad/remotes/lxc-probes.d/vm/status/state.rb b/src/im_mad/remotes/lxc-probes.d/vm/status/state.rb index e19a19ab30..2042acd09d 100755 --- a/src/im_mad/remotes/lxc-probes.d/vm/status/state.rb +++ b/src/im_mad/remotes/lxc-probes.d/vm/status/state.rb @@ -1,4 +1,37 @@ #!/usr/bin/ruby +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 require_relative '../../../lib/probe_db' require_relative '../../../lib/lxc' diff --git a/src/im_mad/remotes/node-probes.d/monitor_ds.rb b/src/im_mad/remotes/node-probes.d/monitor_ds.rb index ee19f8ffa7..b798e19c4a 100755 --- a/src/im_mad/remotes/node-probes.d/monitor_ds.rb +++ b/src/im_mad/remotes/node-probes.d/monitor_ds.rb @@ -15,6 +15,40 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'open3' require 'fileutils' diff --git a/src/im_mad/remotes/node-probes.d/monitor_ds_vm.rb b/src/im_mad/remotes/node-probes.d/monitor_ds_vm.rb index ae5612d380..6a6845bd62 100755 --- a/src/im_mad/remotes/node-probes.d/monitor_ds_vm.rb +++ b/src/im_mad/remotes/node-probes.d/monitor_ds_vm.rb @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'fileutils' require 'open3' diff --git a/src/market_mad/remotes/linuxcontainers/monitor b/src/market_mad/remotes/linuxcontainers/monitor index 06a81d16d6..54c28ec2bf 100755 --- a/src/market_mad/remotes/linuxcontainers/monitor +++ b/src/market_mad/remotes/linuxcontainers/monitor @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # # -------------------------------------------------------------------------- # +# + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 require 'net/http' require 'uri' diff --git a/src/market_mad/remotes/one/monitor b/src/market_mad/remotes/one/monitor index 0cd9e0c5d1..84585ee6de 100755 --- a/src/market_mad/remotes/one/monitor +++ b/src/market_mad/remotes/one/monitor @@ -16,6 +16,40 @@ # limitations under the License. # # -------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'net/http' require 'uri' require 'json' diff --git a/src/tm_mad/ceph/postbackup_live b/src/tm_mad/ceph/postbackup_live index 46a838a447..835ff9d461 100755 --- a/src/tm_mad/ceph/postbackup_live +++ b/src/tm_mad/ceph/postbackup_live @@ -15,6 +15,40 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../lib/tm_action' diff --git a/src/tm_mad/ceph/prebackup b/src/tm_mad/ceph/prebackup index ffe4a4e2e9..2be3207f07 100755 --- a/src/tm_mad/ceph/prebackup +++ b/src/tm_mad/ceph/prebackup @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../lib/tm_action' diff --git a/src/tm_mad/ceph/prebackup_live b/src/tm_mad/ceph/prebackup_live index 834ae0e32e..c7cc81f8e7 100755 --- a/src/tm_mad/ceph/prebackup_live +++ b/src/tm_mad/ceph/prebackup_live @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../lib/tm_action' diff --git a/src/tm_mad/ceph/restore b/src/tm_mad/ceph/restore index a245cdc10c..dfaaa8bcb7 100755 --- a/src/tm_mad/ceph/restore +++ b/src/tm_mad/ceph/restore @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'json' require 'securerandom' diff --git a/src/tm_mad/lib/backup_qcow2.rb b/src/tm_mad/lib/backup_qcow2.rb index 7002df4ed8..156d8863a0 100755 --- a/src/tm_mad/lib/backup_qcow2.rb +++ b/src/tm_mad/lib/backup_qcow2.rb @@ -16,6 +16,40 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'json' require 'open3' require 'rexml/document' diff --git a/src/tm_mad/local/restore b/src/tm_mad/local/restore index f17fa4991b..16e8df033b 100755 --- a/src/tm_mad/local/restore +++ b/src/tm_mad/local/restore @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'json' diff --git a/src/tm_mad/qcow2/prebackup b/src/tm_mad/qcow2/prebackup index 1efb622ecf..a99f17b2d4 100755 --- a/src/tm_mad/qcow2/prebackup +++ b/src/tm_mad/qcow2/prebackup @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../lib/tm_action' diff --git a/src/tm_mad/qcow2/prebackup_live b/src/tm_mad/qcow2/prebackup_live index 03c00e4cd8..b20a872b92 100755 --- a/src/tm_mad/qcow2/prebackup_live +++ b/src/tm_mad/qcow2/prebackup_live @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require_relative '../lib/tm_action' diff --git a/src/tm_mad/qcow2/restore b/src/tm_mad/qcow2/restore index 3a74b37fec..63cadd386f 100755 --- a/src/tm_mad/qcow2/restore +++ b/src/tm_mad/qcow2/restore @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'json' diff --git a/src/tm_mad/ssh/restore b/src/tm_mad/ssh/restore index f17fa4991b..16e8df033b 100755 --- a/src/tm_mad/ssh/restore +++ b/src/tm_mad/ssh/restore @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # + +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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 + require 'rexml/document' require 'json' diff --git a/src/vnm_mad/remotes/802.1Q/clean b/src/vnm_mad/remotes/802.1Q/clean index 165bc183c6..6d8faeeb74 100755 --- a/src/vnm_mad/remotes/802.1Q/clean +++ b/src/vnm_mad/remotes/802.1Q/clean @@ -15,9 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vlan_tag_driver' diff --git a/src/vnm_mad/remotes/802.1Q/post b/src/vnm_mad/remotes/802.1Q/post index ec5e2e62e5..f2753079c7 100755 --- a/src/vnm_mad/remotes/802.1Q/post +++ b/src/vnm_mad/remotes/802.1Q/post @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/802.1Q/pre b/src/vnm_mad/remotes/802.1Q/pre index 04c2154d06..80c085bfd1 100755 --- a/src/vnm_mad/remotes/802.1Q/pre +++ b/src/vnm_mad/remotes/802.1Q/pre @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vlan_tag_driver' diff --git a/src/vnm_mad/remotes/802.1Q/update_nic b/src/vnm_mad/remotes/802.1Q/update_nic index 491b4e33ab..d42ca34d2f 100755 --- a/src/vnm_mad/remotes/802.1Q/update_nic +++ b/src/vnm_mad/remotes/802.1Q/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/802.1Q/update_sg b/src/vnm_mad/remotes/802.1Q/update_sg index 5210763c9a..400bbf7881 100755 --- a/src/vnm_mad/remotes/802.1Q/update_sg +++ b/src/vnm_mad/remotes/802.1Q/update_sg @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vnmmad' require 'vlan_tag_driver' diff --git a/src/vnm_mad/remotes/bridge/clean b/src/vnm_mad/remotes/bridge/clean index 399f49a833..08c03574a2 100755 --- a/src/vnm_mad/remotes/bridge/clean +++ b/src/vnm_mad/remotes/bridge/clean @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vnmmad' diff --git a/src/vnm_mad/remotes/bridge/post b/src/vnm_mad/remotes/bridge/post index 7cd8b4dc56..61d0a7999e 100755 --- a/src/vnm_mad/remotes/bridge/post +++ b/src/vnm_mad/remotes/bridge/post @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/bridge/pre b/src/vnm_mad/remotes/bridge/pre index fc0e4539e7..ab6ed12efd 100755 --- a/src/vnm_mad/remotes/bridge/pre +++ b/src/vnm_mad/remotes/bridge/pre @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/bridge/update_nic b/src/vnm_mad/remotes/bridge/update_nic index 072d84f1fc..17da2df82f 100755 --- a/src/vnm_mad/remotes/bridge/update_nic +++ b/src/vnm_mad/remotes/bridge/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/elastic/remote_clean b/src/vnm_mad/remotes/elastic/remote_clean index 54057f915d..5ce664f785 100755 --- a/src/vnm_mad/remotes/elastic/remote_clean +++ b/src/vnm_mad/remotes/elastic/remote_clean @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/elastic/remote_post b/src/vnm_mad/remotes/elastic/remote_post index bb9d3eff67..da30691091 100755 --- a/src/vnm_mad/remotes/elastic/remote_post +++ b/src/vnm_mad/remotes/elastic/remote_post @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/elastic/update_sg b/src/vnm_mad/remotes/elastic/update_sg index cca5ca50b8..b4bad0c0ab 100755 --- a/src/vnm_mad/remotes/elastic/update_sg +++ b/src/vnm_mad/remotes/elastic/update_sg @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/fw/clean b/src/vnm_mad/remotes/fw/clean index dfcacd76b5..6867c028f7 100755 --- a/src/vnm_mad/remotes/fw/clean +++ b/src/vnm_mad/remotes/fw/clean @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/fw/post b/src/vnm_mad/remotes/fw/post index 05217e634b..5b8f73f6d4 100755 --- a/src/vnm_mad/remotes/fw/post +++ b/src/vnm_mad/remotes/fw/post @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/fw/pre b/src/vnm_mad/remotes/fw/pre index df42bc27a6..9c0156e559 100755 --- a/src/vnm_mad/remotes/fw/pre +++ b/src/vnm_mad/remotes/fw/pre @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/fw/update_nic b/src/vnm_mad/remotes/fw/update_nic index 50e5446290..dbf9b36188 100755 --- a/src/vnm_mad/remotes/fw/update_nic +++ b/src/vnm_mad/remotes/fw/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/fw/update_sg b/src/vnm_mad/remotes/fw/update_sg index 6a75e3e7b1..c445133905 100755 --- a/src/vnm_mad/remotes/fw/update_sg +++ b/src/vnm_mad/remotes/fw/update_sg @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/nodeport/pre b/src/vnm_mad/remotes/nodeport/pre index 5435a7a58c..efca1edfe9 100755 --- a/src/vnm_mad/remotes/nodeport/pre +++ b/src/vnm_mad/remotes/nodeport/pre @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/nodeport/update_sg b/src/vnm_mad/remotes/nodeport/update_sg index 34d2090b03..b27f4d7c36 100755 --- a/src/vnm_mad/remotes/nodeport/update_sg +++ b/src/vnm_mad/remotes/nodeport/update_sg @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/ovswitch/clean b/src/vnm_mad/remotes/ovswitch/clean index e3135a1220..6faa843418 100755 --- a/src/vnm_mad/remotes/ovswitch/clean +++ b/src/vnm_mad/remotes/ovswitch/clean @@ -15,9 +15,41 @@ # See the License for the specific language governing permissions and # # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitch' diff --git a/src/vnm_mad/remotes/ovswitch/post b/src/vnm_mad/remotes/ovswitch/post index 8ef7bce2cf..42191b2c69 100755 --- a/src/vnm_mad/remotes/ovswitch/post +++ b/src/vnm_mad/remotes/ovswitch/post @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitch' diff --git a/src/vnm_mad/remotes/ovswitch/pre b/src/vnm_mad/remotes/ovswitch/pre index 4ce1eb5b26..071e7ba6a9 100755 --- a/src/vnm_mad/remotes/ovswitch/pre +++ b/src/vnm_mad/remotes/ovswitch/pre @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitch' diff --git a/src/vnm_mad/remotes/ovswitch/update_nic b/src/vnm_mad/remotes/ovswitch/update_nic index 4b0774eecc..325f3e33bc 100755 --- a/src/vnm_mad/remotes/ovswitch/update_nic +++ b/src/vnm_mad/remotes/ovswitch/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/ovswitch/update_sg b/src/vnm_mad/remotes/ovswitch/update_sg index e0f125be12..598ec129b2 100755 --- a/src/vnm_mad/remotes/ovswitch/update_sg +++ b/src/vnm_mad/remotes/ovswitch/update_sg @@ -18,4 +18,4 @@ source $(dirname $0)/../../scripts_common.sh log_error "Security groups not supported for ovswitch" -exit 1 \ No newline at end of file +exit 1 diff --git a/src/vnm_mad/remotes/ovswitch_vxlan/clean b/src/vnm_mad/remotes/ovswitch_vxlan/clean index bfa2d52cd4..645724b868 100755 --- a/src/vnm_mad/remotes/ovswitch_vxlan/clean +++ b/src/vnm_mad/remotes/ovswitch_vxlan/clean @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitchVXLAN' diff --git a/src/vnm_mad/remotes/ovswitch_vxlan/post b/src/vnm_mad/remotes/ovswitch_vxlan/post index 78873e4f24..1da5cbecbd 100755 --- a/src/vnm_mad/remotes/ovswitch_vxlan/post +++ b/src/vnm_mad/remotes/ovswitch_vxlan/post @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitchVXLAN' diff --git a/src/vnm_mad/remotes/ovswitch_vxlan/pre b/src/vnm_mad/remotes/ovswitch_vxlan/pre index 78873e4f24..1da5cbecbd 100755 --- a/src/vnm_mad/remotes/ovswitch_vxlan/pre +++ b/src/vnm_mad/remotes/ovswitch_vxlan/pre @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'OpenvSwitchVXLAN' diff --git a/src/vnm_mad/remotes/ovswitch_vxlan/update_nic b/src/vnm_mad/remotes/ovswitch_vxlan/update_nic index ec85c230f7..8fe5bfaa14 100755 --- a/src/vnm_mad/remotes/ovswitch_vxlan/update_nic +++ b/src/vnm_mad/remotes/ovswitch_vxlan/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/ovswitch_vxlan/update_sg b/src/vnm_mad/remotes/ovswitch_vxlan/update_sg index e0f125be12..598ec129b2 100755 --- a/src/vnm_mad/remotes/ovswitch_vxlan/update_sg +++ b/src/vnm_mad/remotes/ovswitch_vxlan/update_sg @@ -18,4 +18,4 @@ source $(dirname $0)/../../scripts_common.sh log_error "Security groups not supported for ovswitch" -exit 1 \ No newline at end of file +exit 1 diff --git a/src/vnm_mad/remotes/vxlan/clean b/src/vnm_mad/remotes/vxlan/clean index e3e86133f2..bbd09f0aad 100755 --- a/src/vnm_mad/remotes/vxlan/clean +++ b/src/vnm_mad/remotes/vxlan/clean @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vxlan_driver' diff --git a/src/vnm_mad/remotes/vxlan/post b/src/vnm_mad/remotes/vxlan/post index c5c7fd6b18..9c70f60465 100755 --- a/src/vnm_mad/remotes/vxlan/post +++ b/src/vnm_mad/remotes/vxlan/post @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vxlan_driver' diff --git a/src/vnm_mad/remotes/vxlan/pre b/src/vnm_mad/remotes/vxlan/pre index ea51919c1e..d18b5cdad5 100755 --- a/src/vnm_mad/remotes/vxlan/pre +++ b/src/vnm_mad/remotes/vxlan/pre @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vxlan_driver' diff --git a/src/vnm_mad/remotes/vxlan/update_nic b/src/vnm_mad/remotes/vxlan/update_nic index 2e4fade48c..95861a2eed 100755 --- a/src/vnm_mad/remotes/vxlan/update_nic +++ b/src/vnm_mad/remotes/vxlan/update_nic @@ -16,6 +16,39 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) $LOAD_PATH << File.join(File.dirname(__FILE__), '..') diff --git a/src/vnm_mad/remotes/vxlan/update_sg b/src/vnm_mad/remotes/vxlan/update_sg index bd0f8b980a..656281f385 100755 --- a/src/vnm_mad/remotes/vxlan/update_sg +++ b/src/vnm_mad/remotes/vxlan/update_sg @@ -16,8 +16,41 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") +ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) + +if !ONE_LOCATION + LIB_LOCATION ||= '/usr/lib/one' + RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby' + GEMS_LOCATION ||= '/usr/share/one/gems' +else + LIB_LOCATION ||= ONE_LOCATION + '/lib' + RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby' + 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/ } + + # 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__) +$LOAD_PATH << File.join(File.dirname(__FILE__), '..') require 'vnmmad' require 'vxlan_driver'