Project

General

Profile

Tâche #13307

Scénario #17436: Améliorer la gestion des erreurs dans Maj-Auto

erreur Maj-Auto - int() argument must be a string or a number, not 'NoneType'

Added by Emmanuel IHRY about 8 years ago. Updated almost 7 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
09/30/2015
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Remaining (hours):
0.0

Description

Le message suivant apparait lors du lancement de la commande Maj-Auto si l'on n'a pas renseigné le port du proxy lors de la commande
export http_proxy=w.x.y.z

erreur Maj-Auto - int() argument must be a string or a number, not 'NoneType'

Il faudrait peut être mettre un message plus explicité ?


Related issues

Related to Distribution EOLE - Tâche #17821: 02eole-apt-intra: erreur Maj-Auto - int() argument must be a string or a number, not 'NoneType' Fermé 10/17/2016

Associated revisions

Revision 7d0fd82e (diff)
Added by Benjamin Bohard almost 7 years ago

Convertir le paramètre port en amont et intercepter l’erreur avec un message explicite.

Ref #13307

Revision 720397b8 (diff)
Added by Joël Cuissinat almost 7 years ago

Ajout d'un message sur l'utilisation de http_proxy en mode debug

Ref: #13307 @20m

History

#1 Updated by Joël Cuissinat almost 7 years ago

  • Tracker changed from Anomalie to Demande

#2 Updated by Joël Cuissinat almost 7 years ago

Problème toujours d'actualité sur EOLE 2.6.0, cette demande pourrait être transformée en traitement express...

root@eolebase:~# Maj-Auto -d
Mise à jour le mercredi 05 octobre 2016 16:05:55
*** eolebase 2.6.0 (0000000A) ***

Maj-Auto - int() argument must be a string or a number, not 'NoneType'
Traceback (most recent call last):
  File "/usr/bin/Maj-Auto", line 306, in main
    envole_level=envole_level)
  File "/usr/lib/python2.7/dist-packages/pyeole/pkg.py", line 1592, in _configure_sources_mirror
    mirror_ubuntu = _test_mirror('Ubuntu', ubuntu)
  File "/usr/lib/python2.7/dist-packages/pyeole/pkg.py", line 1550, in _test_mirror
    pkgmgr._test_mirror(mirror_url, dist)
  File "/usr/lib/python2.7/dist-packages/pyeole/pkg.py", line 847, in _test_mirror
    if not test_tcp(proxy_url.hostname, proxy_url.port):
  File "/usr/lib/python2.7/dist-packages/pyeole/diagnose/network.py", line 127, in test_tcp
    soc.connect((ip_address, int(port)))
TypeError: int() argument must be a string or a number, not 'NoneType'

#3 Updated by Joël Cuissinat almost 7 years ago

  • Tracker changed from Demande to Tâche
  • Estimated time set to 2.00 h
  • Parent task set to #17436
  • Remaining (hours) set to 2.0

Un try bien placé permettra d'affiché un message adapté à ce cas précis :)

#4 Updated by Benjamin Bohard almost 7 years ago

  • Assigned To set to Benjamin Bohard

#5 Updated by Benjamin Bohard almost 7 years ago

  • Remaining (hours) changed from 2.0 to 1.83

La fonction test_tcp utilise déjà un try mais n’intercepte qu’un type d’erreur (pas le TypeError).

Cependant, on ne peut pas assurer qu’une erreur TypeError interceptée dans cette fonction soit bien en rapport avec le numéro de port (le try concerne plusieurs fonctions).
Il me semble plus clair de vérifier la validité da la variable http_proxy au moment de sa récupération dans la fonction _test_mirror dans pyeole/pkg.py.

#6 Updated by Benjamin Bohard almost 7 years ago

  • % Done changed from 0 to 50
  • Remaining (hours) changed from 1.83 to 1.23

Ajout d’un autre contexte try indépendant pour être sûr de l’origin de l’erreur et test, par la même occasion, que le port est un entier inférieur à 65535.

Revoir le test de validité du port (fonction existante à importer ?).

#7 Updated by Scrum Master almost 7 years ago

  • Status changed from Nouveau to En cours

#8 Updated by Benjamin Bohard almost 7 years ago

Affiner la détection de l’utilisation d’un proxy (Acquire::http::Proxy:: n’est pas un indicateur suffisant)

#9 Updated by Benjamin Bohard almost 7 years ago

  • % Done changed from 50 to 100
  • Remaining (hours) changed from 1.23 to 0.25

#10 Updated by Scrum Master almost 7 years ago

  • Status changed from En cours to Résolu

#11 Updated by Joël Cuissinat almost 7 years ago

root@eolebase:~# export http_proxy=http://1.1.1.1
root@eolebase:~# Query-Auto -D
Mise à jour le lundi 28 novembre 2016 16:38:58
*** eolebase 2.6.1 (0000000A) ***

Maj-Auto - (VERSION DE DEVELOPPEMENT) - Augmenter le niveau de mise à jour peut empêcher de revenir au niveau de mise à jour stable.
Voulez-vous continuer ? [oui/non]
[non] : o
Maj-Auto - Tested port for tcp connection to 1.1.1.1 is not valid: None

#12 Updated by Joël Cuissinat almost 7 years ago

  • Project changed from python-pyeole to creole
  • Status changed from Résolu to Fermé
  • Remaining (hours) changed from 0.25 to 0.0

Also available in: Atom PDF