Skip to content

package doesn't exit safely in non-lagoon environment #22

Open
@tobybellwood

Description

@tobybellwood

When used outside of a Lagoon environment, the drupal_integrations package may throw an error like the below:

Fatal error: Uncaught Error: Call to undefined method Drush\Drush::bootstrapManager() in /mnt/www/html/samplesite/drush/Commands/contrib/drupal_integrations/src/LagoonCommands.php:176
Stack trace:
#0 /mnt/www/html/samplesite/drush/Commands/contrib/drupal_integrations/src/LagoonCommands.php(67): Drush\Commands\drupal_integrations\LagoonCommands->getLagoonYml()
#1 /usr/local/drush8/vendor/drush/drush/includes/annotationcommand_adapter.inc(322): Drush\Commands\drupal_integrations\LagoonCommands->__construct()
#2 /usr/local/drush8/vendor/drush/drush/includes/annotationcommand_adapter.inc(297): annotationcommand_adapter_create_commandfile_instance()
#3 /usr/local/drush8/vendor/drush/drush/includes/annotationcommand_adapter.inc(109): annotationcommand_adapter_get_commands()
#4 /usr/local/drush8/vendor/drush/drush/includes/command.inc(1132): annotationcommand_adapter_commands()
#5 /usr/local/drush8/vendor/drush/drush/includes/command.inc(1430): drush_get_commands()
#6 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(54): drush_parse_command()
#7 /usr/local/drush8/vendor/drush/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /usr/local/drush8/vendor/drush/drush/drush.php(12): drush_main()
#9 {main}
  thrown in /mnt/www/html/samplesite/drush/Commands/contrib/drupal_integrations/src/LagoonCommands.php on line 176
Drush command terminated abnormally due to an unrecoverable error.       [error]

We suspect this is because Drush, in trying to get it's internal commands in order is hitting the _construct of this package and the getLagoonYml function should probably be skipped in a non-Lagoon env to failsafe. We can probably wrap it in a LAGOON env check like we do for settings.php (https://github.com/amazeeio/drupal-integrations/blob/main/assets/settings.lagoon.php#L33)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions