hashbangcode / vlad

Vlad - Vagrant LAMP Ansible Drupal
173 stars 53 forks source link

drush_extras can cause provisioning to fail (D8 + Composer) #310

Closed zxaos closed 8 years ago

zxaos commented 8 years ago

In a scenario where you're using a new VM, with an existing drupal 8 install, and where drush is included in the composer build for that drupal 8 project, the default configuration for drush_extras will cause provisioning failure, as registry_rebuild doesn't have a working d8 version. And even if it did, including it by default for d8 is of arguable utility since d8's drush cr includes drush rr --fire-bazooka, essentially.

TASK: [drush_extras | Download additional Drush commands] *********************
changed: [192.168.100.100] => (item={'version': '-7.x-2.x', 'name': 'coder'})
changed: [192.168.100.100] => (item={'version': '', 'name': 'site_audit'})
failed: [192.168.100.100] => (item={'version': '', 'name': 'registry_rebuild'}) => {"changed": true, "cmd": ["drush", "dl", "registry_rebuild", "--destination=/home/vagrant/.drush/commands/registry_rebuild", "--yes"], "delta": "0:00:00.551445", "end": "2015-11-25 15:58:36.885931", "item": {"name": "registry_rebuild", "version": ""}, "rc": 1, "start": "2015-11-25 15:58:36.334486", "warnings": []}
stderr: No release history available for registry_rebuild 8.x.               [error]
Could not download requested project(s).                             [error]
stdout: The directory /home/vagrant/.drush/commands/registry_rebuild does not exist.
Would you like to create it? (y/n): y

FATAL: all hosts have already failed -- aborting

However, attempting re-provision will work successfully after it has failed once.

dixhuit commented 8 years ago

Good spot. I guess the simplest solution here is to not include it by default. All in favour?

zxaos commented 8 years ago

I'd almost prefer a d8 toggle somewhere. I feel like for 7, having rr available is expected behaviour unfortunately.

dixhuit commented 8 years ago

OK. This is very much related to #305 in that case.

dixhuit commented 8 years ago

For the time being I think it's simplest to just remove registry_rebuild from the defaults. The way Drush commands are now handled in Vlad makes it possible to re-add registry_rebuild via the vlad_settings.yml file, just set the relevant variable to include the commands you want installed (code copied from the current drush_extras role's default vars file):

drush_install_commands:
  - { name: 'coder', version: '-7.x-2.x'}
  - { name: 'site_audit', version: ''}
  - { name: 'registry_rebuild', version: ''}

In the short term, I'd rather introduce this minor inconvenience for when working with D7 sites in order to prevent an outright provisioning fail in the scenario you describe for D8. Hopefully, as ideas solidify over at #305 we can look at having different defaults for D7/D8 and re-introduce registry_rebuild as a default for D7.

dixhuit commented 8 years ago

In fact, looking at the defaults, it looks like it may be wise to remove the version from the entry for coder.

zxaos commented 8 years ago

Since it was the default before, would it make sense to add it to the example settings if it's not going to happen automatically?