As it stands, it is very difficult to automate certain workflows that use Acquia Search. In the Acquia Agent settings page there is a button called 'Save Keys'. If you override these values in a settings file (for instance, a staging settings file vs. a production settings file), the 'Save Keys' button needs to be pressed for the new keys to actually work. The fact that this requires human interaction makes it difficult to automate deployment of Drupal sites that use Acquia Search.
I've created a "save-keys" drush command that lets you save your Acquia Network keys and check your subscription. This emulates the 'Save Key's button and makes it automatable.
Patch to follow shortly...
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | 1152170-30.patch | 534 bytes | nick_vh |
| #27 | 1152170-27.patch | 5.2 KB | nick_vh |
| #21 | 1152170-20.patch | 12.58 KB | nick_vh |
| #19 | 1152170-19.patch | 12.61 KB | nick_vh |
| #18 | 1152170-18.patch | 12.18 KB | nick_vh |
Comments
Comment #1
pifantastic commentedFirst crack at a patch for this.
Comment #2
pwolanin commentedthanks sounds like a good idea.
However, there are a couple issues with the patch.
1) do we really need to specify --key? Will you ever save just the key or identifier?
2) Various other actions occur when the form is submitted - for Drupal 6 we might need to simulate that via drupal_execute()
Comment #3
nick_vhWe now support to save a variable using drush solr-variable-set. Any variable will be saved in $environment['conf] array.
If you save the derived key as "acquia_search_key" it will overwrite that variable.
You can easily calculate the derived key
This is a risky undertaking, so please understand what you are doing!
Comment #4
pwolanin commentedI don't think that satisfies the request in the general case?
Comment #5
nick_vhNo, but it would be a start. We could create a drush command that uses this code or he could. Depending on the time it takes.
I do like the idea of having a way to store a derived key in a sub using a small function and/or drush. This function could be ui-able whenever this is necessary.
Comment #6
nick_vhah I see, I marked it as fixed. Mistake of mine :-)
Comment #7
nick_vhTook a crack at this while on the train towards London drupal.org codesprint.
Comment #8
nick_vhhmm, odd - didnt take my drush file with it
Comment #9
nick_vhsecond time should be better
Comment #10
pwolanin commentedThanks for the start on this. I agree this is a better UX than having to get the derived key out of another site.
However, it can't quite work this way because each subscription has a unique salt that returns via xml-rpc for making the derived key.
In order for this to work, we'd need to see if we can make that xml-rpc call and get the response ideally without triggering a heartbeat on the network.
Comment #11
nick_vhTook the comments in mind and included should be an improved patch with a per-client salt
What it does is simplifying
It now incorporates
Using this new function we can easily fetch subscription data
Comment #12
nick_vhSmall update
Comment #13
nick_vhnow with the drush file..
Comment #14
nick_vhThe example code is still wrong, should correct that. Not sure if the drush command names are appropriate
Comment #15
pwolanin commentedLooks much better - need to check over a little more. So I guess in the (rare) case the salt changes they need to run the command again?
Comment #16
nick_vhYep, they have to run the command again. But if they go this far to set a custom derived key for an environment, they should be aware of the fact that this could change.
We could not change this derived key automatically because we have no clue about the key / id that actually was used to generate the derived key.
Comment #17
nick_vhSeems like I forgot to pass the key when validating the data
Comment #18
nick_vhFriday is a horribly day to submit patches it seems,
trying that again :)
Comment #19
nick_vhThanks to Irek, he found a bug that I have no idea how that could have gotten in there.
Patch included
Comment #20
nick_vhThere is still a race condition when enabling the module, so that's a pending task + It might be good if the main acquia search sub cannot be overridden, as a backup to your original subscription.
Comment #21
nick_vhThis patch fixes both problems
Please test it with the added environment (acquia_search_server_1) and another one, manually added or cloned
Comment #22
irek02 commentedThe patch works properly. While having same subscription for acquia connector and search, I was able to switch the search one to another subscription with no problems. It also didn't let me modify the subscription info for the original search environment, which worked as expected. Thanks to hard work of Nick.
I think it's good to go in the code.
Comment #23
coltranePatch works and looks mostly good. Comments should be proper sentences but that can be cleaned up separately. Committed http://drupalcode.org/project/acquia_connector.git/commit/91a055c
Comment #24
nick_vhcoltrane, you forgot to do git add ., the drush file is not included now...
Comment #25
nick_vhComment #26
nick_vhwe also want to push this change to 6.x-2.x and acquia_search-6.x-3.x
Comment #27
nick_vhPatch for 6.x-2.x
Comment #28
nick_vhNecessary for #1698668: Caching issues in Drupal 6 apachesolr and #1698664: Backport for Add a drush command to 'Save Keys'
Comment #29
nick_vhCommitted to 6.x-2.x-dev and added drush file to 7.x-2.x-dev
Comment #30
nick_vhLooks like a very critical part was not seen, the environment is never saved anymore, leading to outdated timestamps
Comment #31
nick_vhcommitted to 6.x-2.x and 7.x-2.x