summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-03-09 10:10:16 -0800
committerGitHub <noreply@github.com>2017-03-09 10:10:16 -0800
commite231e61b81c789b3d68a3b2ddf1d94aee7c7b3cc (patch)
tree5ee0d9a873ce51e07d0265c673571879e52eac21
parent78cd084d9fe65e044a8d2f1f2f055151b20ac9d1 (diff)
parentadf042d7fcd696f1f29ad3e35f26ec52ce9d11e4 (diff)
downloadohai-e231e61b81c789b3d68a3b2ddf1d94aee7c7b3cc.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')