fourkitchens / pantheon-tools

Tools to run actions against a Pantheon site
GNU General Public License v3.0
16 stars 3 forks source link

fix(pr12): Stanford H-S cannot run drush pm-list in live environment. #13

Closed dalin- closed 1 year ago

dalin- commented 1 year ago

There's something odd with the Stanford site. It'll probably be really tricky to find the root problem, but this code is a pretty simple workaround.

See how the same command on different environments produces different results:

on live:

➜ terminus drush stanford-hs.live -- pm-list --fields=name,status,version --format=string --filter="name=big_pipe"

  The "--filter" option does not exist.

pm:list [--format [FORMAT]] [--type [TYPE]] [--status [STATUS]] [--package PACKAGE] [--core] [--no-core] [--fields FIELDS] [--field FIELD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--notify] [--druplicon] [--xh-link XH-LINK] [--] <command>

 [notice] Command: stanford-hs.live -- drush pm-list [Exit: 1]
 [error]

on dev:

➜ terminus drush stanford-hs.dev -- pm-list --fields=name,status,version --format=string --filter="name=big_pipe"
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
big_pipe    Enabled 9.3.22
 [notice] Command: stanford-hs.dev -- drush pm-list [Exit: 0]

But yes it should work:

➜ terminus drush stanford-hs.live -- pm-list --help
...
 --filter[=FILTER] Filter output based on provided expression
...

We already have code to handle different drush versions (that handles the lack of --filter on Drush <= 8), and code to cycle through environments if something is broken in the live environment. So I just added a check for this to the latter.

The same problem was also happening on rutgers-spaa

cbfannin commented 1 year ago

@dalin- I can't seem to replicate the original issue.

I ran the terminus commands above and this is what I get: Screen Shot 2023-01-31 at 4 45 46 PM

I then ran pantheon-module-report and get this: Screen Shot 2023-01-31 at 5 22 27 PM

This was before checking out this branch and before upgrading Terminus. I was on 3.0.7 but now I am now on version 3.1.2.

What am I missing? Assuming I did everything right to test, I'm not sure this fix is necessary.

Let me know if there is something else you want me to try or a different way to test.

dalin- commented 1 year ago

@cbfannin Very strange. After I upgraded Terminus to 3.1.2, and cleared caches, then it started working better.

Regardless, the code change in this PR might help if this ever comes back: If the command output includes the string "option does not exist", then try the next environment.

cbfannin commented 1 year ago

@dalin- Approved to merge.