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

Unable to override sync:commands #3697

Closed
richardbporter opened this issue Jun 3, 2019 · 4 comments
Closed

Unable to override sync:commands #3697

richardbporter opened this issue Jun 3, 2019 · 4 comments
Labels
Bug Something isn't working

Comments

@richardbporter
Copy link
Contributor

Describe the bug
Unable to override sync:commands.

To Reproduce

  1. Run composer create-project acquia/blt-project --no-interaction
  2. Update blt.yml to override sync:commands:
sync:
  commands:
    - drush foo:bar
  1. Run blt config:dump.
  2. See:
| sync.commands.0                           | drush foo:bar                                                |
| sync.commands.1                           | blt:init:settings                                            |
| sync.commands.2                           | drupal:sync:db                                               |
| sync.commands.3                           | drupal:update                                                |
| sync.commands.4                           | source:build:frontend 

Expected behavior
I would expect to see drush foo:bar as the only step in sync:commands.

BLT doctor output

+---------------------------+--------------------------------------------------------------+
| Property                  | Value                                                        |
+---------------------------+--------------------------------------------------------------+
| %paths.%root              | /Users/foo/Desktop/my-project/docroot                   |
| %paths.%site              | sites/default                                                |
| %paths.%modules           | sites/all/modules                                            |
| %paths.%themes            | sites/all/themes                                             |
| %paths.%config-sync       | /Users/foo/Desktop/my-project/config/default            |
| alias-searchpaths.0       | /Users/foo/.drush/sites                                 |
| alias-searchpaths.1       | /Users/foo/Desktop/my-project/drush/sites               |
| blt-version               | 10.0.1                                                       |
| composer-version          | Composer version 1.8.5 2019-04-09 17:46:47                   |
| config-sync               | /Users/foo/Desktop/my-project/config/default            |
| db-driver                 | mysql                                                        |
| db-hostname               | localhost                                                    |
| db-name                   | drupal                                                       |
| db-password               | drupal                                                       |
| db-port                   | 3306                                                         |
| db-username               | drupal                                                       |
| drupal-settings-file      | sites/default/settings.php                                   |
| drupal-version            | 8.7.2                                                        |
| drush-cache-directory     | /Users/foo/.drush/cache                                 |
| drush-conf.0              | /Users/foo/.drush/drush.yml                             |
| drush-conf.1              | /Users/foo/Desktop/my-project/vendor/drush/drush/drush. |
|                           | yml                                                          |
| drush-conf.2              | /Users/foo/Desktop/my-project/drush/drush.yml           |
| drush-conf.3              | /Users/foo/Desktop/my-project/docroot/sites/default/loc |
|                           | al.drush.yml                                                 |
| drush-script              | /Users/foo/Desktop/my-project/vendor/drush/drush/drush  |
| drush-temp                | /tmp                                                         |
| drush-version             | 9.6.2                                                        |
| modules                   | sites/all/modules                                            |
| php-bin                   | /usr/local/Cellar/[email protected]/7.2.18/bin/php                     |
| php-conf.0                | /usr/local/etc/php/7.2/php.ini                               |
| php-os                    | Darwin                                                       |
| root                      | /Users/foo/Desktop/my-project/docroot                   |
| site                      | sites/default                                                |
| stacks.drupal-vm.inited   | false                                                        |
| stacks.dev-desktop.inited | false                                                        |
| themes                    | sites/all/themes                                             |
| uri                       | http://local.blted10.com                                     |
+---------------------------+--------------------------------------------------------------+
+------------------------------------------+--------------------------------------------------------------+
| Check                                    | Problem                                                      |
+------------------------------------------+--------------------------------------------------------------+
| BehatCheck:checkLocalConfig:exists       | tests/behat/local.yml is missing!                            |
|                                          |   Run `blt tests:behat:init:config` to generate it from      |
|                                          | example.local.yml.                                           |
| ConfigCheck:checkGitConfig               | Git repositories are not defined in blt.yml.                 |
|                                          |   Add values for git.remotes to blt.yml to enabled automated |
|                                          | deployment.                                                  |
| DbCheck:checkDbConnection                | Could not connect to MySQL database.                         |
|                                          |                                                              |
|                                          | Is your *AMP stack running?                                  |
|                                          | Are your database credentials correct?                       |
|                                          |   db-driver: mysql                                           |
|                                          |   db-hostname: localhost                                     |
|                                          |   db-username: drupal                                        |
|                                          |   db-password: drupal                                        |
|                                          |   db-name: drupal                                            |
|                                          |   db-port: 3306                                              |
|                                          |                                                              |
|                                          | To verify your mysql credentials, run `mysql -u drupal -h    |
|                                          | localhost -pdrupal -P 3306`                                  |
|                                          |                                                              |
|                                          | Are you using the correct PHP binary?                        |
|                                          | Is PHP using the correct MySQL socket?                       |
|                                          |   php-os: Darwin                                             |
|                                          |   php-bin: /usr/local/Cellar/[email protected]/7.2.18/bin/php          |
|                                          |   php-conf: /usr/local/etc/php/7.2/php.ini                   |
|                                          |                                                              |
|                                          | Are you using the correct site and settings.php file?        |
|                                          |   site: sites/default                                        |
|                                          |   drupal-settings-file: sites/default/settings.php           |
|                                          |                                                              |
|                                          | To verify, run `drush sqlc`                                  |
|                                          |                                                              |
| DrupalCheck:checkDrupalBootstrapped      | Could not bootstrap Drupal via drush without alias.          |
| DrupalCheck:checkDrupalInstalled         | Drupal is not installed.                                     |
|                                          |                                                              |
|                                          | Run `blt drupal:install` to install Drupal locally.          |
| FileSystemCheck:checkFileSystem:%files   | Public files directory is not set.                           |
| FileSystemCheck:checkFileSystem:%private | Private files directory is not set.                          |
| FileSystemCheck:checkFileSystem:%temp    | Temporary files directory is not set.                        |
| NodeCheck:checkNodeVersionFileExists     | Neither .nvmrc nor .node-version file found in repo root.    |
| WebUriCheck:checkUriResponse             | Did not get a response from http://local.blted10.com         |
|                                          | Is your *AMP stack running?                                  |
|                                          | Is your /etc/hosts file correctly configured?                |
|                                          | Is your web server configured to serve this URI from         |
|                                          | /Users/foo/Desktop/my-project/docroot?                  |
|                                          | Is options.uri set correctly in                              |
|                                          | /Users/foo/Desktop/my-project/docroot/sites/default/loc |
|                                          | al.drush.yml?                                                |
+------------------------------------------+--------------------------------------------------------------+

System information

  • Operating system type: MacOS Sierra
  • Operating system version: 10.12.6
  • BLT version: 10.0.1
@danepowell
Copy link
Contributor

danepowell commented Jun 4, 2019

It seem that when you override any element of a config array, it only overrides that particular element. It doesn't reset the whole array. I agree that's somewhat intuitive. But it might be a bug with consolidation/config, not BLT: consolidation/config#31

As a workaround, you might be able to set the remaining elements of sync:commands to a null or no-op:

sync:
  commands:
    - drush foo:bar
    - null
    - null
    - null
    - null

Or try ":" or echo or something instead of null if that doesn't work.

@danepowell danepowell added this to the Backlog milestone Jun 4, 2019
@richardbporter
Copy link
Contributor Author

Thanks for the explanation. Unfortunately, my example was a poor one because these need to be BLT commands, not Drush or anything else. My mistake.

So, null or : won't work here. I had a custom BLT command class implemented for this app already so I just added a no-op BLT command. That allowed me to successfully "skip" some sync steps, although this is a bit awkward and potentially problematic if BLT adds/removes default sync steps in the future.

In any case, it does seem like something that should be addressed in consolidation/config#31. I'm not sure what else BLT can do here.

@danepowell
Copy link
Contributor

Ah of course, I forgot that those have to be BLT commands. At any rate, thanks for following up.

@lems3
Copy link

lems3 commented May 8, 2020

I just had a similar issue with the multisites key, we want to override it per environment, but we don,t want to leave the multisites key empty in the main config file. Some sites in our setup are not ready to launch and we don't want to risk anyone launching a BLT command without the environment argument set to affect those sites...

The null key would work for us since our default site is not set up, but that's more a patch to an issue than a real fix. If we could explicitly prevent BLT to scan the sites folder and build his own multisites values that would fix our issue, since we'd block it in the blt.yml file and set those values in each env.blt.yml files...

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

No branches or pull requests

3 participants