Skip to content
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

Removing miq-uuid.rb #476

Closed
djberg96 opened this issue Jun 5, 2020 · 2 comments
Closed

Removing miq-uuid.rb #476

djberg96 opened this issue Jun 5, 2020 · 2 comments

Comments

@djberg96
Copy link
Contributor

djberg96 commented Jun 5, 2020

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.

@Fryguy
Copy link
Member

Fryguy commented Jun 5, 2020

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

@Fryguy
Copy link
Member

Fryguy commented Jun 5, 2020

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.

@Fryguy Fryguy closed this as completed Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants