Drush 9 no longer supports drush 8 commands. Key module commands need to be updated to support drush 9.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | interdiff.txt | 6 KB | rlhawk |
| #21 | 2912756-21.patch | 13.57 KB | rlhawk |
| #19 | 2912756-port-drush-19.patch | 13.69 KB | kmoll |
| #15 | interdiff-2912756-port-drush-15.txt | 4.4 KB | kmoll |
| #15 | 2912756-port-drush-15.patch | 18.33 KB | kmoll |
Comments
Comment #2
kmoll commentedHere is my initial implementation. Need to test it out, but wanted to push the patch here now.
Comment #3
kmoll commentedComment #4
ryan.ryan commentedNot sure if this needs a new issue or not, but probably relevant here. When using the "key-save" command, which seems to work great at first, the key that is saved isn't given a UUID. This of course is a problem when exporting the configuration and importing it on another site.
Example:
drush key-save tmp --key-provider=file --label=Tmp --key-type=encryption --key-type-settings='{"key_size":256}' --key-provider-settings='{"file_location":"../keys/tmp.key","base64_encoded":true}' -y
Resulting key:
Comment #5
rlhawkThanks for the info about the null UUID. I've addressed it in #2935263: key-save Drush command does not generate UUID.
Comment #6
rlhawk@kmoll - Are you actively working on this? If not, will you unassign yourself? Thanks.
Comment #7
kmoll commentedI can make this update, will try to do so tomorrow.
Comment #8
rlhawkTerrific, thanks!
Comment #9
kmoll commentedI have updated the key-save method in the commands file. I tested with the example above and it correctly creates the UUID.
Comment #10
kmoll commentedComment #11
rlhawkThanks, @kmoll. The key:save command looks good. Are you going to work on the other commands?
Comment #12
kmoll commented@rlhawk, I wasn't ware there were issues with the other commands. The save command seemed to be the only one affected by the UUID issue mentioned above. But I will re-test all other commands and ensure they are working.
Comment #13
kmoll commentedI've gone through all the commands, and I need to make a few tweaks:
1. Key-type command output format should be 'table' to keep it consistent.
2. Key-provider returns the same result as Key-type, so I think its key-types, so this has to be updated.
3. key-value command is not working.
Please let me know if you guys see any other issues. I will have an updated patch with these updates shortly.
Comment #14
rlhawkThose are the only issues I noticed. Thanks!
Comment #15
kmoll commentedI've fixed those issues.
Comment #16
kmoll commentedComment #17
rlhawk2912756-port-drush-15.patch unexpectedly undoes a few recent commits. Once I reverted those, the updated commands looked generally good. Here are some comments:
key:value-getiskey-test. It should bekey-value.key:value-get, but not for any other commands. I can't seen any difference in the@aliasesdeclarations and the aliases all seem to work.Symfony\Component\Console\Exception\CommandNotFoundException, with the errorThere are no commands defined in the "key" namespace.Randomly, like issuing the same command repeatedly sometimes results in the exception and sometimes doesn't.Comment #18
rlhawkComment #19
kmoll commentedThe key-test was a test value I left in there by accident, this patch fixed that.
I think the alias displays only for that because it is different than the actual command (although the commands have colons in the name). So the function and command is 'value-get', but the alias is key-value. That is the only thing I can think of.
Not sure about that 3rd error. I have not seen that error before.
I think the issue with the commits is that I pulled the latest 8.x-1.x but I didn't rebase my branch when I created that patch. So I made sure I had the latest 8.x-1.x branch, then I rebased my branch, so I think that should fix it. Let me know if it doesn't or there are other issues.
Comment #20
kmoll commentedComment #21
rlhawkAh, that makes sense about the aliases. The unpredictable errors did seem to be specific to my installation.
Here's a new patch with a few extra tweaks:
_convert_csv_to_arraycalls withStringUtils::csvToArrayoverwriteoption fromkey:saveand replaced it with a confirmation; removed confirmation when creating a new key withkey:saveComment #22
rlhawk@kmoll - Can you take a look at the latest tweaks that I made and, if they look OK, mark this issue RTBC? Thanks.
Comment #23
kmoll commented@rlhawk Looks good, ran through all commands again. They all worked. I see the confirmation prompt when re-saving a key. I think its good to go now.
Comment #24
kmoll commentedComment #25
douggreen commentedI don't think this is RTBM yet. We need to change the current drush commands (to support Drush 8 and below) to use the service per http://gbyte.co/blog/creating-drush-9-commands-and-porting-legacy-commands. I think this means creating a new service, and calling that service from both the .drush.inc and KeyCommands. I'll work on that change.
Comment #26
rlhawk@douggreen - The commands for both versions of Drush already call the same services provided by Key (e.g., key.repository, plugin.manager.key.key_type). Can you clarify what you mean?
Comment #27
douggreen commented@rlhawk I thought that we wanted to do something like the attached so that the code only needed to be maintained in one place, and so that we could add Drupal console support too. This doesn't quite work yet. The confirm() code needs to be sorted out. And for Drupal console we'll need to handle dt.
(BTW, I can't test with Drush 9 right now, something in master has a composer conflict, and isn't installing)
Comment #28
rlhawkOK, I'll take a look.
Comment #29
rlhawkI'd love to get the Drush 9 support committed. What do you think about doing the refactoring work in a separate issue?
Comment #30
kmoll commentedI am checking out the new patch now. There is an issue with certain types of things. For instance, in drush 8, there is a drush_set_error, command, where as in drush 9, you just throw an exception and it handles it like and error. If we consolidate to a single service file like that then we are going to run into inconsistencies. I like the idea of having everything in one place, makes it easier to maintain, but I think there maybe some incompatibilities.
That is just one issue I've come across, haven't done a full evaluation of the patch. I am able to run both versions of drush, so I can continue to go through and see if there are any other issues. I am always for iterations as well. IMO I think we could go with the patch we have and handle the refactor in another issue, if there are no objections.
I will continue to look at the patch and see what other updates, if any need to be handled and compile a list, then we can determine if its even worth it to try to refactor to single service for the commands.
Comment #31
douggreen commentedI haven't found a single other project trying to maintain drush 8 and drush 9 commands with a compatibility layer. I think that the plan is to stop supporting the drush 8 commands, and eventually to remove them.
Let's go with #21. This is the way of the future.
The new command file is auto-generated. I have some critique of it. If we're going to fix anything, it shouldn't be here, but in the auto-generation.
Comment #33
rlhawkComment #35
douggreen commentedIIRC, this was missing the new key-format from Drush 8, that now needs to be forward ported to Drush 9.