According to issue 2927814 we discussed another idea:
As site maintainer i want to open the drd ui and create a drush command 'profile' (Like in issue 2927799 (db dump profile)).
There i should be able to:
- create a name and machine name.
- input any drush command
- determine whether i want to see the output on drd (maybe like in #2932073)
-...
These created drush commands would serve as options for the new action 'Execute drush command'. The selected command would be executed on the remote parts and post-processed depending on the command settings.
The output (if checked) should be visible depending on setting.
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff_3_10.txt | 41.92 KB | maxrab |
#10 | drd-configure-cli-commands-2930229-10.patch | 23.7 KB | maxrab |
#3 | drush-command-profile-2930229.patch | 39.61 KB | drupatz |
Comments
Comment #2
drupatz CreditAttribution: drupatz commentedComment #3
drupatz CreditAttribution: drupatz commentedDrush command profile is created:
-Label (textfield)
-Drush command (textarea)
- Additional confirmation step, if an input command contains '-y' to avoid accidental execution of drush commands on remote parts.
-Checkbox for retrieving output
- Currently does nothing, waits for #2932073 to have playground
Logic implemented for D8, D7, D6 (D7 and D6 not tested), drush and DC command.
Comment #4
jurgenhaasThanks @drupatz this is a great starting point. A number of thoughts on how to make this generic:
Also, the patch contains settings from your IDE and the best approach would be to add the .idea directory to the global ignore list ion your host, that ensures that you never get into that problem in the future. And we don't want to add that into the project's ignore file because we would end up adding a lot of individual IDE directories to be ignored.
Last but not least, we may want to consider allowing extra and optional command line arguments when calling the drd action. If present, those arguments would be appended to the arguments from the CLI command config entity.
Comment #5
maxrab CreditAttribution: maxrab at arocom GmbH commentedI understand the service part, but I am currently not sure where to get the information about the scope when I am inside the action. How do I get this information?
Comment #6
jurgenhaasEach action has a type in its annotation which specifies the scope, e.g. for the cron action:
This action has a scope for
drd_domain
which means that it can be executed on domains and will in the UI only show up in domain views.For the CLI actions that are prepared in config entities, they need to create the actions as derivates and therefore define the type/scope on the fly depending on what is defined in the config entity.
Comment #7
maxrab CreditAttribution: maxrab at arocom GmbH commentedThis patch was made according to comment #4 by @jurgenhaas and basically covers the first four points.
* All the existing code and logic was rewritten to provide more generic cli commands instead of only drush commands
* There now is a cli command config entity along with the needed fields like the type and the scope of the cli command
* There is already a cli command action, but this is currently only for the scope of a domain
* There are already additional classes and files defined and modified which have no use right now, but will be needed later, like the action logic in the src/agent directory
Next up would probably be to define the Derivates of the CLICommand Action, but before that I would welcome feedback on the current state.
Thanks in advance!
Comment #8
maxrab CreditAttribution: maxrab at arocom GmbH commentedAdded the wrong files, these are the correct ones.
Comment #9
maxrab CreditAttribution: maxrab at arocom GmbH commentedComment #10
maxrab CreditAttribution: maxrab at arocom GmbH commentedOk, Im sorry, these really are the correct ones.
Comment #11
jurgenhaasSounds great, I'll have a look asap.
Comment #12
jurgenhaasStarted review of this and have a couple of suggestions:
However, I've tried the code and created my first CLI command successfully. Then I tried to execute that with drush and first didn't know what the ID of the action was. So maybe we need an option for
drush cli
that returns a list of available commands?What I realised was that when I used an ID that doesn't exist, drush just finished silently. Maybe some sort of error message to tell that the given ID doesn't exist?
And then, when I used the correct ID I get the following error:
I'm a bit confused by that error because the namespace is different. But the error is consistent even after a cache rebuild. Can you please have a look what's going on? Maybe that's going away also when we rename the action from CLICommand to just CLI, but I'm not sure.
Comment #13
jurgenhaashttps://gitlab.com/drupalspoons/drd/-/issues/40