With the latest Drush (8.1-dev), Provision (7.x-3.x), and Hostmaster (7.x-3.4) I am unable to install sites in Aegir on Drupal 8 platforms. Verifying a Drupal 8 platform works fine.

When I try to install a site, it fails with the following:

exception 'Drupal\Core\Config\StorageException' with message 'Write operation is not allowed.' in /var/aegir/platforms/drupal/8.0.6/core/lib/Drupal/Core/Config/InstallStorage.php:110
Stack trace:
#0 /var/aegir/platforms/drupal/8.0.6/core/lib/Drupal/Core/Config/Config.php(227): Drupal\Core\Config\InstallStorage->write('system.file', Array)
#1 /var/aegir/.drush/provision/platform/drupal/install_8.inc(157): Drupal\Core\Config\Config->save()
#2 /var/aegir/.drush/provision/platform/drupal/install_8.inc(170): install_main()
#3 /usr/share/drush/includes/drush.inc(78): include_once('/var/aegir/.dru...')
#4 /usr/share/drush/includes/engines.inc(520): drush_include('/var/aegir/.dru...', 'install')
#5 /var/aegir/.drush/provision/platform/provision_drupal.drush.inc(89): drush_include_engine('drupal', 'install')
#6 [internal function]: drush_provision_drupal_provision_install_backend()
#7 /usr/share/drush/includes/command.inc(366): call_user_func_array('drush_provision...', Array)
#8 /usr/share/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#9 [internal function]: drush_command()
#10 /usr/share/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
#11 /usr/share/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#12 /usr/share/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 /usr/share/drush/drush.php(12): drush_main()
#14 {main}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

m.stenta’s picture

Provision's install_8.inc attempts to set file paths on lines 153-157 (this is the line causing the exception):

  // Set files paths
  \Drupal::configFactory()->getEditable('system.file')
    ->set('path.private', "sites/$url/private/files")
    ->set('path.temporary', "sites/$url/private/temp")
    ->save();

(Those lines were added in this commit: http://cgit.drupalcode.org/provision/commit/?id=00aa3d12646b71d3641c3d96...)

It seems that \Drupal::configFactory(), in this context, is creating an object of class InstallStorage - which extends the normal FileStorage class, but overrides the write() method to make it completely useless:

  /**
   * Overrides Drupal\Core\Config\FileStorage::write().
   *
   * @throws \Drupal\Core\Config\StorageException
   */
  public function write($name, array $data) {
    throw new StorageException('Write operation is not allowed.');
  }

(Link to that class's declaration: http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Config/Insta...)

I'm thinking that maybe something changed in Drupal core since Provision's commit http://cgit.drupalcode.org/provision/commit/?id=00aa3d12646b71d3641c3d96... - and now it no longer works. Not really sure yet.

m.stenta’s picture

Well, I tried commenting out those lines, and it fixed the exception.

But now something new is going wrong:

Drush command terminated abnormally due to an unrecoverable error. Error: Call to undefined function user_load() in /var/aegir/.drush/provision/platform/drupal/install_8.inc, line 159

Is D8 site install working for anyone? Or is it just mine that's broken?

m.stenta’s picture

Created new issue for that one - posting a fix separately: #2703017: D8 install fails with "Call to undefined function user_load()"

m.stenta’s picture

Status: Active » Needs review
FileSize
457 bytes

Ok, actually, it may be that the two errors are actually related. Closing #2703017: D8 install fails with "Call to undefined function user_load()" as a duplicate.

I was able to fix both issues by adding a drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL); at line 153.

Patch attached for review.

omega8cc’s picture

I can't reproduce this. Just tested with Provision/Hostmaster 3.x head, using Drush 8.x (head) and it works for latest Drupal 8.0 and 8.1

m.stenta’s picture

Really? Hmm. What could be different about my setup I wonder...

omega8cc’s picture

I have tested this using BOA stack, but it is basically Aegir 3.x head with Drush 8.x head

d8

d8

d8

d8

omega8cc’s picture

Maybe it is literally what the error is about -- write permissions in the codebase?

m.stenta’s picture

I'm using the Aegir Puppet Module (https://www.drupal.org/project/puppet_aegir) - so it is a standard install in that regard. As the aegir user, I downloaded the packaged Drupal 8 release from https://ftp.drupal.org/files/projects/drupal-8.0.6.tar.gz via wget and unpacked it into /var/aegir/platforms/drupal/8.0.6. All of the files are owned by the aegir user. Verifying the platform works fine. Creating a site fails - throwing the exception described above.

Are there any requirements for Drupal 8 platform file permissions that I might have missed?

I think the problem is deeper... but I'm not sure why it's working for you and not for me. :-/

In my case, adding drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL); (right before the code described in #3 above) solves the problem - which suggests that drush has not bootstrapped the newly created site, and therefore the code that follows (including user_load()) is not operating in an active Drupal site context.

So the question is: why is your new site bootstrapped already when it gets to line 153 of install_8.inc?

m.stenta’s picture

Status: Needs review » Closed (works as designed)

Ok.... well... this is a face-palm scenario.

Long story short... Provision works perfectly. It was my installation that was the problem. It was a simple typo in the file path that I told Aegir to look for the platform in. Aegir dutifully looked for the non-existent platform path, didn't find it, and created all the above errors.

Apologies for wasting your time @omega8cc. Your comment #10 was correct. :-)