Improve server version detection - #9
Conversation
| @local_version ||= begin | ||
| stdout, stderr, status = Open3.capture3( | ||
| { 'PATH' => ENV['PATH'] }, 'minio --version', unsetenv_others: true | ||
| { 'PATH' => ENV['PATH'] }, 'journalctl --boot --unit minio | grep "Version: RELEASE" | tail -n 1', unsetenv_others: true # rubocop:disable Layout/LineLength |
There was a problem hiding this comment.
--boot bedeutet, dass wir nur die frischestens logs bekommen. Sonst werden die mitunter ganz schön lang und wir haben unnötig Disk IO.
There was a problem hiding this comment.
Darüber hinaus hatte ich auch nach einem Version String im health endpoint geschaut, aber den hat minio aus Sicherheitsgründen vor längerer Zeit ausgebaut.
There was a problem hiding this comment.
FTR: Ich hab lokal via bin/console überprüft, ob Open3#capture3 auch Shell pipes unterstützt ✅
irb(main):014:1* Open3.capture3(
irb(main):015:1* { 'PATH' => ENV['PATH'] }, 'echo foo | wc -l', unsetenv_others: true # rubocop:disable Layout/LineLength
irb(main):016:0> )
=> ["1\n", "", #<Process::Status: pid 24932 exit 0>]
Dafür musste ich noch 1 File hinzufügen, siehe a3b8b20
There was a problem hiding this comment.
Ah, danke für den Check. Ich hatte das gar nicht lokal ausprobiert und mich auf den test verlassen. Aber jetzt fällt mir auf, dass der Test ja Open3 komplett mockt (was ja auch nicht anders geht). Also gut, dass nochmal ausprobiert zu haben.
jonathanschlue-as
left a comment
There was a problem hiding this comment.
Hinweis: Habe selber noch bin/console gefixt als Commit in diesem PR.
Wunsch: Bitte noch README anpassen (yay).
Approve schonmal.
LGTM 👍
| @local_version ||= begin | ||
| stdout, stderr, status = Open3.capture3( | ||
| { 'PATH' => ENV['PATH'] }, 'minio --version', unsetenv_others: true | ||
| { 'PATH' => ENV['PATH'] }, 'journalctl --boot --unit minio | grep "Version: RELEASE" | tail -n 1', unsetenv_others: true # rubocop:disable Layout/LineLength |
There was a problem hiding this comment.
FTR: Ich hab lokal via bin/console überprüft, ob Open3#capture3 auch Shell pipes unterstützt ✅
irb(main):014:1* Open3.capture3(
irb(main):015:1* { 'PATH' => ENV['PATH'] }, 'echo foo | wc -l', unsetenv_others: true # rubocop:disable Layout/LineLength
irb(main):016:0> )
=> ["1\n", "", #<Process::Status: pid 24932 exit 0>]
Dafür musste ich noch 1 File hinzufügen, siehe a3b8b20
Co-authored-by: Jonathan Schlue <49396111+jonathanschlue-as@users.noreply.github.com>
https://trello.com/c/JUtcafnV/6223-1-minio-update-stabilisieren-opsmaintenance6223jutcafnv