The context:

  1. I have a git repo for a Drupal 8.1.8 site.
  2. This was created using the template at: drupal-composer (whatever was in the master branch of that repo a few days ago).
  3. Composer version 1.2.0, PHP version 5.6.25-2+deb.sury.org~trusty+1, Ubuntu 16.04
  4. The repo was cloned into /var/aegir/platforms/foo-master-2e898c7, then /var/aegir/platforms/foo-master-2e898c7/web was added as a platform in Aegir.
  5. Aegir (v7.x-3.7) was used to successfully create a site on that platform, it has been verified (using the button in the Aegir UI), I also successfully used the password reset button, disabled/enabled the site and have browsed around the site's admin section. The site seems to be working correctly and without warnings or errors.
  6. Having made a few changes to the repo, /var/aegir/platforms/foo-master-51bf6c2 was cloned and the web subdirectory added to Aegir as a new platform.
  7. Aegir was used to create a new site on the new platform (created in (6)).

The Problem:

Migrating the site created in step (5) to the platform created in step (6) above fails with the following error:

PHP Fatal error: Call to undefined function drupal_get_installed_schema_version() in /var/aegir/platforms/foo-master-51bf6c2/web/core/includes/install.inc on line 80 Fatal error: Call to undefined function drupal_get_installed_schema_version() in /var/aegir/platforms/foo-master-51bf6c2/web/core/includes/install.inc on line 80 Drush command terminated abnormally due to an unrecoverable error. [31;40m[1m[error][0m Error: Call to undefined function drupal_get_installed_schema_version() in /var/aegir/platforms/foo-master-51bf6c2/web/core/includes/install.inc, line 80 The external command could not be executed due to an application [31;40m[1m[error]

The rest of the error is in the attached file. Note: this isn't the full log from Aegir, just the line from the log marked as an error. I have fixed up the formatting to be less illegible (sorry it's still pretty bad).

Note the second: from a brief discussion with @memtkmcc on IRC, the problem may be caused by *drupal-composer* and its non-standard directory structure (if something is supported by Drupal it should work in Aegir, IMO), however the drupal_get_installed_schema_version() function is inside the standard directory structure.

Note the third: I also created a Stack Exchange question for this.

What should happen

The correct behaviour is Aegir should migrate the site, if drupal-composer is not supported: it should be. drupal-composer provides a valid structure for a Drupal platform, and is apparently quite popular.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Liam McDermott created an issue. See original summary.

Liam McDermott’s picture

Issue summary: View changes
Liam McDermott’s picture

FileSize
24.67 KB

Just tried a clone along the same lines as the migrate described above, it generates this error message:

The command could not be executed successfully (returned: Generated config in write(): Drush configuration file [1;32;40m[1m[success][0m (/var/aegir/.drush/temp.foo.com.alias.drushrc.php) Changed permissions of [1;32;40m[1m[success][0m /var/aegir/.drush/temp.foo.com.alias.drushrc.php to 440 , code: 0)	

The weird thing about this: I can't see any error here, perhaps someone else can shed some light? The full log from the clone task is attached.

ergonlogic’s picture

Issue summary: View changes

There's only one place that function is called in Provision:

$ grep installed_schema_version ~/.drush/provision -rn
/var/aegir/.drush/provision/platform/drupal/packages_8.inc:106:      $package->schema_version = drupal_get_installed_schema_version($name);

But that isn't where this is failing... drupal_get_installed_schema_version() is failing to be called from .../web/core/includes/install.inc. As far as I can tell, we're succeeding with the site deployment right up until drush_provision_drupal_post_provision_deploy().

It'd be useful if you could drop some debug statements just before and after drush updatedb is called (around line 170 in platform/deploy.provision.inc in Provision):

function drush_provision_drupal_post_provision_deploy() {
  // Call the drush updatedb command.
  drush_log('This SHOULD appear in the log.', 'warning');     // add this
  provision_backend_invoke(d()->name, 'updatedb');
  drush_log('But this SHOULD NOT, if the problem is in the invocation of "updatedb".', 'warning');     // and this
  // We should be able to fully load Drupal now.

Note that there's a similar bug report upstream in Drush that might be related: https://github.com/drush-ops/drush/issues/2138

Liam McDermott’s picture

Sorry I couldn't provide debug data sooner, we were having some other unrelated problems.

Having upgraded to Aegir 3.9 this bug appears to have been partially fixed. No longer do I get the 'Call to undefined function' error, and clone tasks appear to be working for D8 sites. There is another error during D8 migrate tasks though, and it's occurring at the same point:

[0m (/var/aegir/config/server_master/nginx/vhost.d/test.foo.com) This SHOULD appear in the log. 
[1;33;40m
[1m[warning]
[0m Command updatedb needs a higher bootstrap level to run - you will 
[31;40m
[1m[error]
[0m need to invoke drush from a more functional Drupal environment to run this command. The drush command 'updatedb' could not be executed. 
[31;40m
[1m[error]
[0m Could not find a Drupal settings.php file at 
[31;40m
[1m[error]
[0m sites/default/settings.php. But this SHOULD NOT, if the problem is in the invocation of 
[1;33;40m
[1m[warning]
[0m "updatedb".

(apologies for the horrendous formatting, it's what Aegir outputs)

Other information that may be useful:

  1. I'm attaching a debug log of a successful clone, for comparison; it also runs an `drush updatedb` but does it successfully (the task only completes with a warning because of our debug messages).
  2. Whenever a migrate task is run for a D8 site, Aegir also creates and runs a verify task at the same time (see screenshot). Is it meant to do that? This does not happen when a clone task is run.
  3. Running `drush @test.foo.com updb` (as the Aegir user) from the command line runs without error.
  4. Running a verify task from Aegir completes without error; while this doesn't try to run a `drush upatedb` it does bootstrap the site and connect to the database successfully.
tarek’s picture

Hello all,

I am also suffering this problem when attempting to migrate a D7 site to D8 via Aegir. Has there been any resolution here? Is there anything new that I can contribute to get this moving?

Thank you,

tarek : )

Jon Pugh’s picture

There is a problem with Aegir using Drush 8 on Drupal 8 sites that include drush9.

I've got a PR with drush going: https://github.com/drush-ops/drush/pull/3260