chef 11.8.2-x86-mingw32 → 11.8.4.ohai7.0-x86-mingw32
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.
- data/lib/chef/provider/ohai.rb +6 -5
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/base.rb +1 -3
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/git_spec.rb +1 -1
- data/spec/functional/resource/ohai_spec.rb +65 -0
- data/spec/spec_helper.rb +1 -2
- data/spec/support/shared/functional/windows_script.rb +1 -2
- data/spec/unit/provider/ohai_spec.rb +0 -1
- metadata +13 -9
data/lib/chef/provider/ohai.rb
CHANGED
@@ -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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
data/lib/chef/version.rb
CHANGED
@@ -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.
|
26
|
-
ohai.require_plugin("platform")
|
27
|
-
ohai.require_plugin("passwd")
|
25
|
+
ohai.all_plugins("platform")
|
28
26
|
ohai
|
29
27
|
end
|
30
28
|
end
|
@@ -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
|
data/spec/spec_helper.rb
CHANGED
@@ -87,8 +87,7 @@ Dir["spec/support/**/*.rb"].
|
|
87
87
|
|
88
88
|
|
89
89
|
OHAI_SYSTEM = Ohai::System.new
|
90
|
-
OHAI_SYSTEM.
|
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.
|
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.
|
5
|
-
prerelease:
|
4
|
+
version: 11.8.4.ohai7.0
|
5
|
+
prerelease: 7
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
8
8
|
- Adam Jacob
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
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:
|
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:
|
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
|
@@ -1594,6 +1594,7 @@ files:
|
|
1594
1594
|
- spec/functional/resource/ifconfig_spec.rb
|
1595
1595
|
- spec/functional/resource/link_spec.rb
|
1596
1596
|
- spec/functional/resource/mount_spec.rb
|
1597
|
+
- spec/functional/resource/ohai_spec.rb
|
1597
1598
|
- spec/functional/resource/package_spec.rb
|
1598
1599
|
- spec/functional/resource/powershell_spec.rb
|
1599
1600
|
- spec/functional/resource/registry_spec.rb
|
@@ -2009,12 +2010,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2009
2010
|
- - ! '>='
|
2010
2011
|
- !ruby/object:Gem::Version
|
2011
2012
|
version: '0'
|
2013
|
+
segments:
|
2014
|
+
- 0
|
2015
|
+
hash: 3862901366851738946
|
2012
2016
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2013
2017
|
none: false
|
2014
2018
|
requirements:
|
2015
|
-
- - ! '
|
2019
|
+
- - ! '>'
|
2016
2020
|
- !ruby/object:Gem::Version
|
2017
|
-
version:
|
2021
|
+
version: 1.3.1
|
2018
2022
|
requirements: []
|
2019
2023
|
rubyforge_project:
|
2020
2024
|
rubygems_version: 1.8.23
|