-
-
Notifications
You must be signed in to change notification settings - Fork 832
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(monitor): provide always valid exitcode #3836
Conversation
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.
Some interesting changes. I will have to review further myself and make any further changes required. Good PR. Thanks
# uses status var from check_status.sh | ||
if [ "${status}" != "0" ]; then | ||
fn_print_ok "Checking session: " | ||
fn_print_ok_eol_nl | ||
fn_script_log_pass "Checking session: OK" |
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.
This is required for logging
function fn__is_valid_ip() { | ||
local ip="${1}" | ||
# excluding 0.* ips also | ||
grep -qEe '^[1-9]+[0-9]*\.[0-9]+\.[0-9]+\.[0-9]+$' <<< "${ip}" |
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.
Nice improvement :)
fn_script_log_info "Checking active updates: CHECKING" | ||
fn_print_error_nl "Checking active updates: SteamCMD is currently checking for updates: " | ||
fn_print_error_eol | ||
fn_script_log_error "Checking active updates: SteamCMD is currently checking for updates: ERROR" |
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.
removing script_log_error removed logging for this
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.
What is your rule for using fn_script_log_*
here ?
Do you prefer setting the exitcode by fn_scrip_log_* in this case I can add it also in the other locations where I set exitcode directly.
I didn't add it because it seems like duplicate log output, if there would be a fn_script_log_dots [and replacing in monitor fn_print_dots with it] or fn_print_*_nl() which also setting the exitcode, I would be more satisfied. Would you be fine with such a solution?
@@ -62,6 +62,10 @@ fn_install_server_files(){ | |||
remote_fileurl="https://files.sa-mp.com/samp037svr_R2-1.tar.gz"; local_filedir="${tmpdir}"; local_filename="samp037svr_R2-1.tar.gz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4" | |||
elif [ "${shortname}" == "zmr" ]; then | |||
remote_fileurl="http://linuxgsm.download/ZombieMasterReborn/zombie_master_reborn_b5_2.tar.xz"; local_filedir="${tmpdir}"; local_filename="zombie_master_reborn_b5_2.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="4b9b9832e863d03981a40c26065792a6" | |||
else | |||
fn_print_error "Installing ${gamename} Server failed, missing default configuration" |
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.
LinuxGSM would fail long before getting here is $shortname was was not available
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.
bdserver will run into this without the fix from following pr, makes it more safe to use here.
https://github.com/jusito/LinuxGSM/blob/fix/bdserver/lgsm/functions/install_server_files.sh#L13-L16
You are welcome, regarding the changes I would suggest to guide me, because there are around 5-20 other pull requests waiting to be opened after this. Do you prefer a pr per servercode even if only one file is changed or group some of them. E.g. some servers just don't listen to serverquery port, even in an isolated environment with correct config and correct invocation. Therefore I tried to use another mode or set it to "1". |
4796863
to
2a14460
Compare
50fbfb8
to
07eef64
Compare
Resolved the conflicts, messed a bit with git history and needed to rewrite it. |
test logs looking good for me |
f02e53d
to
2257be4
Compare
Looking to get this merged. However, the issue I have is there are multiple features/fixes in this PR. Ideally these fixes should be broken down in to smaller PR's that will allow me to test individually and merge. I will have a go a breaking down the code a merging in a bit at a time |
I would like to help you, I have time after thursday but could finish it until saturday evening, would that help you ? |
Yeah that would be awesome. I am going though another PR currently and then I'm going to break down this one. When you start breaking things down just let me know which feature you are doing so we don't overlap :) |
|
07eef64
to
242d0a4
Compare
split into individual prs. |
Thanks for splitting them up. I was able to review and merge most quite quickly. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
These changes are the core changes needed for my docker pull request. The changes are tested against every servercode.
lgsm/functions/core_dl.sh:368
hides curl failinglinuxgsm.sh
changes are really useful to debug multiple invocations. As a result you can run a clean container and dump this file after the run to get a complete debug log.lgsm/functions/install_server_files.sh
missed a check if branch is missinglgsm/functions/fix.sh
refactoring to get rid of lots of branches which are error prone. Also added check to validate names added to arrays are valid.lgsm/functions/install_header.sh
probably a typo?Fixes #[issue]
Type of change
Checklist
PR will not be merged until all steps are complete.
issuedraft pr which depends on this.develop
branch as its base.Documentation
If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.
Thank you for your Pull Request!