You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MiqUUID module has a single method called clean_guid. This method parses a string and returns a lowercased, canonical string if it can, or nil if it's given a nil, blank, or generally invalid argument.
Thinking that one of the existing uuid libraries might work, I started poking around the rubysphere to see what was available. What I found is that the current state of UUID libraries is generally terrible and/or isn't focused on parsing uuid strings. The current issues are:
The Digest::UUID in Rails only generates them, it doesn't parse them.
The uuidtools library (what we're using) hasn't been updated in 5 years, and its parse method cannot handle invalid formats.
Every other library I looked at (about a dozen) either focuses on uuid generation, strict validation, or cannot handle invalid, empty or nil arguments. The best one I could find was gn-uuid.
Most Ruby uuid libraries haven't been updated in years, which is problematic since UUID format evolves over time (v5 is out, v6 is under consideration).
Our current library is designed to be very flexible, presumably because we cannot anticipate what strange formatting any given provider might decide to do to their uuid strings, e.g. open and closing brackets in Microsoft uuid's. So, even if we found an up to date Ruby library, it still wouldn't do what we want.
Extracting this into its own library seems like overkill since it's only one method. My vote is to move this directly into the core 'lib' directly, possibly extending UUIDTools.
The text was updated successfully, but these errors were encountered:
MiqUUID was built specifically because GUIDs from the VMware provider are "weird". clean_guid was meant to normalize any "weird" GUID into a common format
Also, we already discussed this and already decided it should be kept in the core lib. See #231 where we've slotted every library into a bucket. If you need more clarification, please ask us either in that issue or in Gitter, as I'd rather you not have to spend time researching something we've already researched.
The MiqUUID module has a single method called
clean_guid
. This method parses a string and returns a lowercased, canonical string if it can, or nil if it's given a nil, blank, or generally invalid argument.Thinking that one of the existing uuid libraries might work, I started poking around the rubysphere to see what was available. What I found is that the current state of UUID libraries is generally terrible and/or isn't focused on parsing uuid strings. The current issues are:
parse
method cannot handle invalid formats.Our current library is designed to be very flexible, presumably because we cannot anticipate what strange formatting any given provider might decide to do to their uuid strings, e.g. open and closing brackets in Microsoft uuid's. So, even if we found an up to date Ruby library, it still wouldn't do what we want.
Extracting this into its own library seems like overkill since it's only one method. My vote is to move this directly into the core 'lib' directly, possibly extending UUIDTools.
The text was updated successfully, but these errors were encountered: