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

ensure metadata release entry is a string #1305

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

chris-rock
Copy link
Contributor

As reported by Shone Jacob in https://chefcommunity.slack.com/archives/inspec/p1479483621000703 InSpec is not handling the version numbers from Ubuntu properly.

$ inspec exec ...
Please report a bug if this causes problems.
This OS/platform (ubuntu) is not supported by this profile.
This is the ubuntu version:
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

inspec.yml:

supports:
 - os-name: ubuntu
   release: 16.04

Internally, YAML parses 16.04 as a number instead as string. This PR fixes that behavior and ensurs that versions always compared as strings.

@chris-rock chris-rock force-pushed the chris-rock/metadata-os-release branch 2 times, most recently from bfe6231 to 48ae9f5 Compare November 20, 2016 18:57
@@ -68,7 +68,8 @@ def is_supported?(os, entry)
os.method(family_check).call
)

release_ok = release.nil? || os[:release] == release
# ensure we do have a string if we have a non-nil value eg. 16.06
release_ok = release.nil? || os[:release] == release.to_s
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move this to finalize ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, finalize_supports my bad!

… float

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
@arlimus arlimus force-pushed the chris-rock/metadata-os-release branch from 48ae9f5 to e3347f0 Compare November 20, 2016 19:38
@arlimus
Copy link
Contributor

arlimus commented Nov 21, 2016

Thank you @chris-rock 👍 🌮

@arlimus arlimus merged commit 2073431 into master Nov 21, 2016
@arlimus arlimus deleted the chris-rock/metadata-os-release branch November 21, 2016 04:32
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

Successfully merging this pull request may close these issues.

None yet

2 participants