-
Notifications
You must be signed in to change notification settings - Fork 83
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
Check config file not empty after modify it in hostcfgd. #36
Conversation
scripts/hostcfgd
Outdated
@@ -781,11 +792,29 @@ class AaaCfg(object): | |||
interface_ip = ipv4_addr | |||
return interface_ip | |||
|
|||
|
|||
def check_file_integrity(self, filename): |
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.
Strictly speaking, this file is only check file non-empty. If this is expected and good enough, please change the function name to narrow scope.
Otherwise, you may find some command line to verify the config. For example, sshd -T
could be used to verify /etc/ssh/sshd_config
. I am not sure if you can find the verification command for any other command. #Closed
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.
Fixed by change function name.
scripts/hostcfgd
Outdated
@@ -781,11 +792,29 @@ class AaaCfg(object): | |||
interface_ip = ipv4_addr | |||
return interface_ip | |||
|
|||
|
|||
def check_file_integrity(self, filename): | |||
rc, out = exec_cmd(cmd="du -b {}".format(filename), verbose=False) |
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.
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.
Fixed.
scripts/hostcfgd
Outdated
syslog.syslog(syslog.LOG_ERR, "file size check failed: {} is missing".format(filename)) | ||
return | ||
|
||
# du command result is: 'size\tpath' |
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.
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.
Fixed.
Remove the [Request for 202205 branch] label, because for release <= 202205 need manually cherry-pick |
Manually cherry-pick PR created: sonic-net/sonic-buildimage#14115 |
…4385) **What I did** Check /etc/pam.d/sshd integrity after modify it in hostcfgd. **Why I did it** Found some incident that /etc/pam.d/sshd become empty file during OR upgrade. **How I verified it** Pass all UT. Add new UT to cover new code. **Details if related** This is a manually cherry-pick PR for sonic-net/sonic-host-services#36
**What I did** Check /etc/pam.d/sshd integrity after modify it in hostcfgd. **Why I did it** Found some incident that /etc/pam.d/sshd become empty file during OR upgrade. **How I verified it** Pass all UT. Add new UT to cover new code. **Details if related**
What I did
Check /etc/pam.d/sshd integrity after modify it in hostcfgd.
Why I did it
Found some incident that /etc/pam.d/sshd become empty file during OR upgrade.
How I verified it
Pass all UT.
Add new UT to cover new code.
Details if related