ohai 13.10.0 → 13.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cd47e40a9d7e2877d2422f47a12fce95026eb3ed7670e40bb82d8b9a398007f
4
- data.tar.gz: ae75e45d6f59c30f0abfc4e74f6af12a771edfd36f6d9acf41ea54ead46a8402
3
+ metadata.gz: a41edda21a06898377a46f64d60114fd881760976a7410142f2edc8da1db5720
4
+ data.tar.gz: c912b6aff14cb52b866353fd63ecc57e52fcf0cacf4a5a6854f26c8dc0f474ba
5
5
  SHA512:
6
- metadata.gz: 926724f586f794cef84f2f95efe705e09a7a953dfb050502571039a4bedf871c3cb89a128e34453fe2e3d5887ec1f18904a418398ca58640728ef8d5668a0e24
7
- data.tar.gz: 0f3a7b330e5c23c25e02fe383692aa7bc57280dc94aec1b641fae36318546dc7c72d58c2bb0b30a5ec5b0fd5a1cbfa0887f41601723179499103e192f0470631
6
+ metadata.gz: a9afdaa6fbf0727f4a7da85544090b4c73e14286527c9f0bb4d0d1f2ac9c93bc2669833c3f3138604802a5ddace874ac5b6002e33abf72a719a48d71af9e62ce
7
+ data.tar.gz: 9c5889f73fed85d39570fc4720c0ee2ae61814ef41624e04806fd3d3ba272b7bb05d50c0828e279452ea8a9b906427fe7b0e6f914a57ef880c2ca3d969e63fd9
data/Gemfile CHANGED
@@ -17,6 +17,19 @@ group :ci do
17
17
  gem "rspec_junit_formatter"
18
18
  end
19
19
 
20
+ group :docs do
21
+ gem "yard"
22
+ gem "redcarpet"
23
+ gem "github-markup"
24
+ end
25
+
26
+ group :debug do
27
+ gem "pry"
28
+ gem "pry-byebug"
29
+ gem "pry-stack_explorer"
30
+ gem "rb-readline"
31
+ end
32
+
20
33
  instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
21
34
 
22
35
  # If you want to load debugging tools into the bundle exec sandbox,
data/README.md CHANGED
@@ -11,7 +11,7 @@ Ohai will print out a JSON data blob for all the known data about your system. W
11
11
  Chef distributes ohai as a RubyGem. This README is for developers who want to modify the Ohai source code. For users who want to write plugins for Ohai, see the docs:
12
12
 
13
13
  - General documentation: <https://docs.chef.io/ohai.html>
14
- - Custom plugin documentation: <https://docs.chef.io/ohai_custom.html>
14
+ - Writing Ohai Plugins documentation: <https://docs.chef.io/ohai_custom.html>
15
15
 
16
16
  ## Development Environment:
17
17
 
@@ -37,11 +37,16 @@ Ohai has some Rake tasks for doing various things.
37
37
 
38
38
  ```
39
39
  rake -T
40
- rake build # Build the gem file ohai-$VERSION.gem
41
- rake install # install the gem locally
42
- rake install:local # install the gem locally without network access
43
- rake release # Create tag $VERSION, build gem, and push to Rubygems
44
- rake spec # Run RSpec tests
40
+ rake build # Build ohai-$VERSION.gem into the pkg directory
41
+ rake clean # Remove any temporary products
42
+ rake clobber # Remove any generated files
43
+ rake docs # Generate YARD Documentation
44
+ rake install # Build and install ohai-$VERSION.gem into system gems
45
+ rake install:local # Build and install ohai-$VERSION.gem into system gems without network access
46
+ rake release[remote] # Create tag $VERSION and build and push ohai-$VERSION.gem to rubygems.org
47
+ rake spec # Run RSpec code examples
48
+ rake style # Run Chefstyle tests
49
+ rake style:auto_correct # Auto-correct RuboCop offenses
45
50
 
46
51
  ($VERSION is the current version, from the GemSpec in Rakefile)
47
52
  ```
@@ -65,7 +70,7 @@ For information on contributing to this project see <https://github.com/chef/che
65
70
  Ohai - system information application
66
71
 
67
72
  - Author:: Adam Jacob ([adam@chef.io](mailto:adam@chef.io))
68
- - Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
73
+ - Copyright:: Copyright (c) 2008-2018 Chef Software, Inc.
69
74
  - License:: Apache License, Version 2.0
70
75
 
71
76
  ```text
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
- require "date"
3
- require "ohai/version"
4
2
 
5
3
  begin
6
4
  require "rspec/core/rake_task"
@@ -11,25 +9,34 @@ begin
11
9
  rescue LoadError
12
10
  desc "rspec is not installed, this task is disabled"
13
11
  task :spec do
14
- abort "rspec is not installed. `(sudo) gem install rspec` to run unit tests"
12
+ abort "rspec is not installed. bundle install first to make sure all dependencies are installed."
15
13
  end
16
14
  end
17
15
 
18
- task :default => :spec
19
-
20
- require "chefstyle"
21
- require "rubocop/rake_task"
22
- RuboCop::RakeTask.new(:style) do |task|
23
- task.options += ["--display-cop-names", "--no-color"]
16
+ begin
17
+ require "chefstyle"
18
+ require "rubocop/rake_task"
19
+ desc "Run Chefstyle tests"
20
+ RuboCop::RakeTask.new(:style) do |task|
21
+ task.options += ["--display-cop-names", "--no-color"]
22
+ end
23
+ rescue LoadError
24
+ puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed."
24
25
  end
25
26
 
26
27
  begin
27
- require "github_changelog_generator/task"
28
-
29
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
30
- config.future_release = Ohai::VERSION
31
- config.max_issues = 0
32
- config.add_issues_wo_labels = false
33
- end
28
+ require "yard"
29
+ YARD::Rake::YardocTask.new(:docs)
34
30
  rescue LoadError
31
+ puts "yard is not available. bundle install first to make sure all dependencies are installed."
32
+ end
33
+
34
+ task :console do
35
+ require "irb"
36
+ require "irb/completion"
37
+ require "ohai"
38
+ ARGV.clear
39
+ IRB.start
35
40
  end
41
+
42
+ task default: [:style, :spec]
@@ -66,14 +66,6 @@ class Ohai::Application
66
66
  :proc => lambda { |v| puts "Ohai: #{::Ohai::VERSION}" },
67
67
  :exit => 0
68
68
 
69
- def initialize
70
- super
71
-
72
- # Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
73
- # from failing due to permissions when launched as a less privileged user.
74
- Dir.chdir("/")
75
- end
76
-
77
69
  def run
78
70
  elapsed = Benchmark.measure do
79
71
  configure_ohai
@@ -92,6 +84,10 @@ class Ohai::Application
92
84
  end
93
85
 
94
86
  def run_application
87
+ # Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
88
+ # from failing due to permissions when launched as a less privileged user.
89
+ Dir.chdir("/")
90
+
95
91
  config[:invoked_from_cli] = true
96
92
  ohai = Ohai::System.new(config)
97
93
  ohai.all_plugins(@attributes)
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Nathan L Smith (<nlloyds@gmail.com>)
3
3
  # Author:: Tim Smith (<tsmith@chef.io>)
4
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@ Ohai.plugin(:CPU) do
22
22
 
23
23
  collect_data(:darwin) do
24
24
  cpu Mash.new
25
- shell_out("sysctl -a").stdout.lines.each do |line|
25
+ shell_out("sysctl hw machdep").stdout.lines.each do |line|
26
26
  case line
27
27
  when /^hw.packages: (.*)$/
28
28
  cpu[:real] = Regexp.last_match[1].to_i
@@ -34,13 +34,7 @@ Ohai.plugin(:Hardware) do
34
34
  next
35
35
  end
36
36
 
37
- begin
38
- require "plist"
39
- rescue LoadError => e
40
- # In case the plist gem isn't present, skip this plugin.
41
- Ohai::Log.debug("Plugin Hardware: Can't load gem: #{e}. Cannot continue.")
42
- next
43
- end
37
+ require "plist"
44
38
 
45
39
  hw_hash = system_profiler("SPHardwareDataType")
46
40
  hw_hash[0]["_items"][0].delete("_name")
@@ -20,13 +20,12 @@ Ohai.plugin(:SystemProfile) do
20
20
  provides "system_profile"
21
21
 
22
22
  collect_data(:darwin) do
23
- begin
24
- require "plist"
23
+ require "plist"
25
24
 
26
- system_profile Array.new
27
- items = Array.new
28
- detail_level = {
29
- "mini" => %w{
25
+ system_profile Array.new
26
+ items = Array.new
27
+ detail_level = {
28
+ "mini" => %w{
30
29
  SPParallelATAData
31
30
  SPAudioData
32
31
  SPBluetoothData
@@ -52,21 +51,22 @@ SPThunderboltData
52
51
  SPUSBData
53
52
  SPWWANData
54
53
  SPAirPortData},
55
- "full" => [
56
- "SPHardwareDataType",
57
- ],
58
- }
54
+ "full" => [
55
+ "SPHardwareDataType",
56
+ ],
57
+ }
59
58
 
60
- detail_level.each do |level, data_types|
61
- so = shell_out("system_profiler -xml -detailLevel #{level} #{data_types.join(' ')}")
62
- Plist.parse_xml(so.stdout).each do |e|
63
- items << e
64
- end
59
+ detail_level.each do |level, data_types|
60
+ so = shell_out("system_profiler -xml -detailLevel #{level} #{data_types.join(' ')}")
61
+ Plist.parse_xml(so.stdout).each do |e|
62
+ # delete some bogus timing data and then keep the rest
63
+ e.delete("_SPCompletionInterval")
64
+ e.delete("_SPResponseTime")
65
+ e.delete("_SPCommandLineArguments")
66
+ items << e
65
67
  end
66
-
67
- system_profile items.sort_by { |h| h["_dataType"] }
68
- rescue LoadError => e
69
- Ohai::Log.debug("Can't load gem: #{e})")
70
68
  end
69
+
70
+ system_profile ( items.sort_by { |h| h["_dataType"] } ) # rubocop: disable Lint/ParenthesesAsGroupedExpression
71
71
  end
72
72
  end
@@ -137,7 +137,7 @@ Ohai.plugin(:Platform) do
137
137
  "rhel"
138
138
  when /amazon/
139
139
  "amazon"
140
- when /suse/
140
+ when /suse/, /sles/, /opensuse/
141
141
  "suse"
142
142
  when /fedora/, /pidora/, /arista_eos/
143
143
  # In the broadest sense: RPM-based, fedora-derived distributions which are not strictly re-compiled RHEL (if it uses RPMs, and smells more like redhat and less like
@@ -286,8 +286,18 @@ Ohai.plugin(:Platform) do
286
286
  elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties
287
287
  platform lsb[:id].downcase
288
288
  platform_version lsb[:release]
289
+ # Use os-release (present on all modern linux distros) BUT use old *-release files as fallback.
290
+ # os-release will only be used if no other *-release file is present.
291
+ # We have to do this for compatibility reasons, or older OS releases might get different
292
+ # "platform" or "platform_version" attributes (e.g. SLES12, RHEL7).
293
+ elsif File.exist?("/etc/os-release")
294
+ platform os_release_info["ID"] == "sles" ? "suse" : os_release_info["ID"] # SLES is wrong. We call it SUSE
295
+ platform_version os_release_info["VERSION_ID"]
296
+ # platform_family also does not need to be hardcoded anymore.
297
+ # This would be the correct way, but we stick with "determine_platform_family" for compatibility reasons.
298
+ # platform_family os_release_info["ID_LIKE"]
289
299
  end
290
300
 
291
- platform_family determine_platform_family
301
+ platform_family determine_platform_family if platform_family.nil?
292
302
  end
293
303
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "13.10.0"
21
+ VERSION = "13.12.4"
22
22
  end
@@ -5,7 +5,6 @@ require "ohai/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "ohai"
7
7
  s.version = Ohai::VERSION
8
- s.platform = Gem::Platform::RUBY
9
8
  s.summary = "Ohai profiles your system and emits JSON"
10
9
  s.description = s.summary
11
10
  s.license = "Apache-2.0"
@@ -35,5 +34,5 @@ Gem::Specification.new do |s|
35
34
  s.executables = %w{ohai}
36
35
 
37
36
  s.require_path = "lib"
38
- s.files = %w{LICENSE README.md Gemfile Rakefile} + Dir.glob("*.gemspec") + Dir.glob("{docs,lib,spec}/**/*")
37
+ s.files = %w{LICENSE README.md Gemfile Rakefile} + Dir.glob("*.gemspec") + Dir.glob("{lib,spec}/**/*")
39
38
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Nathan L Smith (<nlloyds@gmail.com>)
3
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -78,7 +78,7 @@ machdep.cpu.max_basic: 13
78
78
  CTL
79
79
 
80
80
  allow(@plugin).to receive(:collect_os).and_return(:darwin)
81
- allow(@plugin).to receive(:shell_out).with("sysctl -a").and_return(mock_shell_out(0, @stdout, ""))
81
+ allow(@plugin).to receive(:shell_out).with("sysctl hw machdep").and_return(mock_shell_out(0, @stdout, ""))
82
82
  @plugin.run
83
83
  end
84
84
 
@@ -702,86 +702,145 @@ CISCO_RELEASE
702
702
 
703
703
  describe "on suse" do
704
704
 
705
- let(:have_suse_release) { true }
705
+ context "on versions that have /etc/os-release and no /etc/SuSE-release (e.g. SLES15)" do
706
706
 
707
- describe "with lsb_release results" do
708
- before(:each) do
709
- @plugin[:lsb][:id] = "SUSE LINUX"
710
- end
707
+ let(:have_suse_release) { false }
708
+ let(:have_os_release) { true }
711
709
 
712
- it "should read the platform as opensuse on openSUSE" do
713
- @plugin[:lsb][:release] = "12.1"
714
- expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
715
- @plugin.run
716
- expect(@plugin[:platform]).to eq("opensuse")
717
- expect(@plugin[:platform_family]).to eq("suse")
718
- end
719
- end
710
+ let(:os_release_content) do
711
+ <<-OS_RELEASE
712
+ VERSION="15"
713
+ VERSION_ID="15"
714
+ PRETTY_NAME="SUSE Linux Enterprise Server 15"
715
+ ID="sles"
716
+ ID_LIKE="suse"
717
+ ANSI_COLOR="0;32"
718
+ CPE_NAME="cpe:/o:suse:sles:15"
720
719
 
721
- describe "without lsb_release results" do
722
- before(:each) do
723
- @plugin.lsb = nil
720
+ OS_RELEASE
724
721
  end
725
722
 
726
- it "should set platform and platform_family to suse and bogus verion to 10.0" do
727
- expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
728
- @plugin.run
729
- expect(@plugin[:platform]).to eq("suse")
730
- expect(@plugin[:platform_family]).to eq("suse")
723
+ before do
724
+ expect(File).to_not receive(:read).with("/etc/SuSE-release")
725
+ expect(File).to receive(:read).with("/etc/os-release").and_return(os_release_content)
731
726
  end
732
727
 
733
- it "should read the version as 10.1 for bogus SLES 10" do
734
- expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
728
+ it "correctly detects SLES15" do
735
729
  @plugin.run
736
730
  expect(@plugin[:platform]).to eq("suse")
737
- expect(@plugin[:platform_version]).to eq("10.1")
731
+ expect(@plugin[:platform_version]).to eq("15")
738
732
  expect(@plugin[:platform_family]).to eq("suse")
739
733
  end
740
734
 
741
- it "should read the version as 11.2" do
742
- expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
743
- @plugin.run
744
- expect(@plugin[:platform]).to eq("suse")
745
- expect(@plugin[:platform_version]).to eq("11.2")
746
- expect(@plugin[:platform_family]).to eq("suse")
747
- end
735
+ end
748
736
 
749
- it "[OHAI-272] should read the version as 11.3" do
750
- expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
751
- @plugin.run
752
- expect(@plugin[:platform]).to eq("opensuse")
753
- expect(@plugin[:platform_version]).to eq("11.3")
754
- expect(@plugin[:platform_family]).to eq("suse")
755
- end
737
+ context "on versions that have both /etc/os-release and /etc/SuSE-release (e.g. SLES12)" do
738
+ let(:have_suse_release) { true }
739
+ let(:have_os_release) { true }
756
740
 
757
- it "[OHAI-272] should read the version as 9.1" do
758
- expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
759
- @plugin.run
760
- expect(@plugin[:platform]).to eq("suse")
761
- expect(@plugin[:platform_version]).to eq("9.1")
762
- expect(@plugin[:platform_family]).to eq("suse")
763
- end
741
+ describe "with lsb_release results" do
742
+ before(:each) do
743
+ @plugin[:lsb][:id] = "SUSE LINUX"
744
+ end
764
745
 
765
- it "[OHAI-272] should read the version as 11.4" do
766
- expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
767
- @plugin.run
768
- expect(@plugin[:platform]).to eq("opensuse")
769
- expect(@plugin[:platform_version]).to eq("11.4")
770
- expect(@plugin[:platform_family]).to eq("suse")
746
+ it "should read the platform as opensuse on openSUSE" do
747
+ @plugin[:lsb][:release] = "12.1"
748
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
749
+ @plugin.run
750
+ expect(@plugin[:platform]).to eq("opensuse")
751
+ expect(@plugin[:platform_family]).to eq("suse")
752
+ end
771
753
  end
754
+ end
772
755
 
773
- it "should read the platform as opensuse on openSUSE" do
774
- expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
775
- @plugin.run
776
- expect(@plugin[:platform]).to eq("opensuse")
777
- expect(@plugin[:platform_family]).to eq("suse")
756
+ context "on versions that have no /etc/os-release but /etc/SuSE-release (e.g. SLES11)" do
757
+ let(:have_suse_release) { true }
758
+ let(:have_os_release) { false }
759
+
760
+ describe "with lsb_release results" do
761
+ before(:each) do
762
+ @plugin[:lsb][:id] = "SUSE LINUX"
763
+ end
764
+
765
+ it "should read the platform as opensuse on openSUSE" do
766
+ @plugin[:lsb][:release] = "12.1"
767
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
768
+ @plugin.run
769
+ expect(@plugin[:platform]).to eq("opensuse")
770
+ expect(@plugin[:platform_family]).to eq("suse")
771
+ end
778
772
  end
773
+ end
779
774
 
780
- it "should read the platform as opensuseleap on openSUSE Leap" do
781
- expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n")
782
- @plugin.run
783
- expect(@plugin[:platform]).to eq("opensuseleap")
784
- expect(@plugin[:platform_family]).to eq("suse")
775
+ context "on openSUSE and older SLES versions" do
776
+ let(:have_suse_release) { true }
777
+ let(:have_os_release) { true }
778
+
779
+ describe "without lsb_release results" do
780
+ before(:each) do
781
+ @plugin.lsb = nil
782
+ end
783
+
784
+ it "should set platform and platform_family to suse and bogus verion to 10.0" do
785
+ expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
786
+ @plugin.run
787
+ expect(@plugin[:platform]).to eq("suse")
788
+ expect(@plugin[:platform_family]).to eq("suse")
789
+ end
790
+
791
+ it "should read the version as 10.1 for bogus SLES 10" do
792
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
793
+ @plugin.run
794
+ expect(@plugin[:platform]).to eq("suse")
795
+ expect(@plugin[:platform_version]).to eq("10.1")
796
+ expect(@plugin[:platform_family]).to eq("suse")
797
+ end
798
+
799
+ it "should read the version as 11.2" do
800
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
801
+ @plugin.run
802
+ expect(@plugin[:platform]).to eq("suse")
803
+ expect(@plugin[:platform_version]).to eq("11.2")
804
+ expect(@plugin[:platform_family]).to eq("suse")
805
+ end
806
+
807
+ it "[OHAI-272] should read the version as 11.3" do
808
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
809
+ @plugin.run
810
+ expect(@plugin[:platform]).to eq("opensuse")
811
+ expect(@plugin[:platform_version]).to eq("11.3")
812
+ expect(@plugin[:platform_family]).to eq("suse")
813
+ end
814
+
815
+ it "[OHAI-272] should read the version as 9.1" do
816
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
817
+ @plugin.run
818
+ expect(@plugin[:platform]).to eq("suse")
819
+ expect(@plugin[:platform_version]).to eq("9.1")
820
+ expect(@plugin[:platform_family]).to eq("suse")
821
+ end
822
+
823
+ it "[OHAI-272] should read the version as 11.4" do
824
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
825
+ @plugin.run
826
+ expect(@plugin[:platform]).to eq("opensuse")
827
+ expect(@plugin[:platform_version]).to eq("11.4")
828
+ expect(@plugin[:platform_family]).to eq("suse")
829
+ end
830
+
831
+ it "should read the platform as opensuse on openSUSE" do
832
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
833
+ @plugin.run
834
+ expect(@plugin[:platform]).to eq("opensuse")
835
+ expect(@plugin[:platform_family]).to eq("suse")
836
+ end
837
+
838
+ it "should read the platform as opensuseleap on openSUSE Leap" do
839
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n")
840
+ @plugin.run
841
+ expect(@plugin[:platform]).to eq("opensuseleap")
842
+ expect(@plugin[:platform_family]).to eq("suse")
843
+ end
785
844
  end
786
845
  end
787
846
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.10.0
4
+ version: 13.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-09 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -188,7 +188,6 @@ files:
188
188
  - README.md
189
189
  - Rakefile
190
190
  - bin/ohai
191
- - docs/man/man1/ohai.1
192
191
  - lib/ohai.rb
193
192
  - lib/ohai/application.rb
194
193
  - lib/ohai/common/dmi.rb
@@ -543,7 +542,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
543
542
  version: '0'
544
543
  requirements: []
545
544
  rubyforge_project:
546
- rubygems_version: 2.7.5
545
+ rubygems_version: 2.7.6
547
546
  signing_key:
548
547
  specification_version: 4
549
548
  summary: Ohai profiles your system and emits JSON
@@ -1,97 +0,0 @@
1
- .\" Man page generated from reStructuredText.
2
- .
3
- .TH "OHAI" "1" "Ohai 7.0.0" "" "ohai"
4
- .SH NAME
5
- ohai \- The man page for the ohai command line tool.
6
- .
7
- .nr rst2man-indent-level 0
8
- .
9
- .de1 rstReportMargin
10
- \\$1 \\n[an-margin]
11
- level \\n[rst2man-indent-level]
12
- level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
13
- -
14
- \\n[rst2man-indent0]
15
- \\n[rst2man-indent1]
16
- \\n[rst2man-indent2]
17
- ..
18
- .de1 INDENT
19
- .\" .rstReportMargin pre:
20
- . RS \\$1
21
- . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22
- . nr rst2man-indent-level +1
23
- .\" .rstReportMargin post:
24
- ..
25
- .de UNINDENT
26
- . RE
27
- .\" indent \\n[an-margin]
28
- .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29
- .nr rst2man-indent-level -1
30
- .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31
- .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
32
- ..
33
- .sp
34
- Ohai is a tool that is used to detect attributes on a node, and then provide these attributes to the chef\-client at the start of every chef\-client run. Ohai is required by the chef\-client and must be present on a node. (Ohai is installed on a node as part of the chef\-client install process.)
35
- .sp
36
- The types of attributes Ohai collects include (but are not limited to):
37
- .INDENT 0.0
38
- .IP \(bu 2
39
- Platform details
40
- .IP \(bu 2
41
- Network usage
42
- .IP \(bu 2
43
- Memory usage
44
- .IP \(bu 2
45
- Processor usage
46
- .IP \(bu 2
47
- Kernel data
48
- .IP \(bu 2
49
- Host names
50
- .IP \(bu 2
51
- Fully qualified domain names
52
- .IP \(bu 2
53
- Other configuration details
54
- .UNINDENT
55
- .sp
56
- Attributes that are collected by Ohai are automatic attributes, in that these attributes are used by the chef\-client to ensure that these attributes remain unchanged after the chef\-client is done configuring the node.
57
- .sp
58
- ohai is the command\-line interface for Ohai, a tool that is used to detect attributes on a node, and then provide these attributes to the chef\-client at the start of every chef\-client run.
59
- .SH OPTIONS
60
- .sp
61
- This command has the following syntax:
62
- .INDENT 0.0
63
- .INDENT 3.5
64
- .sp
65
- .nf
66
- .ft C
67
- ohai OPTION
68
- .ft P
69
- .fi
70
- .UNINDENT
71
- .UNINDENT
72
- .sp
73
- This tool has the following options:
74
- .INDENT 0.0
75
- .TP
76
- .B \fBATTRIBUTE_NAME ATTRIBUTE NAME ...\fP
77
- Use to have Ohai show only output for named attributes.
78
- .TP
79
- .B \fB\-d PATH\fP, \fB\-\-directory PATH\fP
80
- The directory in which Ohai plugins are located. For example: \fB/etc/ohai/plugins\fP\&.
81
- .TP
82
- .B \fB\-h\fP, \fB\-\-help\fP
83
- Shows help for the command.
84
- .TP
85
- .B \fB\-l LEVEL\fP, \fB\-\-log_level LEVEL\fP
86
- The level of logging that will be stored in a log file.
87
- .TP
88
- .B \fB\-L LOGLOCATION\fP, \fB\-\-logfile c\fP
89
- The location in which log file output files will be saved. If this location is set to something other than \fBSTDOUT\fP, standard output logging will still be performed (otherwise there would be no output other than to a file).
90
- .TP
91
- .B \fB\-v\fP, \fB\-\-version\fP
92
- The version of Ohai\&.
93
- .UNINDENT
94
- .SH AUTHOR
95
- Opscode
96
- .\" Generated by docutils manpage writer.
97
- .