Project

General

Profile

Tâche #30131

Scénario #29921: Sphynx 2.8.0 : Porter ARV en python 3

Porter ARV vers Sqlalchemy

Added by Emmanuel GARETTE over 1 year ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
05/04/2020
Due date:
% Done:

100%

Remaining (hours):
0.0

Description

L'API doit être le plus proche possible de l'API actuelle pour éviter d'avoir (trop) de changement dans les scripts tiers.


Related issues

Related to Distribution EOLE - Tâche #30382: Passer ce script en python3 : /mnt/eole-ci-tests/scripts/arv_apply_conf_ipsec.py Fermé 10/14/2019

Associated revisions

Revision da827c01 (diff)
Added by Emmanuel GARETTE over 1 year ago

pouvoir instancier un Sphynx (ref #30131)

Revision 09e4cef9 (diff)
Added by Emmanuel GARETTE over 1 year ago

problème de conversion du bytes en str (ref #30131)

Revision 00fadcb3 (diff)
Added by Emmanuel GARETTE over 1 year ago

convertion de cert.py en python3 (ref #30131)

Revision 82108e64 (diff)
Added by Emmanuel GARETTE over 1 year ago

portage de active_rvp en python3 (ref #30131)

Revision 8def4e92 (diff)
Added by Emmanuel GARETTE over 1 year ago

convertion de cert.py en python3 (ref #30131)

Revision 1c54aace (diff)
Added by Emmanuel GARETTE over 1 year ago

portage de ARV en python3 (ref #30131)

Revision 85be1909 (diff)
Added by Emmanuel GARETTE over 1 year ago

ne pas convertir, le retour n'est pas forcement une string (ref #30131)

Revision cc8fd637 (diff)
Added by Emmanuel GARETTE over 1 year ago

setup.py en python3 (ref #30131)

Revision faf13667 (diff)
Added by Emmanuel GARETTE over 1 year ago

dependance python3 (ref #30131)

Revision 0a847343 (diff)
Added by Emmanuel GARETTE over 1 year ago

dependance python3 (ref #30131)

Revision 9d132e11 (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi maintenant un bytes (ref #30131)

Revision 45c9cf0b (diff)
Added by Emmanuel GARETTE over 1 year ago

les commandes renvoi des bytes (ref #30131)

Revision 10f330a2 (diff)
Added by Joël Cuissinat over 1 year ago

Conversion du retour de commande pour bareos

ref #30131

Revision c4fd7269 (diff)
Added by Emmanuel GARETTE over 1 year ago

faire fonctionner la fonction apply (ref #30131)

Revision f74e3d84 (diff)
Added by Emmanuel GARETTE over 1 year ago

(pouvoir récupérer les informations du Zéphir (ref #30131)

Revision 40906e26 (diff)
Added by Emmanuel GARETTE over 1 year ago

la configuration peut etre de type binary (si vient de ARV) (ref #30131)

Revision ee9746b3 (diff)
Added by Emmanuel GARETTE over 1 year ago

portage de init_sphynx en python3 (ref #30131)

Revision 29de7f05 (diff)
Added by Emmanuel GARETTE over 1 year ago

la cle peut etre alternativement en string ou bytes => converti tout en bytes (ref #30131)

Revision c7de693d (diff)
Added by Emmanuel GARETTE over 1 year ago

Revert "system_out renvoi maintenant un bytes (ref #30131)"

This reverts commit 9d132e1132c8ad6be4a1d0dcf0b389346addbfa8.

Revision 0b0a4bd6 (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision 9687a27b (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision 30acef4c (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision 8fbd9736 (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision e90ec47a (diff)
Added by Emmanuel GARETTE over 1 year ago

pouvoir utiliser to_str dans system_out (ref #30131)

Revision bb03f406 (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision eafbc229 (diff)
Added by Emmanuel GARETTE over 1 year ago

system_out renvoi un string (ref #30131)

Revision 2ea52e86 (diff)
Added by Fabrice Barconnière over 1 year ago

system_out renvoi un string (ref #30131)

History

#1 Updated by Emmanuel GARETTE over 1 year ago

  • Status changed from Nouveau to En cours

#2 Updated by Emmanuel GARETTE over 1 year ago

  • Status changed from En cours to Résolu
  • % Done changed from 0 to 100

#3 Updated by Emmanuel GARETTE over 1 year ago

  • Status changed from Résolu to En cours

#4 Updated by Emmanuel GARETTE over 1 year ago

  • Status changed from En cours to Résolu

#5 Updated by Fabrice Barconnière over 1 year ago

  • Status changed from Résolu to En cours

#6 Updated by Fabrice Barconnière over 1 year ago

Sphynx 2.8.0 enregistré sur un Zéphir 2.8.0

  • Traceback à l'exécution d'init_sphynx :
    * Certificat /var/lib/arv/CA/certs/sphynx.pem généré
    Traceback (most recent call last):
      File "/usr/share/eole/sbin/init_sphynx", line 257, in <module>
        populate_database()
      File "/usr/share/eole/sbin/init_sphynx", line 187, in populate_database
        add_credential('sphynx', 'eole', node1, 'autosigned')
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 53, in newFunc
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/arv/db/edge.py", line 564, in add_credential
        subjkey, keyid_cred = get_keyid_in_certif(certfile, passwd=passwd, certiftype='notca')
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 53, in newFunc
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 181, in get_keyid_in_certif
        return get_keyid_from_keyid_in_certif(priv_certname, passwd, mode='rsa')
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 53, in newFunc
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 195, in get_keyid_from_keyid_in_certif
        code, pub_info_der, stderr = system_out(pub_info_cmd, stdin=passwd)
      File "/usr/lib/python3/dist-packages/pyeole/process.py", line 325, in system_out
        return creole_system_out(cmd, stdin, container, context, env, pty, to_str=to_str)
      File "/usr/lib/python3/dist-packages/pyeole/process.py", line 344, in creole_system_out
        return _service(cmd, stdin, container, context, env, pty, PIPE, PIPE, to_str=to_str)
      File "/usr/lib/python3/dist-packages/pyeole/process.py", line 263, in _service
        stdout_output = stdout_output.decode() if isinstance(stdout_output, bytes) else stdout_output
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte
    
  • L'ajout d'IP externe ne va plus interroger Zéphir :
    Dans class GetExtr de childpage.py
  • Erreur lors de l'ajout d'un certificat autosigné :
    -> entering get_all_credentials([], {})
    Error in GetAllCred with args {b'_dc': [b'1590482307276']}
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/arv/web/page.py", line 86, in render
        ret = self.render_page(request)
      File "/usr/lib/python3/dist-packages/arv/web/childpage.py", line 927, in render_page
        related_node_name = uai + " - " + name
    TypeError: can't concat str to bytes
    
  • Erreur Apply (peut-être lié aux erreurs précédentes) :
    Error in Apply with args {b'_dc': [b'1590484434596']}
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/arv/web/page.py", line 86, in render
        ret = self.render_page(request)
      File "/usr/lib/python3/dist-packages/arv/web/page.py", line 269, in render_page
        ipsec_conf_apply(zephir=zephir)
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 53, in newFunc
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/arv/lib/sw_config_apply.py", line 743, in ipsec_conf_apply
        ipsec_conf_build(zephir, current_node, arv_node=True)
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 53, in newFunc
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/arv/lib/sw_config_apply.py", line 494, in ipsec_conf_build
        name_peercfg = '%s-%s_' % (remove_special_characters(local_node.name), remove_special_characters(remote_node.name))
      File "/usr/lib/python3/dist-packages/arv/lib/util.py", line 661, in remove_special_characters
        text = text.replace( character, '' )
    TypeError: a bytes-like object is required, not 'str'
    

#7 Updated by Emmanuel GARETTE over 1 year ago

Visiblement je n'ai pas fait le commit hier soir.

Je viens de faire un nouveau paquet.

Par contre pour :

L'ajout d'IP externe ne va plus interroger Zéphir :
Dans class GetExtr de childpage.py

Tu peux préciser ?

Durant mes tests la semaine dernière quand on fait "IP externe"/"Ajouter" on voyait bien l'IP d'eth0.
C'est bien cette fonctionnalité ?

#8 Updated by Fabrice Barconnière over 1 year ago

  • J'avais fait des modifs pour avancer dans mes tests ce qui a produit des erreurs là où il n'y en avait pas. J'ai corrigé childpage.py et sw_config_apply.py, il n'y a finalement pas besoin de decode() sur name.
  • Les configurations se génèrent correctement.
    Sur Amon les tunnels se montent mais le script ipsec_updown ne semble pas s'exécuter (pas de route ni de règles iptables liées à ipsec).
  • Pour ce qui est de l'ip externe, c'est bien cette fonctionnalité "IP externe"/"Ajouter", le code semble ne pas passer dans le cas "new == 'true'" et n'interroge pas Zéphir.
    Pour tester, j'ai affecté la valeur 'true' à "new" juste avant le test et l'adresse IP s'affiche bien dans ARV

#9 Updated by Emmanuel GARETTE over 1 year ago

  • Status changed from En cours to Résolu

J'ai ouvert une nouvelle demande pour les IP externes.

Je pense que je peux résoudre celle là et corriger le dernier problème dans la nouvelle demande.

#10 Updated by Fabrice Barconnière over 1 year ago

  • Status changed from Résolu to Fermé
  • Remaining (hours) set to 0.0

#11 Updated by Joël Cuissinat about 1 year ago

  • Related to Tâche #30382: Passer ce script en python3 : /mnt/eole-ci-tests/scripts/arv_apply_conf_ipsec.py added

Also available in: Atom PDF