Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Module from hostmaster-6.x-2.0-rc4/profiles/hostmaster/modules/hosting/subdirs/hosting_subdirs.module is not enabled.
On site delete we get:
Calling hook drush_subdirs_pre_provision_delete
Undefined offset: 1 subdirs.drush.inc:249
unlink(/var/aegir/config/server_master/apache/subdirs.d/drupal8-1.dev.voorbeeld-site.nl/.conf): No such file or directory subdirs.drush.inc:251
Error encountered attempting to delete site location config file for subdirectory drupal8-1.dev.voorbeeld-site.nl
opendir(/var/aegir/config/server_master/apache/subdirs.d/drupal8-1.dev.voorbeeld-site.nl): failed to open dir: No such file or directory subdirs.drush.inc:124
Returned from hook drush_subdirs_pre_provision_delete
Comment | File | Size | Author |
---|---|---|---|
#14 | provision.code_.2098389-14.patch | 2.83 KB | helmo |
#11 | provision.code_.2098389-11.patch | 2.89 KB | helmo |
#10 | provision-record_features_in_drushrc-2098389-10.patch | 2.5 KB | ergonlogic |
#10 | hosting-record_features_in_drushrc-2098389-10.patch | 2.6 KB | ergonlogic |
Comments
Comment #1
helmo CreditAttribution: helmo commented$alias in the _subdirs_delete_site_location() function is expected to be a string with a slash in it.
None of the provision functions seem to validate this.
We could quickly add
But why are these being called? Do we have any other provision extensions that depend on a hosting module being enabled?
Related: #2046167: [META] Remaining issues with subsite support (Part II)
Comment #2
anarcat CreditAttribution: anarcat commentedthat's a long time problem: there is no standard mechanism to enable/disable backend module from the frontend.
i am bumping this to critical since the subdir code has been merged in 2.x and this has the potential of breaking everything.
Comment #3
anarcat CreditAttribution: anarcat commentedsee also #1189576: can't disable the DNS service from the frontend.
Comment #4
helmo CreditAttribution: helmo commentedFrom: function drush_commandfile_list() {
Should we implement a hook_drush_load() which checks the frontend module status in the hostmaster context ?
Comment #5
ergonlogicMaybe we could add a 'subdir' flag in the site context, and then switch based on that?
Comment #6
anarcat CreditAttribution: anarcat commentedideally, this would be an aegir-wide parameter that any task sends a list of aegir-related modules enabled, and then we have *one* _load hook that we kick in the backend?
Maybe that will still required a hook_drush_load() in every .load.inc for every module, but at least we can simplify the message passing to be more generic from the frontend's perspective?
Just throwing ideas out there...
Comment #7
helmo CreditAttribution: helmo commentedI think every drush/provision contrib would have to implement hook_drush_load(), at least if there is something that should be prevented from running if the hosting counterpart is not enabled.
It might even be a slight performance gain if less code needs to be processed.
Some pseudo code:
Comment #8
ergonlogicNormally, there shouldn't be any code in Provision that runs before drush_load()'s. In _drush_add_commandfiles(), it'll include all *.drush.load.inc's before including any commandfiles.
However, Drush provides an '--early' option that allows pre-bootstrap code to be run. It is invoked at the top of drush_main(). Unfortunately, it appears to only be documented in the option itself:
I'm finding it hard to trace Drush's bootstrapping, but I think drushrc.php's are parsed just before looking for command files. If so, maybe we should consider writing a /var/aegir/.drushrc.php (or /var/aegir/.drush/drushrc.php), as part of verifying the hostmaster site. It might be triggered by adding a 'verify' task somewhere in hosting features.
Comment #9
ergonlogicSo this seems to work. In
provision/subdirs/subdirs.drush.load.inc
:... and in
/var/aegir/.drush/drushrc.php
:Changing the value in this array to anything other that 'subdirs' blocks the code in subdirs.drush.inc from running.
Comment #10
ergonlogicSince git.drupal.org is still broken, here are a couple patches that implement what I suggested in #8 and #9. This is a general purpose solution allows us to block drush hooks by implementing something like:
Comment #11
helmo CreditAttribution: helmo commentedWhy array_search()?
I think looking up the array key is faster. And the array value could just be a boolean. This could later be extended to be an array containing more info about the module ... possibly version info.
It also reduces ambiguity for a contrib developer.
This updated provision patch also adds the hook to the dns module. Which is an easy thing to use for testing... after this patch the provision-zone command no longer appears in the help listing when calling 'drush'
Comment #12
anarcat CreditAttribution: anarcat commentedJust for the sake of it, let me add:
ie. that we just have the modules as the values in the array - why bother with anything more complicated?
Also, at this point it is a little unclear for me when this code will run and the features array actually be written into that drushrc file... Can you be a little more specific about this?
Comment #13
helmo CreditAttribution: helmo commentedAfter applying the patch I verified the hostmaster site to fill the /var/aegir/.drush/drushrc.php
Saving the admin/hosting/features page triggers a verify of the hostmaster site.
I'm ok with option 4... I'll update the patches.
Comment #14
helmo CreditAttribution: helmo commentedUpdated patch for provision ... the hosting one from #10 is still good.
Comment #15
ergonlogicAssuming we're otherwise okay with this, I'll make the changes in #14, and commit. I have some nice explanatory commit messages that I'd hate to waste :)
Comment #16
ergonlogicI pushed these in provision and hosting. I'm re-setting to 'active', since there's also a suggestion in #1 to validate better.
Comment #17
danquah CreditAttribution: danquah commentedRetested after the patch update in #14 btw, it's all good :)
Comment #18
helmo CreditAttribution: helmo commentedI've created #2099883: Validate an alias has parts (subdirs) to checkout the validation.
Comment #19
helmo CreditAttribution: helmo commentedAnd another follow-up: #2099889: More hosting_features checks in _drush_load hooks?