-
Notifications
You must be signed in to change notification settings - Fork 63
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
Rescue from failure when neither ip nor ifconfig exists #39
base: master
Are you sure you want to change the base?
Conversation
UUIDTools::UUID.ip_command = "nonexistent" | ||
UUIDTools::UUID.ip_path_default = "/bin/nonexistent" | ||
|
||
expect(UUIDTools::UUID.ifconfig).to eq('') |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
`UUIDTools::UUID.ifconfig` fails when neither `ip` nor `ifconfig` command exists on a UNIX-like system. In such a case, just ignore the exception.
808a49f
to
cb2f6c7
Compare
Hi, I have same issue in containers where there is no |
if os_class == :windows | ||
begin | ||
begin | ||
if os_class == :windows |
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.
Use the return of the conditional for variable assignment and comparison.
@@ -625,14 +627,16 @@ def self.mac_address | |||
|
|||
os_class = UUID.os_class | |||
|
|||
if os_class == :windows | |||
@@mac_address = |
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.
Replace class var @@mac_address with a class instance var.
I need to dedicate some time to testing this before I merge, and unfortunately that time is something I just don't have at the moment. I will try to get to it as soon as I can, but it could be awhile before I can give this the attention it needs. |
I'll probably try to update to a Docker-based CI setup since that's really what this kind of project desperately needs in order to effectively automate testing of weird environments. |
@sporkmonger Any progress on this? |
Hi, @sporkmonger!
I'm now working with some chroot-ed Linux environment where neither
ip
norifconfig
command is accessible. In such an environment I've found thatUUIDTools::UUID.ifconfig
fails in trying to invoke an incomplete command such as" addr list"
(path ofip
is missing!).This patch makes the method ignore such a failure and return an empty string.