Closed (fixed)
Project:
Provision
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2010 at 02:20 UTC
Updated:
12 Jun 2014 at 08:41 UTC
Jump to comment: Most recent, Most recent file
This commit breaks Nginx support by reverting the settings.php to the cloaked version on backup task: http://git.aegirproject.org/?p=provision.git;a=commitdiff;h=87a405afdf2e...
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 955184.patch | 620 bytes | mig5 |
| #14 | 955184.patch | 646 bytes | mig5 |
| #11 | 955184.patch | 632 bytes | mig5 |
Comments
Comment #1
Anonymous (not verified) commentedCan I get some more information? / an example?
It only reverts the settings.php back to being cloaked if cloaking was previously enabled.
If cloaking was not enabled at all, it won't re-cloak.
Comment #2
omega8cc commentedThe bug is introduced by forcing cloaking.
I just tested it a few times with Nginx.
The logic must be wrong somehow.
I'm trying to debug it now.
Comment #3
Anonymous (not verified) commentedIt of course assumes cloaking, because that is TRUE by default.
So it will only ignore all that if you had cloaking turned off in your drushrc.php
I can't see where I've gone wrong, staring at the code.
It also doesn't make sense why would this only break nginx? I did a LOT of testing on Apache.
But I trust you! So do let me know what you find.
Comment #4
omega8cc commentedThe problem is, the provision_db_cloaking is not stored anywhere.
So you can't fetch it using drush_get_option() probably.
Comment #5
Anonymous (not verified) commentedI still don't follow.
It's enabled by default, and has been for a long time.
that's why the code says 'if (drush_get_option('provision_db_cloaking', TRUE)'
eg: 'if it's enabled, and if it's not been set, then consider it enabled'
You have to set '$options['provision_db_cloaking'] = FALSE;' in your drushrc.php for it to consider this 'off' and not cloak.
This is by design
But if you didn't have it set in your drushrc.php, your settings.php *must* have been cloaked already, so that is why I'm confused by what you mean.
Comment #6
omega8cc commentedThis is how it is set, but only in the apache_service.inc
In the nginx_service.inc it is not used (there is no return FALSE).
No idea how it should be fetched correctly.
Comment #7
Anonymous (not verified) commentedMaybe what you're saying is that nginx bypasses the cloaking altogether.
If that's the case, then nginx should also patch the drushrc.php to inject '$options['provision_db_cloaking'] = FALSE' into every site drushrc.php, in my opinion
(the alternative is to have the backup task check whether nginx or apache is in use, and i don't think that's the correct way to do it. If nginx is a special case, nginx should make a special exception) (Edit: that said, I don't know how to do that)
Comment #8
omega8cc commentedNo, it worked fine and I don't need to set it to OFF because it is set to ON only in the Apache service context.
It was *never* set/wrote in drushrc.php
Comment #9
Anonymous (not verified) commentedRight, so it means I was right in #7. (bypasses it completely).
I'll look into how to force cloaking off in nginx. i still think making a clause in the backup task itself is wrong
Comment #10
Anonymous (not verified) commentedGot a patch ready, standby..
Comment #11
Anonymous (not verified) commentedPlease test. (reverify the nginx sites. 'provision_db_cloaking' should be then set to FALSE in the drushrc.php)
Comment #12
Anonymous (not verified) commentedHold up on that, sorry.
I don't like the idea of injecting FALSE into the drushrc.php (what if the site gets migrated to an apache server, then its credentials are exposed).
I'll have another patch shortly.
Comment #13
omega8cc commentedIt wrote
$options['provision_db_cloaking'] = false;in drushrc.php but it didn't help. Cloaking is still forced on/after backup. Also, it shouldn't be required to verify the site before it will work, so I'm not sure if writing it to drushrc.php is the correct way to fix it.Comment #14
Anonymous (not verified) commentednew patch! sorry again.
Now we load whether cloaking is enabled or disabled based on the service, but we don't write anything to the drushrc.php, that's smarter I think.
It now matches the way the settings.php is written on verifies, installs etc.
Comment #15
Anonymous (not verified) commentedAnd another patch, I was on crack with that service check
This one *has* to work, cloaked is TRUE or FALSE here, simple as that :)
Comment #16
omega8cc commentedIt didn't help, sorry, it still rewrites settings.php with cloaked credentials.
Comment #17
Anonymous (not verified) commentedWow ok. Totally not what I'm seeing.
Can you make sure that
$options['provision_db_cloaking'] = false;it injected earlier is removed? and try another backup.I guess if it still doesn't help I'll just revert this one, despite the fact I can't reproduce.
Comment #18
omega8cc commentedWait! I tried it again on the clean install and it worked! http://drupal.org/files/issues/955184_1.patch
Comment #19
Anonymous (not verified) commentedYep so I think I basically just screwed you over with the earlier patch.
If you don't mind, please run a couple more tests until you're confident with it, I don't want to commit it and mess you up again
Comment #20
omega8cc commentedJust tested it again on another clean install. Works! Many thanks, Miguel!
Just to confirm twice, the working patch is http://drupal.org/files/issues/955184_1.patch
Comment #21
Anonymous (not verified) commentedNow I am seeing weird results too.
If I edit the drushrc.php and put false, and backup, it rewrites the settings.php with cloaked.
If i edit the drushrc.php, and put false, and VERIFY, and backup, it leaves them uncloaked.
so a verify is required in between. weird
Comment #22
omega8cc commentedI don't know if/how that works with Apache now, but with your latest patch (one patch only) I don't need to verify the site or put anything in drushrc.php, it just works on the backup task as expected.
Comment #23
Anonymous (not verified) commentedI have definitely broken it for Apache unless I verify first. I don't understand what difference the verify makes, so I'm just going to revert this.
You can keep the patch in yours I guess.
Sorry, another migression out of a migression
Comment #24
omega8cc commentedDoh, so we fixed it for Nginx by breaking it for Apache? I believe it is worth to debug it so it will work for both. Please don't revert anything yet, I will try to find a workaround.
Comment #25
Anonymous (not verified) commentedWhere that dlm is, it should return false here because
$options['provision_db_cloaking'] = FALSE;is in the drushrc.php of the site.But it returns true, as if it doesn't care, or because the default is TRUE (apache), it overrides that. that is not how I understand drush_get_option to work.
you say it isn't the same for you but earlier in #16 you said you continued to try and backup the site you were testing with and it kept writing the cloaks. I believe you also encountered this here, that's the same issue. (it only started working for you on new sites).
Comment #26
omega8cc commentedHmm.. in #16 I wrote it didn't work because I tried it on the instance where I tried previous patches without reverting them, so the results could be messed. Now it appears it works for Nginx with your latest patch only because it stopped to work for Apache. I must admit I'm a bit lost with all this cascading context stuff (see http://drupal.org/node/955224) and I believe it should be just written in the server options, like it is now for other options we have for Nginx:
Then we could fetch cloaking flag just by drush_get_option() as you did initially.
Well, let me add this for Nginx so it will work with your backup stuff for Apache.
Comment #27
Anonymous (not verified) commentedThe point is that I *should* be able to fetch drush_set_option from the site context and see it's false, but it returns true.
it returned false before, so it should still.
I wonder if it doesn't like the two definitions of $cloaked. I just don't know what to believe anymore :)
Comment #28
Anonymous (not verified) commentedOh!
I just realised why this is occurring.
If you :
1) install site
2) set provision_db_cloaking off in the settings.php
3) backup site
I thought it was *re-cloaking* the settings.php here, but in fact it works: it sees the drushrc saying 'we don't cloak!' and so it completely ignores the settings.php and doesn't rewrite it. It leaves it as it is: and it is still cloaked because it was cloaked on install (default = TRUE in apache service)
So I think it's the correct behaviour. It can only assume what drushrc says matches what the site is (if it says its false, it ought to assume the settings.php is uncloaked and not tamper with it).
Thats why a verify helped: the settings.php got rewritten on verify to match what was in the drushrc. I thought from thereon that the backup worked as normal, but it's the same story again: saw that it's not meant to be cloaked, so didn't tamper with the settings.php
with such a setting as cloaking, if you are setting it to false in the drushrc, you *must* reverify the site to apply that change (otherwise what's the point), and then you'll see correct behaviour.
So I was wrong about being wrong (!). I'll commit that fix.
Mig
Comment #29
Anonymous (not verified) commentedEdit: removed, I am on crack and keep being wrong about being wrong.
Avoiding the computer for a while..
Comment #30
Anonymous (not verified) commentedComment #31
adrian commentedi put in that patch a while ago to make it possible to override even what the web service required about cloaking.
it only happens when the config is regenerated though, and i dont believe that backup generates a config by itself.
the code i had was like this :
so it would get what http service said, then it would try to use drush_get_option to override that with the http service' return
value used as the default.
Once again, this was only happening when _provision_drupal_create_settings_file() is called, as it's built into the config class.
Comment #32
Anonymous (not verified) commentedYes I ended up making the backup logic the same as that.
All good I think. Sigh