summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-03-09 10:10:16 -0800
committerTim Smith <tsmith@chef.io>2017-05-08 12:31:50 -0700
commit043fb27da273aac5a5132cb1c7cd7f309d716b97 (patch)
tree92a9a04ae56a434b3cf5f252e687f52fcc13b558
parent4a117b877fb5979682882c5278ce70fc9c20fe35 (diff)
downloadohai-043fb27da273aac5a5132cb1c7cd7f309d716b97.tar.gz
Merge pull request #959 from chef/scala
Fix scala detection when version output contains a warning
-rw-r--r--lib/ohai/plugins/scala.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ohai/plugins/scala.rb b/lib/ohai/plugins/scala.rb
index ee905a64..1f019bb2 100644
--- a/lib/ohai/plugins/scala.rb
+++ b/lib/ohai/plugins/scala.rb
@@ -23,9 +23,10 @@ Ohai.plugin(:Scala) do
begin
so = shell_out("scala -version")
# Sample output:
- # Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL
+ # cat: /release: No such file or directory
+ # Scala code runner version 2.12.1 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc.
if so.exitstatus == 0
- scala[:version] = so.stderr.split[4]
+ scala[:version] = so.stderr.match(/.*version (\S*)/)[1]
end
rescue Ohai::Exceptions::Exec
Ohai::Log.debug('Plugin Scala: Could not shell_out "scala -version". Skipping data')