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

add support for Wind River Linux and Cisco's Nexus platforms #544

Merged
merged 3 commits into from
Jun 16, 2015
Merged

add support for Wind River Linux and Cisco's Nexus platforms #544

merged 3 commits into from
Jun 16, 2015

Conversation

mattray
Copy link
Contributor

@mattray mattray commented May 21, 2015

No description provided.

@mattray
Copy link
Contributor Author

mattray commented May 22, 2015

@lamont-granquist the Travis test is failing on a unicode character being emitted when 'bundle exec ohai' runs on Ruby 2.0. The ohai output is causing ffi_yajl to choke, I don't think it has to do with my patch. Could you check it out please? It works fine on my laptop with the same Ruby.

@ryancragun
Copy link

Looks like /proc/cpuinfo is returning something funky on travis that cant be encoded

@lamont-granquist
Copy link
Contributor

Yeah the tests actually pass, the ohai run itself that travis invokes is failing due to UTF-8 in /proc/cpuinfo, which is a whole lotta lolwut, but i'll fix that in an incoming PR...

@@ -59,6 +59,15 @@ def get_redhatish_version(contents)
contents = File.read("/etc/parallels-release").chomp
platform get_redhatish_platform(contents)
platform_version contents.match(/(\d\.\d\.\d)/)[0]
elsif File.exists?('/etc/os-release')
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know if this file will exist on any other platforms? Could break detection for those, if so. Probably safer to put this last.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to go before the Red Hat detection because Wind River has a /etc/redhat file despite not being a Red Hat-based distro. I could make it smarter and put the logic inside the Red Hat detection. I didn't do that initially because the CentOS and Ubuntu boxes I checked didn't have the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the new standard for this release information in the future, so you will break the world if you put this first and don't have detection for everyone else in here.

@danielsdeleo
Copy link
Contributor

Travis is passing now that ffi-yajl 2.2 is out.

The Cisco test boxes have both an /etc/redhat-release and an /etc/os-release
file. We check if they have both before determining it's a Nexus box.
@mattray
Copy link
Contributor Author

mattray commented Jun 4, 2015

@lamont-granquist @danielsdeleo updated the patch to make it safer.

# don't clobber existing os-release properties, point to a different cisco file
contents = {}
File.read('/etc/os-release').split.collect {|x| x.split('=')}.each {|x| contents[x[0]] = x[1]}
if File.exists?(contents['CISCO_RELEASE_INFO'])
Copy link
Contributor

Choose a reason for hiding this comment

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

[1] pry(main)> File.exists?(nil)
TypeError: no implicit conversion of nil into String
from (pry):1:in `exists?'

Probably should guard that case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we should use exist? instead of exists?, which is deprecated. I think it will likely never actually be removed, but it spits out a warning if you run ruby -w. I'm slowly trying to fix up warnings and enable them in the tests in our codebase as I can.

@danielsdeleo
Copy link
Contributor

👍 once the File.exists?(nil) thing is taken care of.

@mattray
Copy link
Contributor Author

mattray commented Jun 9, 2015

@danielsdeleo added the nil check

@danielsdeleo
Copy link
Contributor

Cool, 👍

thommay added a commit that referenced this pull request Jun 16, 2015
add support for Wind River Linux and Cisco's Nexus platforms
@thommay thommay merged commit 31f6415 into chef:master Jun 16, 2015
@thommay thommay added Type: Enhancement Adds new functionality. and removed Enhancement labels Jan 24, 2017
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants