calmip / gramc3

GNU General Public License v3.0
0 stars 2 forks source link

Duplicate services.yaml.dist keys #3

Closed vignemail1 closed 3 years ago

vignemail1 commented 3 years ago

Description

La bibliothèque de parse YAML, déclenchée par des scripts du projet, ne supporte pas d'avoir des clés YAML dupliquées.

Problème

Lors de la phase d'installation, un jeu de 2 commandes doivent êtres lancés afin de générer un fichier .htaccess adéquat. Le problème est que ces commandes utilisent les fichiers YAML de configuration et que si des clés YAML sont dupliquées, la bibliothèque retourne en erreur.

Par exemple :

root@gramc:/var/www/html/gramc3# ./composer.phar remove symfony/apache-pack
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]?
symfony/apache-pack is not required in your composer.json and has not been removed
./composer.json has been updated
Running composer update symfony/apache-pack
Loading composer repositories with package information
Updating dependencies
Package "symfony/apache-pack" listed for update is not locked.
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
  - Removing symfony/apache-pack (v1.0.1)
Package twig/extensions is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
87 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Symfony operations: 1 recipe (72830c83b3ff33fbf202fda374aef8c2)
  - Unconfiguring symfony/apache-pack (>=1.0): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In FileLoader.php line 180:
!!
!!    The file "/var/www/gramc3/config/services.yaml" does not contain valid YAML
!!    : Duplicate key "password_consoupload" detected at line 146 (near "password
!!    _consoupload: '%env(PASSWORD_CONSOUPLOAD)%'") in /var/www/gramc3/config/ser
!!    vices.yaml (which is loaded in resource "/var/www/gramc3/config/services.ya
!!    ml").
!!
!!
!!  In YamlFileLoader.php line 693:
!!
!!    The file "/var/www/gramc3/config/services.yaml" does not contain valid YAML
!!    : Duplicate key "password_consoupload" detected at line 146 (near "password
!!    _consoupload: '%env(PASSWORD_CONSOUPLOAD)%'").
!!
!!
!!  In Parser.php line 345:
!!
!!    Duplicate key "password_consoupload" detected at line 146 (near "password_c
!!    onsoupload: '%env(PASSWORD_CONSOUPLOAD)%'").
!!
!!
!!
Script @auto-scripts was called via post-update-cmd

Proposition de solution

La solution qui semble la plus pertinente est donc de s'assurer qu'aucune clé YAML ne soit dupliquée dans le fichier exemple services.yaml.dist

Les clés dupliquées :

calmip commented 3 years ago

bug corrigé, merci