Projet

Général

Profil

Development #29240

Avoir un écran pour gérer le paramétrage de debug

Ajouté par Benjamin Dauvergne il y a plus de 5 ans. Mis à jour il y a plus de 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
-
Début:
20 décembre 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Idée sur #29239:

Quand à DEBUG=True, je serai assez pour avoir un setting DEBUG_IP="<ip1> <ip2>", idem géré par hobo (je clique sur activate debug et ça ajoute mon ip cliente dans le truc), et avoir un middleware qui quand il voit l'IP pose DEBUG=True pour la durée de la requête.

Via #28930 ce serait gérable via un écran dans hobo :

[ Activer l'affichage des traces pour mon IP ]
IPs voyant les traces actuellement : 123.34.45.56 (La Ciotat, France), ...

Il faudrait peut-être expirer cette donnée régulièrement (genre ne pas laisser les traces activées plus de 8h).


Fichiers

0002-urls-coding-style-29240.patch (3,09 ko) 0002-urls-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0001-environment-coding-style-29240.patch (21,2 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0003-franceconnect-remove-dead-import-29240.patch (843 octets) 0003-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0005-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0005-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 08 mars 2019 03:15
0008-add-debug-application-29240.patch (9,85 ko) 0008-add-debug-application-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0006-tests-coding-style-29240.patch (3,56 ko) 0006-tests-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0004-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0004-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 08 mars 2019 03:15
0007-environment-add-a-setter-for-Variable.json-29240.patch (1,16 ko) 0007-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 08 mars 2019 03:15
0002-urls-coding-style-29240.patch (3,09 ko) 0002-urls-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0001-environment-coding-style-29240.patch (21,2 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0003-franceconnect-remove-dead-import-29240.patch (843 octets) 0003-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0005-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0005-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 08 mars 2019 16:05
0008-add-debug-application-29240.patch (9,85 ko) 0008-add-debug-application-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0009-reset-MUST_NOTIFY-on-request-start-29240.patch (1,23 ko) 0009-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0006-tests-coding-style-29240.patch (3,56 ko) 0006-tests-coding-style-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
0004-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0004-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 08 mars 2019 16:05
0007-environment-add-a-setter-for-Variable.json-29240.patch (1,16 ko) 0007-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 08 mars 2019 16:05
Firefox_Screenshot_2019-03-13T16-19-52.276Z.png (13,7 ko) Firefox_Screenshot_2019-03-13T16-19-52.276Z.png Benjamin Dauvergne, 13 mars 2019 17:20
Firefox_Screenshot_2019-03-13T16-19-26.216Z.png (14,4 ko) Firefox_Screenshot_2019-03-13T16-19-26.216Z.png Benjamin Dauvergne, 13 mars 2019 17:20
0002-urls-coding-style-29240.patch (3,09 ko) 0002-urls-coding-style-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0001-environment-coding-style-29240.patch (21,2 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0003-franceconnect-remove-dead-import-29240.patch (843 octets) 0003-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0005-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0005-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 13 mars 2019 18:38
0008-add-debug-application-29240.patch (10,8 ko) 0008-add-debug-application-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0009-reset-MUST_NOTIFY-on-request-start-29240.patch (1,23 ko) 0009-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0006-tests-coding-style-29240.patch (3,56 ko) 0006-tests-coding-style-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0004-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0004-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 13 mars 2019 18:38
0007-environment-add-a-setter-for-Variable.json-29240.patch (1,16 ko) 0007-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 13 mars 2019 18:38
0002-urls-coding-style-29240.patch (3,09 ko) 0002-urls-coding-style-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0001-environment-coding-style-29240.patch (21,3 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0003-franceconnect-remove-dead-import-29240.patch (843 octets) 0003-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0005-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0005-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 18 mars 2019 16:07
0008-add-debug-application-29240.patch (10,8 ko) 0008-add-debug-application-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0009-reset-MUST_NOTIFY-on-request-start-29240.patch (1,23 ko) 0009-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0006-tests-coding-style-29240.patch (3,56 ko) 0006-tests-coding-style-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0004-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0004-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 18 mars 2019 16:07
0007-environment-add-a-setter-for-Variable.json-29240.patch (1,01 ko) 0007-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 18 mars 2019 16:07
0002-urls-coding-style-29240.patch (3,26 ko) 0002-urls-coding-style-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0001-environment-coding-style-29240.patch (21,3 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0003-franceconnect-remove-dead-import-29240.patch (843 octets) 0003-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0005-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0005-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 24 mai 2019 11:05
0008-add-debug-application-29240.patch (10,8 ko) 0008-add-debug-application-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0009-reset-MUST_NOTIFY-on-request-start-29240.patch (1,23 ko) 0009-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0006-tests-coding-style-29240.patch (3,56 ko) 0006-tests-coding-style-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0004-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0004-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 24 mai 2019 11:05
0007-environment-add-a-setter-for-Variable.json-29240.patch (1,01 ko) 0007-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 24 mai 2019 11:05
0007-tests-coding-style-29240.patch (3,57 ko) 0007-tests-coding-style-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0004-franceconnect-remove-dead-import-29240.patch (845 octets) 0004-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0003-urls-coding-style-29240.patch (3,26 ko) 0003-urls-coding-style-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0002-test_schemas-adapt-to-newly-exposed-field-of-Authent.patch (903 octets) 0002-test_schemas-adapt-to-newly-exposed-field-of-Authent.patch Benjamin Dauvergne, 07 juin 2019 22:20
0009-add-debug-application-29240.patch (10,8 ko) 0009-add-debug-application-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0001-environment-coding-style-29240.patch (21,3 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0005-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0005-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 07 juin 2019 22:20
0008-environment-add-a-setter-for-Variable.json-29240.patch (1,01 ko) 0008-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0010-reset-MUST_NOTIFY-on-request-start-29240.patch (1,58 ko) 0010-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 07 juin 2019 22:20
0006-environment-factorize-get_setting_variable-from-fran.patch (2,52 ko) 0006-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 07 juin 2019 22:20
0007-tests-coding-style-29240.patch (3,82 ko) 0007-tests-coding-style-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0004-franceconnect-remove-dead-import-29240.patch (845 octets) 0004-franceconnect-remove-dead-import-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0003-urls-coding-style-29240.patch (3,26 ko) 0003-urls-coding-style-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0002-test_schemas-adapt-to-newly-exposed-field-of-Authent.patch (903 octets) 0002-test_schemas-adapt-to-newly-exposed-field-of-Authent.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0009-add-debug-application-29240.patch (11,6 ko) 0009-add-debug-application-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0001-environment-coding-style-29240.patch (21,3 ko) 0001-environment-coding-style-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0005-environment-rename-get_setting_variable-to-get_varia.patch (2,19 ko) 0005-environment-rename-get_setting_variable-to-get_varia.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0008-environment-add-a-setter-for-Variable.json-29240.patch (1,01 ko) 0008-environment-add-a-setter-for-Variable.json-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0010-reset-MUST_NOTIFY-on-request-start-29240.patch (1,58 ko) 0010-reset-MUST_NOTIFY-on-request-start-29240.patch Benjamin Dauvergne, 19 septembre 2019 15:25
0006-environment-factorize-get_setting_variable-from-fran.patch (2,81 ko) 0006-environment-factorize-get_setting_variable-from-fran.patch Benjamin Dauvergne, 19 septembre 2019 15:25

Demandes liées

Lié à Hobo - Development #29149: Revoir le fonctionnement des logs de debugFermé17 décembre 2018

Actions

Révisions associées

Révision 9bf09438 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

environment: coding style (#29240)

Révision d6661ec3 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

test_schemas: adapt to newly exposed field of Authentic (#29240)

Révision 31dfd4e8 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

urls: coding style (#29240)

Révision 96d6eb29 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

franceconnect: remove dead import (#29240)

Révision 12ea4598 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

environment: rename get_setting_variable to get_variable (#29240)

Révision 9635e4c8 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

environment: factorize get_setting_variable from franceconnect (#29240)

Révision 8ced89e0 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

tests: coding style (#29240)

Révision 09588c0d (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

environment: add a setter for Variable.json (#29240)

Révision b36e054c (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

add debug application (#29240)

Révision 661a5261 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 4 ans

reset MUST_NOTIFY on request start (#29240)

It breaks test tests_hobo/test_manager.py:test_unlogged_access which do
not expect any DB access but the flag seems to still be True from a
previous test.

Historique

#1

Mis à jour par Benjamin Dauvergne il y a environ 5 ans

  • Sujet changé de pour avoir activer les écrans de trace pour son IP depuis hobo à Avoir un écran pour gérer le paramétrage de debug
#2

Mis à jour par Benjamin Dauvergne il y a environ 5 ans

  • Assigné à mis à Benjamin Dauvergne
#5

Mis à jour par Frédéric Péters il y a environ 5 ans

Du bout "je clique sur activate debug et ça ajoute mon ip cliente dans le truc" de la description, je me dis que ça peut être bien d'avoir ainsi l'ajout de son IP, sans avoir à la chercher. (peut-être que ça peut juste être un truc d'affichage, sur la page "votre adresse IP est : ").

#9

Mis à jour par Benjamin Dauvergne il y a environ 5 ans

#11

Mis à jour par Benjamin Dauvergne il y a presque 5 ans

Souci nouveau à cause des tests sur cook, une des mes modifs non essentielles :

# 0001-environment-coding-style-29240.patch
    def as_dict(self):
         as_dict = dict([(x, y) for (x, y) in self.__dict__.items()
-                        if type(y) in (int, str, unicode)])-
+                        if isinstance(y, six.integer_types + six.string_types)])
         as_dict['base_url'] = self.get_base_url_path()
         as_dict['service-id'] = self.Extra.service_id
         as_dict['service-label'] = force_text(self.Extra.service_label)

fait que des attributs non exposés dans le hobo.json des services le sont maintenant :

>       assert dump == expected_dump
E       assert '{\n    "prof...89"\n    }\n}' == '{\n    "profi...89"\n    }\n}'
E         Skipping 5532 identical leading characters in diff, use -v to show
E         -          "use_as_idp_for_self": true,
E         -             "variables": {}
E         ? ---
E         +          "variables": {}
E                   },
E                   {...
E         
E         ...Full output truncated (66 lines hidden), use '-vv' to show

Ici "use_as_idp_for_self" qui est booléen et désormais pris en compte par six.integer_types (les booléens sont des entiers en python pour des raisons historiques), je défais ça ?

#13

Mis à jour par Nicolas Roche il y a presque 5 ans

Juste pour commenter le point ci-dessus avec les tests sur cook :
le test ne fait rien de plus que d'avertir quand l'environnement (hobo.json) évolue.

S'il évolue et que c'est souhaité, alors le patch 2 fait l'affaire :
- soit modifier le json attendu à la main
- soit le régénérer comme indiqué dans tests_schema/test_cook.py::test_cook_example

Je répond à côté car je n'ai pas d'avis sur le fait d'avoir une nouvelle entrée "use_as_idp_for_self".

#14

Mis à jour par Benjamin Dauvergne il y a presque 5 ans

Nicolas Roche a écrit :

Je répond à côté car je n'ai pas d'avis sur le fait d'avoir une nouvelle entrée "use_as_idp_for_self".

Je pense que c'est juste la bonne chose à faire, hobo.json doit exposer tout ce qui est stocké dans les objets de service.

#15

Mis à jour par Nicolas Roche il y a presque 5 ans

Voici 2 tests pour améliorer la couverture.
Le second montre un petit problème dans l'IHM avec les IP non valables.

/tests/test_manager.py::test_debug_home() :

    # toggle-current-ip button
    page = logged_app.get('/debug/')
    page.form['debug_ips'] = IPS
    page = page.form.submit(name='toggle-current-ip').follow()  # click
    assert get_setting_variable('INTERNAL_IPS').json == IP_LIST + ['127.0.0.1']
    page = page.form.submit(name='toggle-current-ip').follow()  # click again
    assert get_setting_variable('INTERNAL_IPS').json == IP_LIST

    # wrong ips are not returned as a list
    page = logged_app.get('/debug/')
    page.form['debug_ips'] = 'not_an_IP'
    page = page.form.submit()
    assert 'Enter a valid IPv4 or IPv6 address' in page.content
    assert page.form['debug_ips']._value == 'not_an_IP'  # get 'n o t _ a n _ I P'

#17

Mis à jour par Nicolas Roche il y a plus de 4 ans

  • Statut changé de Solution proposée à Solution validée

Pour moi l'IHM fait le job, pas de problème.

#18

Mis à jour par Benjamin Dauvergne il y a plus de 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 661a526109af425330f26224f9075e4df797b92d
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 15:52:59 2019 +0100

    reset MUST_NOTIFY on request start (#29240)

    It breaks test tests_hobo/test_manager.py:test_unlogged_access which do
    not expect any DB access but the flag seems to still be True from a
    previous test.

commit b36e054cb0269d64e672c61c797197234722a0a0
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:41:26 2019 +0100

    add debug application (#29240)

commit 09588c0de696fea068b0f9c21081948382c6b319
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:58:04 2019 +0100

    environment: add a setter for Variable.json (#29240)

commit 8ced89e097824b2b37959e145d64ecf466dadf2d
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:51:39 2019 +0100

    tests: coding style (#29240)

commit 9635e4c8f514737103a51591ef921a8e81db61ee
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:16:13 2019 +0100

    environment: factorize get_setting_variable from franceconnect (#29240)

commit 12ea45988896b56971d36a5f89244056d08f6a0a
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:08:44 2019 +0100

    environment: rename get_setting_variable to get_variable (#29240)

commit 96d6eb291a536cc6678d563ae8b372b122cd5b0a
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 01:53:15 2019 +0100

    franceconnect: remove dead import (#29240)

commit 31dfd4e85303ba2169a0b7c5c8c77001ed3e117e
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 02:39:44 2019 +0100

    urls: coding style (#29240)

commit d6661ec386cc222a9b28ce78934f107e3da270ca
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Jun 7 22:20:02 2019 +0200

    test_schemas: adapt to newly exposed field of Authentic (#29240)

commit 9bf094388ac18baa61f96a1da56985265efa0ffb
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Mar 8 01:58:41 2019 +0100

    environment: coding style (#29240)
#19

Mis à jour par Frédéric Péters il y a plus de 4 ans

Pour moi l'IHM fait le job, pas de problème.

Par contre, le taf attendu, logguer, sur l'environnement de dev je ne vois rien, et c'est normal ce ticket n'avait aucun sens à être poussé avant #29240.

#20

Mis à jour par Benjamin Dauvergne il y a plus de 4 ans

Frédéric Péters a écrit :

Pour moi l'IHM fait le job, pas de problème.

Par contre, le taf attendu, logguer, sur l'environnement de dev je ne vois rien, et c'est normal ce ticket n'avait aucun sens à être poussé avant #29240.

#29149, on peut déjà vérifier que les settings sont bien là.

#21

Mis à jour par Frédéric Péters il y a plus de 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF