Support container_yamls with relative paths

Created on 20 April 2023, over 1 year ago
Updated 26 April 2023, over 1 year ago

Problem/Motivation

In https://git.drupalcode.org/project/drd/-/blob/4.0.x/src/Plugin/Action/In... the container_yamls definitions are converted to relative paths.

We encounter problems on the initial domain authentication on sites, that have declared service files with a relative path.

Symfony\Component\Filesystem\Exception\InvalidArgumentException: The end path "sites/default/services.yml" is not absolute. in Symfony\Component\Filesystem\Filesystem->makePathRelative() (line 452 of /var/www/html/vendor/symfony/filesystem/Filesystem.php). 

Declaring relative paths for them seems to be supported by Drupal and the DRD module already added an exception for the redis module, which uses a relative path as well. I would suggest to use a proper generic check instead of an exception for redis, by checking if the path is an absolute path, before trying to convert it. Relative paths can be just kept as they are. https://symfony.com/doc/current/components/filesystem.html#isabsolutepath

The only consequence would be that those relative path services are silently not being added for the local copy setup https://git.drupalcode.org/project/drd/-/blob/4.0.x/templates/DomainLoca... . That's the only purpose for gathering the service yamls anyhow.

Steps to reproduce

Proposed resolution

Replace

          if (strpos($container_yaml, '/redis/') === FALSE) {
            $container_yamls[] = trim($fs->makePathRelative($container_yaml, $response['root']), '/');
          }

with

          if ($fs->isAbsolutePath($container_yaml) {
            $container_yamls[] = trim($fs->makePathRelative($container_yaml, $response['root']), '/');
          }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

4.1

Component

Code

Created by

🇩🇪Germany szeidler Berlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024