Development #56408
Collectstatic --link échoue s'il tombe sur un lien symbolique cassé
Début:
26 août 2021
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
vu dans #54705#note-37 et reproduit par hasard :
wcs-manage collectstatic --link <string>:199: UserWarning: journald will not be used directly, please install python-systemd Traceback (most recent call last): File "/home/cazino/src/eo/wcs/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/cazino/envs/publik-env-py3/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/home/cazino/envs/publik-env-py3/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/cazino/envs/publik-env-py3/lib/python3.9/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/home/cazino/envs/publik-env-py3/lib/python3.9/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/home/cazino/src/eo/wcs/wcs/qommon/management/commands/collectstatic.py", line 51, in handle return self.collectstatic(pub, clear=options['clear'], link=options['link']) File "/home/cazino/src/eo/wcs/wcs/qommon/management/commands/collectstatic.py", line 84, in collectstatic os.symlink(src_filename, dst_filename) FileExistsError: [Errno 17] File exists: '/home/cazino/envs/publik-env-py3/lib/python3.9/site-packages/xstatic/pkg/jquery/data/jquery.min.js' -> '/var/lib/wcs/collectstatic/xstatic/jquery.min.js'
Ça se produit lorsque le lien symbolique existe déjà mais est cassé.
Dans ce cas le os.path.exists(dst_filename)
renvoie faux (et c'est normal : https://docs.python.org/3/library/os.path.html#os.path.exists), du coup pas de nettoyage et la création du lien échoue.
if os.path.exists(dst_filename): os.unlink(dst_filename) if link: os.symlink(src_filename, dst_filename)
Fichiers
Révisions associées
Historique
Mis à jour par Emmanuel Cazenave il y a plus de 2 ans
- Fichier 0001-collectstatic-do-not-crash-on-broken-link-56408.patch 0001-collectstatic-do-not-crash-on-broken-link-56408.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Assigné à mis à Emmanuel Cazenave
- Patch proposed changé de Non à Oui
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit 0c3f1f55fee2a4a8765f85c1ff1d672ce1d34df3 Author: Emmanuel Cazenave <ecazenave@entrouvert.com> Date: Thu Aug 26 18:09:25 2021 +0200 collectstatic: do not crash on broken link (#56408)
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Résolu (à déployer) à Solution déployée
collectstatic: do not crash on broken link (#56408)