Review main Merged

72274[BUGFIX] Don't fail language:update command when translation missing

Jochen Roth CR +2 V +2 Normal +39 −28 updated 11/27/21, 22:02

Commit message

Currently language:update command fails when
a translation of a extension is missing.

This has been fixed by returning a successful
status code even though the file was not found
on the translation server. With the additional
option '--fail-on-warnings' the command fails
if the download of a language pack was not
successful.

Missing files are still reported in CLI stdout
and it still fails if the server is not reachable.
Also missing translations are now logged.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 4

Files 2

Review log 3141

Show 1116 earlier messages
  1. Jochen Roth uploaded patch set 1 11/23/21, 13:59

  2. Jochen Roth marked it work in progress 11/23/21, 14:01

  3. Mathias Brodala commented on patch set 1 11/23/21, 14:08

    I know it's WIP but you surely want to add 11.5 here. ;-)
  4. core-ci voted on patch set 1 V +1 11/23/21, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19678

  5. Jochen Roth uploaded patch set 2 11/23/21, 14:56

  6. core-ci voted on patch set 2 V +1 11/23/21, 15:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19679

  7. Jochen Roth uploaded patch set 3 11/23/21, 16:16

  8. Jochen Roth updated the commit message in patch set 4 11/23/21, 16:19

  9. core-ci voted on patch set 3 V +1 11/23/21, 16:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19683

  10. core-ci voted on patch set 4 V +1 11/23/21, 16:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19684

  11. Jochen Roth uploaded patch set 5 11/24/21, 09:09

  12. Jochen Roth marked it ready for review 11/24/21, 09:10

  13. Jochen Roth commented on patch set 5 11/24/21, 09:10

    Reply

    Yep, sure ... sorry need to adjust mit commit msg template ;-)
  14. Mathias Brodala commented on patch set 5 11/24/21, 09:18

    I love all the fixes but personally I'd recommend to do a separate change for every issue. That's the point why I've created multiple issues. ;-)

    LanguagePackCommand.php:29

    This not an option AFAIS since typo3/cms-install does not depend on typo3/cms-extensionmanager.

    LanguagePackCommand.php:147

    You can simply "return 1" here with an error message before. No need to have an exception on CLI.
  15. core-ci voted on patch set 5 V -1 11/24/21, 09:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19695

  16. Jochen Roth uploaded patch set 6 11/24/21, 10:52

  1. core-ci voted on patch set 6 V +1 11/24/21, 11:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19696

  2. Jochen Roth uploaded patch set 7 11/24/21, 12:22

  3. Jochen Roth commented on patch set 7 11/24/21, 12:23

    Reply

    Yep, i totally understand that. But it was almost done with very few code changes. Otherwise patch would depend on the other which would make things unnecessarily complicated in this case. 😊

    LanguagePackCommand.php:29 Reply

    Ack

    LanguagePackCommand.php:147 Reply

    Ack
  4. core-ci voted on patch set 7 V +1 11/24/21, 12:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19697

  5. Mathias Brodala commented on patch set 7 11/25/21, 08:00

    Reply

    Ack
  6. Mathias Brodala commented on patch set 7 CR -1 11/25/21, 08:02

    LanguagePackCommand.php:99

    We should add a "$status = 0" here ...

    LanguagePackCommand.php:133

    IMO we should drop this here, the message should always be outputted.

    LanguagePackCommand.php:149

    ... set "$status = 1" here ...

    LanguagePackCommand.php:161

    ... and "return $status" here.
  7. Benni Mack commented on patch set 7 11/25/21, 08:24

    LanguagePackCommand.php:68

    is "fail" really a common flag/option? isn't "--failure-on-error" more appropriate?
  8. Mathias Brodala commented on patch set 7 11/25/21, 08:34

    LanguagePackCommand.php:68 Reply

    Do you have "popular" examples? The only other one I am aware of currently is "--fail-on-warnings" here: https://github.com/martin-helmich/typo3-typoscript-lint/blob/667eb63e1639b9fd726f72d1825be09ecfbdbb95/src/Command/LintCommand.php#L80
  9. Jochen Roth uploaded patch set 8 11/25/21, 09:52

  10. Jochen Roth commented on patch set 8 11/25/21, 09:53

    LanguagePackCommand.php:68 Reply

    Yep, 'fail-on-warnings' is now used because it throws only warnings now and does not switch visual warnings to errors when `--fail` was set. I went for --fail-on-warnings as a option name because it describes perfectly what i'm doing now. Without the option warnings are thrown but the command will not fail. `fail-on-warnings` will cause the command to fail.

    LanguagePackCommand.php:99 Reply

    $hasErrors contained the status, so i renamed this to $status and added it here.

    LanguagePackCommand.php:99 Reply

    Ack

    LanguagePackCommand.php:133 Reply

    Done

    LanguagePackCommand.php:149 Reply

    Ack

    LanguagePackCommand.php:149 Reply

    Ack

    LanguagePackCommand.php:161 Reply

    Ack

    LanguagePackCommand.php:161 Reply

    Ack
  11. core-ci voted on patch set 8 V +1 11/25/21, 10:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19724

  12. Benni Mack commented on patch set 8 11/25/21, 10:27

    Found this: https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html "ignore-errors" Browsing through common CLI commands I use on a daily basis, I did not find any such option actually :) "--ignore", "--skip" or "--prefer" is quite common though in the naming prefixes for options etc
  13. Mathias Brodala commented on patch set 8 11/25/21, 11:24

    Reply

    That sounds like it perfectly makes sense if errors/warnings are a deal-breaker for a command. In our case however it's perfectly fine to have the command succeed even if there are warnings. So I'd vote for making the failure mode optional as suggested ATM.
  14. Mathias Brodala voted on patch set 8 CR +1 11/25/21, 11:25

  15. Benni Mack voted on patch set 8 CR +1 11/26/21, 22:47

  16. Benni Mack updated the commit message in patch set 9 11/27/21, 12:38

  17. Benni Mack updated the commit message in patch set 10 11/27/21, 12:38

  18. Benni Mack commented on patch set 10 V +1 CR +1 11/27/21, 12:42

    LanguagePackCommand.php:68 Reply

    Ack
  19. core-ci voted on patch set 9 V +1 11/27/21, 12:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19851

  20. core-ci voted on patch set 10 V +1 11/27/21, 12:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19852

  21. Stefan Bürk voted on patch set 10 V +1 CR +1 11/27/21, 13:15

  22. Andreas Kienast commented on patch set 10 11/27/21, 13:21

    LanguagePackService.php:250

    Didn't Guzzle throw exceptions on every status code >= 400?
  23. Stefan Bürk commented on patch set 10 11/27/21, 14:27

    LanguagePackService.php:250 Reply

    Yes, unless you use the option 'http_errors' => false, which will disable throwing these exceptions. Which has been added in line 251. See: https://docs.guzzlephp.org/en/stable/request-options.html#http-errors
  24. Christian Kuhn commented on patch set 10 V +2 CR +2 11/27/21, 22:02

    LanguagePackService.php:250 Reply

    Done

    LanguagePackService.php:275

    +1 for dropping catch \exception!
  25. Christian Kuhn merged patch set 11 11/27/21, 22:02