-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor network.send_icmp to use deafult OS ping size #4
base: master
Are you sure you want to change the base?
Refactor network.send_icmp to use deafult OS ping size #4
Conversation
This refactoring allows the function to use the default host OS ping size in case the 'size' parameter was not passed and does not rely on a default size of 1500
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.
Thanks, it looks good, I have two small comments there.
rrmngmnt/network.py
Outdated
cmd.extend(["-M", "do"]) | ||
cmd = ["ping", dst, "-c", count] | ||
if size and size.isdigit(): | ||
cmd.extend(["-s", "size", "-M", "do"]) |
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 believe that there should be size
(without quotes)
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.
Oh yes, it is there by mistake... Thanks for noticing :)
rrmngmnt/network.py
Outdated
if size != "1500": | ||
cmd.extend(["-M", "do"]) | ||
cmd = ["ping", dst, "-c", count] | ||
if size and size.isdigit(): |
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 would change that condition to size is not None
, and use str(size)
in following line. I don't like approach to ignore parameter when it has wrong form - it is always better to fail.
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 agree with you
This refactoring allows the function to use the default host OS ping size in case the 'size' parameter was not passed and does not rely on a default size of 1500
…thon-rrmngmnt into refactor-send-icmp_master
Hi @lukas-bednar, I've performed the changes and committed them |
Hi @lukas-bednar I just noticed this one's open... |
This refactoring allows the function to use the default
host OS ping size in case the 'size' parameter was not passed
and does not rely on a default size of 1500