-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(lte): Fixed detect_init_system
#14034
fix(lte): Fixed detect_init_system
#14034
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
c16d263
to
b33ab3b
Compare
b33ab3b
to
2d1afb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this - I was sure I checked the service not running case :( but yeah, I can reproduce the issue.
Refactoring also lgtm.
NIT I would have preferred a prior check if the tool is installed (was done via type before the change). It feels a little hacky that a 'command not found' is basically ignored and the empty stdout is compared in that case. Raw return of subprocess.run
:
CompletedProcess(args=['sshpass', '-p', 'vagrant', 'ssh', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-o', 'LogLevel=ERROR', 'vagrant@192.168.60.142', "docker ps --filter 'name=magmad' --format '{{.Names}}'"], returncode=127, stdout=b'', stderr=b'bash: docker: command not found\n')
restarted failing required jobs - looks like a connection hiccup |
I'll have another look at this next week, but I think this is out of scope for this PR. |
- Added `exec_command_capture_output` to have an option to capture stdout and continue on non-zero exit codes. - Removed `_is_installed` function. - Simplified docker/systemd_magmad_running logic. - Renamed `MagmadUtil._data` to `MagmadUtil._credentials` and removed "command" key. - No longer write "command" to `MagmadUtil._credentials`, as this was not used anyway. Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
2d1afb4
to
c0500d3
Compare
@nstng I added the |
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the Python Format Check after the last commit. |
Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
c0500d3
to
1b77d44
Compare
- replace `&` with `and` in magmad running checks so that second condition is only evaluated if the first suceeds - Improved docstring of `exec_command_capture_output` - Added type hints to `exec_command`, `exec_command_output`, and `exec_command_capture_output` to highlight how these methods are different Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
- Perform sequential checks for installation and if magma is running - Remove exec_command_capture_output again as it is now unused Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the DCO check after the last commit. |
This reverts commit 2bb7908. Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
5334a89
to
4161b0d
Compare
Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please rebase the code as some ci check is failing.
* fix(lte): Fixed `detect_init_system` - Added `exec_command_capture_output` to have an option to capture stdout and continue on non-zero exit codes. - Removed `_is_installed` function. - Simplified docker/systemd_magmad_running logic. - Renamed `MagmadUtil._data` to `MagmadUtil._credentials` and removed "command" key. - No longer write "command" to `MagmadUtil._credentials`, as this was not used anyway. Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> * fix(lte): Added _is_installed check back in Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> * fix(lte): Improve changes in previous commits - replace `&` with `and` in magmad running checks so that second condition is only evaluated if the first suceeds - Improved docstring of `exec_command_capture_output` - Added type hints to `exec_command`, `exec_command_output`, and `exec_command_capture_output` to highlight how these methods are different Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> * fix(lte): Improve changes in previous commits - Perform sequential checks for installation and if magma is running - Remove exec_command_capture_output again as it is now unused Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> * Revert "fix(lte): Improve changes in previous commits" This reverts commit 2bb7908. Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> * fix(lte): Properly moved installation checks first Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com> Signed-off-by: Moritz Huebner <moritz.huebner@tngtech.com>
Closes #14033
Signed-off-by: Moritz Huebner moritz.huebner@tngtech.com
Summary
exec_command_capture_output
to allow running commands that return non-zero status codes without raising an exception._is_installed
function outsidedetect_init_system
.MagmadUtil._data
toMagmadUtil._credentials
and removed "command" key.MagmadUtil._credentials
, as this was not used anyway.Test Plan
See if an integration test can be started