-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add logs to keystore-setup and fix password regex #10723
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
base: main
Are you sure you want to change the base?
Conversation
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
scripts/util/keystore-setup
Outdated
ALIAS="cloud" | ||
LIBVIRTD_FILE="/etc/libvirt/libvirtd.conf" | ||
|
||
log() { |
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.
I am not sure if it installed by default on your host's OS, but there is a tool called logger to do this, no need for a script function.
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.
looks generally good, but i'd use a $LOGGER as log command and define it depending on availability as the native tool instead of the function.
The potential problem here is that if I tend to use that kind of log function so I always get my logs, regardless of the environment. This would only be a problem of course if @DaanHoogland So, do I switch to logger with a fallback to log() knowing this ? |
@deajan , I don’t see the need for
I am also only suggesting, I will not -1 without it. |
The point is that the log function as for now works like It's just a detail, but I am not sure whether |
Update: Dash has builtin |
Updated the script. Let me run it on a couple of hosts to make sure everything works as expected. |
ok, i see @deajan , sorry to make your life so “exciting” . Nice solution! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10723 +/- ##
=========================================
Coverage 16.30% 16.31%
- Complexity 13445 13447 +2
=========================================
Files 5676 5676
Lines 499241 499241
Branches 60377 60377
=========================================
+ Hits 81408 81427 +19
+ Misses 408767 408742 -25
- Partials 9066 9072 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@DaanHoogland No worries, just wanted to make things right :) Tested the script, logging works, registering computers works too (tested on two hosts) |
Description
This PR adds logging to the
keystore-setup
script, and fixes the regex to check old cloudstack-agent password.When adding KVM hosts, the
keystore-setup
script may fail with530: Failed to setup keystore on the KVM host). On the KVM host
for various reasons (absence of keystore, malformatted agent.properties file, missing permissions...).This adds logs to almost all actions, and also fixes the regex that gets the password from
agent.properties
in order to not fetch commented-out passwords.Fixes #10703
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Script has been tested on two AlmaLinux 9.5 KVM hosts with a Cloudstack 4.20 management server.
Script has also been submitted to Shellcheck.
How did you try to break this feature and the system with this change?
Re-ran the tests on multiple hosts to validate that the script works ;)
Log function from the script has been tested on both RHEL and Debian systems.