Projet

Général

Profil

Scénario #37279

[hapy 2.9.0+] warnings ruby au lancement de onevm-all : already initialized constant

Ajouté par Laurent Gourvenec il y a 2 mois. Mis à jour il y a environ un mois.

Statut:
Terminé (Sprint)
Priorité:
Normal
Assigné à:
Catégorie:
-
Début:
01/10/2022
Echéance:
01/01/2026
% réalisé:

100%

Points de scénarios:
1.0
Restant à faire (heures):
0.00 heure
Estimation basée sur la vélocité:
Release:
Liens avec la release:
Auto

Description

Beaucoup de warnings.

janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/3.0.0/rubygems.rb:11: warning: already initialized constant Gem::VERSION
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/vendor_ruby/rubygems.rb:11: warning: previous definition of VERSION was here
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/3.0.0/rubygems/compatibility.rb:15: warning: already initialized constant Gem::RubyGemsVersion
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/vendor_ruby/rubygems/compatibility.rb:15: warning: previous definition of RubyGemsVersion was here
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/3.0.0/rubygems/compatibility.rb:18: warning: already initialized constant Gem::RbConfigPriorities
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/vendor_ruby/rubygems/compatibility.rb:18: warning: previous definition of RbConfigPriorities was here
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/3.0.0/rubygems/defaults.rb:3: warning: already initialized constant Gem::DEFAULT_HOST
janv. 05 16:03:42 hapy onevm-all[4385]: /usr/lib/ruby/vendor_ruby/rubygems/defaults.rb:3: warning: previous definition of DEFAULT_HOST was here
...

Peut-être une solution : https://github.com/OpenNebula/one/commit/7872274c9b7ab40d3fd3a1fd5622387e7031dd2c


Sous-tâches

Tâche #37298: Rendre muet le chargement de l’environnement RubyFerméBenjamin Bohard

Tâche #37299: TesterFerméLudwig Seys

Historique

#1 Mis à jour par Daniel Dehennin il y a 2 mois

Effectivement, il y a une combinaison de plusieurs commits pour améliorer

Au final, le code pour charger ressemble à ça :

ONE_LOCATION = ENV['ONE_LOCATION']

if !ONE_LOCATION
    RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
    GEMS_LOCATION     = '/usr/share/one/gems'
else
    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

Dans les futurs versions (>= 7.0), c’est mutualisé :

- une librairie de chargement
- son usage

#2 Mis à jour par Joël Cuissinat il y a 2 mois

  • Tracker changé de Demande à Scénario
  • Début 12/01/2026 supprimé
  • Release mis à Carnet de produit Cadoles - MEN
  • Points de scénarios mis à 1.0

#3 Mis à jour par Benjamin Bohard il y a 2 mois

  • Echéance mis à 01/01/2026
  • Assigné à mis à Benjamin Bohard
  • Version cible mis à Carnet Cadoles - MEN
  • Début mis à 01/10/2022

#4 Mis à jour par Joël Cuissinat il y a environ un mois

  • Statut changé de Nouveau à Terminé (Sprint)
  • Version cible changé de Carnet Cadoles - MEN à Livraison Cadoles - MEN 31/10/2025 (40)
  • Release changé de Carnet de produit Cadoles - MEN à EOLE 2.9.0

Formats disponibles : Atom PDF