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

Don't call Gem::Version.new() with a nil version #247

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented May 22, 2018

If the EMS api_version is nil don't call Gem::Version.new() to prevent
the exception:

ArgumentError:
  Malformed version number string

This behavior changed in gem version 2.7.7

https://travis-ci.org/ManageIQ/manageiq-providers-ovirt/builds/380600591#L1969

If the EMS api_version is nil don't call Gem::Version.new() to prevent
the exception:
```
ArgumentError:
  Malformed version number string
```

This behavior changed in gem version 2.7.7

https://travis-ci.org/ManageIQ/manageiq-providers-ovirt/builds/380600591#L1969
@miq-bot
Copy link
Member

miq-bot commented May 22, 2018

Checked commit agrare@3f64cc1 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@@ -14,7 +14,7 @@ def configure_cloud_init
return unless content = customization_template_content
with_provider_destination { |d| d.update_cloud_init!(content) }

if Gem::Version.new(source.ext_management_system.api_version) >= Gem::Version.new("3.5.5.0")
if source.ext_management_system.api_version && Gem::Version.new(source.ext_management_system.api_version) >= Gem::Version.new("3.5.5.0")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth assigning source.ext_management_system.api_version to a variable for readability, up to you though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good point I'll push a followup to address this

@bronaghs bronaghs merged commit adf168a into ManageIQ:master May 22, 2018
@bronaghs bronaghs added this to the Sprint 87 Ending Jun 4, 2018 milestone May 22, 2018
@agrare agrare deleted the fix_bug_calling_gem_version_with_nil branch May 22, 2018 16:12
simaishi pushed a commit that referenced this pull request May 22, 2018
Don't call Gem::Version.new() with a nil version
(cherry picked from commit adf168a)
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit e795f891c691e4cbf2e5ccb60d90931f5d040e30
Author: Bronagh Sorota <bsorota@redhat.com>
Date:   Tue May 22 18:12:10 2018 +0200

    Merge pull request #247 from agrare/fix_bug_calling_gem_version_with_nil
    
    Don't call Gem::Version.new() with a nil version
    (cherry picked from commit adf168aad659c6af24096743aa76d7464f1717ed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants