chef 11.8.2 → 11.8.4.ohai7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,11 +33,12 @@ class Chef
33
33
  def action_reload
34
34
  converge_by("re-run ohai and merge results into node attributes") do
35
35
  ohai = ::Ohai::System.new
36
- if @new_resource.plugin
37
- ohai.require_plugin @new_resource.plugin
38
- else
39
- ohai.all_plugins
40
- end
36
+
37
+ # If @new_resource.plugin is nil, ohai will reload all the plugins
38
+ # Otherwise it will only reload the specified plugin
39
+ # Note that any changes to plugins, or new plugins placed on
40
+ # the path are picked up by ohai.
41
+ ohai.all_plugins @new_resource.plugin
41
42
  node.automatic_attrs.merge! ohai.data
42
43
  Chef::Log.info("#{@new_resource} reloaded")
43
44
  end
@@ -17,7 +17,7 @@
17
17
 
18
18
  class Chef
19
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
20
- VERSION = '11.8.2'
20
+ VERSION = '11.8.4.ohai7.0'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
@@ -22,9 +22,7 @@ def ohai
22
22
  # provider is platform-dependent, we need platform ohai data:
23
23
  @OHAI_SYSTEM ||= begin
24
24
  ohai = Ohai::System.new
25
- ohai.require_plugin("os")
26
- ohai.require_plugin("platform")
27
- ohai.require_plugin("passwd")
25
+ ohai.all_plugins("platform")
28
26
  ohai
29
27
  end
30
28
  end
@@ -45,7 +45,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
45
45
 
46
46
  before(:all) do
47
47
  @ohai = Ohai::System.new
48
- @ohai.require_plugin("os")
48
+ @ohai.all_plugins("os")
49
49
  end
50
50
 
51
51
  let(:node) do
@@ -92,7 +92,7 @@ E
92
92
 
93
93
  before(:all) do
94
94
  @ohai = Ohai::System.new
95
- @ohai.require_plugin("os")
95
+ @ohai.all_plugins("os")
96
96
  end
97
97
 
98
98
  context "working with pathes with special characters" do
@@ -0,0 +1,65 @@
1
+ #
2
+ # Author:: Serdar Sutay (<serdar@opscode.com>)
3
+ # Copyright:: Copyright (c) 2014 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'spec_helper'
20
+
21
+ describe Chef::Resource::Ohai do
22
+ let(:ohai) {
23
+ o = Ohai::System.new
24
+ o.all_plugins
25
+ o
26
+ }
27
+
28
+ let(:node) { Chef::Node.new }
29
+
30
+ let(:run_context) {
31
+ node.default[:platform] = ohai[:platform]
32
+ node.default[:platform_version] = ohai[:platform_version]
33
+ events = Chef::EventDispatch::Dispatcher.new
34
+ Chef::RunContext.new(node, {}, events)
35
+ }
36
+
37
+ shared_examples_for "reloaded :uptime" do
38
+ it "should reload :uptime" do
39
+ initial_uptime = ohai[:uptime]
40
+
41
+ # Sleep for a second so the uptime gets updated.
42
+ sleep 1
43
+
44
+ ohai_resource.run_action(:reload)
45
+ node[:uptime].should_not == initial_uptime
46
+ end
47
+ end
48
+
49
+ describe "when reloading all plugins" do
50
+ let(:ohai_resource) { Chef::Resource::Ohai.new("reload all", run_context)}
51
+
52
+ it_behaves_like "reloaded :uptime"
53
+ end
54
+
55
+ describe "when reloading only uptime" do
56
+ let(:ohai_resource) {
57
+ r = Chef::Resource::Ohai.new("reload all", run_context)
58
+ r.plugin("uptime")
59
+ r
60
+ }
61
+
62
+
63
+ it_behaves_like "reloaded :uptime"
64
+ end
65
+ end
@@ -87,8 +87,7 @@ Dir["spec/support/**/*.rb"].
87
87
 
88
88
 
89
89
  OHAI_SYSTEM = Ohai::System.new
90
- OHAI_SYSTEM.require_plugin("os")
91
- OHAI_SYSTEM.require_plugin("platform")
90
+ OHAI_SYSTEM.all_plugins("platform")
92
91
  TEST_PLATFORM = OHAI_SYSTEM["platform"].dup.freeze
93
92
  TEST_PLATFORM_VERSION = OHAI_SYSTEM["platform_version"].dup.freeze
94
93
 
@@ -23,8 +23,7 @@ shared_context Chef::Resource::WindowsScript do
23
23
  before(:all) do
24
24
 
25
25
  ohai_reader = Ohai::System.new
26
- ohai_reader.require_plugin("os")
27
- ohai_reader.require_plugin("windows::platform")
26
+ ohai_reader.all_plugins("platform")
28
27
 
29
28
  new_node = Chef::Node.new
30
29
  new_node.consume_external_attrs(ohai_reader.data,{})
@@ -42,7 +42,6 @@ describe Chef::Provider::Ohai do
42
42
  }
43
43
  }
44
44
  mock_ohai.stub!(:all_plugins).and_return(true)
45
- mock_ohai.stub!(:require_plugin).and_return(true)
46
45
  mock_ohai.stub!(:data).and_return(mock_ohai[:data],
47
46
  mock_ohai[:data2])
48
47
  Ohai::System.stub!(:new).and_return(mock_ohai)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.8.2
5
- prerelease:
4
+ version: 11.8.4.ohai7.0
5
+ prerelease: 7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Jacob
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-03 00:00:00.000000000 Z
12
+ date: 2014-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-config
@@ -96,17 +96,17 @@ dependencies:
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ~>
99
+ - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: '6.0'
101
+ version: 7.0.0.rc.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ~>
107
+ - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: '6.0'
109
+ version: 7.0.0.rc.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: rest-client
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -1402,6 +1402,7 @@ files:
1402
1402
  - spec/functional/resource/ifconfig_spec.rb
1403
1403
  - spec/functional/resource/link_spec.rb
1404
1404
  - spec/functional/resource/mount_spec.rb
1405
+ - spec/functional/resource/ohai_spec.rb
1405
1406
  - spec/functional/resource/package_spec.rb
1406
1407
  - spec/functional/resource/powershell_spec.rb
1407
1408
  - spec/functional/resource/registry_spec.rb
@@ -1817,12 +1818,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
1817
1818
  - - ! '>='
1818
1819
  - !ruby/object:Gem::Version
1819
1820
  version: '0'
1821
+ segments:
1822
+ - 0
1823
+ hash: 3862901366851738946
1820
1824
  required_rubygems_version: !ruby/object:Gem::Requirement
1821
1825
  none: false
1822
1826
  requirements:
1823
- - - ! '>='
1827
+ - - ! '>'
1824
1828
  - !ruby/object:Gem::Version
1825
- version: '0'
1829
+ version: 1.3.1
1826
1830
  requirements: []
1827
1831
  rubyforge_project:
1828
1832
  rubygems_version: 1.8.23