Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLT Sync Command Loses Multisite Context #4439

Closed
mikemadison13 opened this issue Dec 14, 2021 · 1 comment · Fixed by #4440
Closed

BLT Sync Command Loses Multisite Context #4439

mikemadison13 opened this issue Dec 14, 2021 · 1 comment · Fixed by #4440
Labels
Bug Something isn't working

Comments

@mikemadison13
Copy link
Contributor

mikemadison13 commented Dec 14, 2021

Describe the bug
I have a multisite codebase setup. When I run blt sync --site=foo the sync command is running on the default site. However, when I run blt sync:db --site=foo then my db sync appropriately runs on the foo site.

It would appear to me in a bit of debugging that the site context is getting cleared (somehow) in the command stack. I see it with some debugging initially, but by the time we get to the sync:db command it's gone.

To Reproduce
Steps to reproduce the behavior, ideally starting from a fresh install of BLT:

  1. Clone my https://github.com/mikemadison13/multisite repo
  2. composer install
  3. lando start
  4. lando blt sync --site=first

Note that in the sql-sync command the site that is being synced is the default and not the first.

Run it again with: lando blt sync:db --site=first and note that the sql-sync is now the correct site.

Expected behavior
I would expect the full blt sync command to respect a multisite context and not just the sync:db portion.

Detailed error output

lando blt sync --site=fist
We strive to give you the best tools for development.
You can really help us improve by sharing anonymous performance and usage data.

 Do you want to help us make this tool even better? (y/n) n
Ok, no data will be tracked and reported.
We take privacy seriously.
> source:build:composer
Gathering patches for root package.
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Generating autoload files
89 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Scaffolding files for acquia/drupal-recommended-project:
  - Skip [web-root]/sites/default/default.services.yml because it already exists and overwrite is false.
  - Skip [web-root]/sites/default/default.settings.php because it already exists and overwrite is false.
> blt:init:settings
Hash salt already exists.
> drupal:sync:db
 [Acquia\Blt\Robo\Tasks\DrushTask] Running /app/vendor/bin/drush cache-clear drush --no-interaction --ansi &&
 /app/vendor/bin/drush sql-sync @default.dev @self --target-dump=/tmp/tmp.target.sql.gz --structure-tables-key=lightweight --create-db --no-interaction --ansi &&
 /app/vendor/bin/drush cr --no-interaction --ansi &&
 /app/vendor/bin/drush sql-sanitize --no-interaction --ansi in /app/docroot

vs. the blt sync:db output

lando blt sync:db --site=first
 [Acquia\Blt\Robo\Tasks\DrushTask] Running /app/vendor/bin/drush cache-clear drush --uri=first --no-interaction --ansi &&
 /app/vendor/bin/drush sql-sync @first.dev @first.local --target-dump=/tmp/tmp.target.sql.gz --structure-tables-key=lightweight --create-db --uri=first --no-interaction --ansi &&
 /app/vendor/bin/drush cr --uri=first --no-interaction --ansi &&
 /app/vendor/bin/drush sql-sanitize --uri=first --no-interaction --ansi in /app/docroot

BLT Doctor:

lando blt doctor
+------------------+--------------------------------------------+
| Property         | Value                                      |
+------------------+--------------------------------------------+
| blt-version      | 13.2.1.0                                   |
| composer-version | Composer version 2.0.7 2020-11-13 17:31:06 |
| root             | /app/docroot                               |
| uri              | default                                    |
+------------------+--------------------------------------------+
@mikemadison13 mikemadison13 added the Bug Something isn't working label Dec 14, 2021
@mikemadison13
Copy link
Contributor Author

After discussion with @danepowell this appears to be related to #4324. My local testing is that by adding a similar context for --site into BLT Task it begins working again. I'm going to open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant