-
Notifications
You must be signed in to change notification settings - Fork 450
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 language scala #524
Add language scala #524
Conversation
LGTM 👍 |
@mcquin good on your side? |
LGTM Should we add a |
Sounds great to me. Should we collect just the sbt info or also say that if sbt is found, we should label this machine as having the language scala installed? |
Some people may have scala, but not sbt. I'm +1 for having sbt as a subattribute of |
@mcquin I added a step to check for sbt. |
scala = Mash.new | ||
so = shell_out("scala -version") | ||
if so.exitstatus == 0 | ||
output = so.stdout.split |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Looks like you've got two spaces after your =
sign.
Some minor things, but looking great @cmluciano ! =) |
👍 |
Can we get a few more 👍 from @chef/client-core |
We need another review from @chef/client-core |
👍 |
@ranjib Added time appears negligible
|
context "if scala is not installed" do | ||
|
||
before(:each) do | ||
allow(plugin).to receive(:shell_out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we've done something special in Ohai, this isn't what happens when scala isn't installed. On my machine:
[1] pry(main)> require 'mixlib/shellout'
=> true
[2] pry(main)> include Mixlib
=> Object
[3] pry(main)> c = ShellOut.new("scala -v")
=> <Mixlib::ShellOut#70321135567700: command: 'scala -v' process_status: nil stdout: '' stderr: '' child_pid: nil environment: {} timeout: 600 user: group: working_dir: >
[4] pry(main)> c.run_command
Errno::ENOENT: No such file or directory - scala
from /Users/ddeleo/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.1.0/lib/mixlib/shellout/unix.rb:338:in `exec'
I think ohai still catches all failures and ignores them, but it'd be nice to rescue that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. I assumed shellout caught these errors, appears that is not the case. Good to know, taking note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I just remove this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, don't remove this context.
Dan's comment shows shell_out("scala -v")
throws an Errno::ENOENT
, rather than returning what's been mocked here. The spec should be updated to reflect that behavior.
LGTM |
What are the two begin/end blocks for? Does it make sense if we can't find scala to return rather than look for sbt too? |
Yeah the begin/end should go and the initial check should probably just be a shell_out! and let the exception abort the plugin. |
Ok begin/end have been removed. Just waiting on CI :) |
Failures seemed related to style, fixed up |
👍 @chef/client-core |
# Check for scala | ||
output = nil | ||
|
||
scala = Mash.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go after the check for the exist status. Otherwise we get an empty hash when scala isn't around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohai won't add attribute
to its data until you do attribute Mash.new
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore me
No description provided.