diff options
author | Tim Smith <tsmith@chef.io> | 2016-11-29 11:21:33 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2016-11-29 11:21:33 -0800 |
commit | edc52262f5ad633cf36f279955980c31ec70f8c5 (patch) | |
tree | 2aada0a1d4860bf8dd843b5c7a9836661860069b | |
parent | 86ef325580c26cec5fd4afde5796895e77b7cc1b (diff) | |
parent | 9cd0ce0930ced860594189d9a89b1f46ae4c8638 (diff) | |
download | ohai-edc52262f5ad633cf36f279955980c31ec70f8c5.tar.gz |
Merge branch 'dave-1426559693' of git://github.com/bahamas10/ohai into bahamas10-dave-1426559693
-rw-r--r-- | lib/ohai/plugins/joyent.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/ohai/plugins/joyent.rb b/lib/ohai/plugins/joyent.rb index c921d65d..3ca3078d 100644 --- a/lib/ohai/plugins/joyent.rb +++ b/lib/ohai/plugins/joyent.rb @@ -25,21 +25,18 @@ Ohai.plugin(:Joyent) do depends "os", "platform", "virtualization" def collect_product_file - lines = [] - if ::File.exists?("/etc/product") - ::File.open("/etc/product") do |file| - while line = file.gets - lines << line - end - end + data = ::File.read("/etc/product") rescue nil + if data + data.strip.split("\n") + else + nil end - lines end def collect_pkgsrc - if File.exist?("/opt/local/etc/pkg_install.conf") - sm_pkgsrc = ::File.read("/opt/local/etc/pkg_install.conf").split("=") - sm_pkgsrc[1].chomp + data = ::File.read("/opt/local/etc/pkg_install.conf") rescue nil + if data + data.strip.split("=", 2).last else nil end |