chef-rewind 0.0.8 → 0.0.9
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.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/.kitchen.yml +26 -0
- data/.travis.yml +11 -0
- data/Berksfile +4 -0
- data/Gemfile +5 -34
- data/README.md +6 -2
- data/Rakefile +10 -0
- data/chef-rewind.gemspec +1 -1
- data/gemfiles/chef-11.gemfile +7 -0
- data/gemfiles/chef-12.gemfile +7 -0
- data/lib/chef/rewind.rb +45 -15
- data/spec/data/cookbooks/rewind/Berksfile +3 -0
- data/spec/data/cookbooks/rewind/README.md +1 -0
- data/spec/data/cookbooks/rewind/files/default/test/default_test.rb +21 -0
- data/spec/data/cookbooks/rewind/metadata.rb +7 -0
- data/spec/data/cookbooks/rewind/recipes/base.rb +11 -0
- data/spec/data/cookbooks/rewind/recipes/default.rb +12 -0
- data/spec/rewind_recipe_spec.rb +10 -11
- data/spec/rewind_resource_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -44
- data/spec/unwind_recipe_spec.rb +34 -5
- metadata +23 -89
- data/spec/data/cookbooks/angrybash/recipes/default.rb +0 -8
- data/spec/data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +0 -2
- data/spec/data/cookbooks/apache2/recipes/default.rb +0 -3
- data/spec/data/cookbooks/borken/recipes/default.rb +0 -2
- data/spec/data/cookbooks/borken/templates/default/borken.erb +0 -2
- data/spec/data/cookbooks/chefignore +0 -6
- data/spec/data/cookbooks/java/files/default/java.response +0 -2
- data/spec/data/cookbooks/openldap/attributes/default.rb +0 -16
- data/spec/data/cookbooks/openldap/attributes/smokey.rb +0 -1
- data/spec/data/cookbooks/openldap/definitions/client.rb +0 -5
- data/spec/data/cookbooks/openldap/definitions/server.rb +0 -5
- data/spec/data/cookbooks/openldap/files/default/.dotfile +0 -1
- data/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/subdir_with_no_file_just_a_subsubdir/the_subsubdir/some_file.txt +0 -3
- data/spec/data/cookbooks/openldap/recipes/default.rb +0 -3
- data/spec/data/cookbooks/openldap/recipes/gigantor.rb +0 -3
- data/spec/data/cookbooks/openldap/recipes/one.rb +0 -15
- data/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/openldap_variable_stuff.conf.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/test.erb +0 -1
- data/spec/support/lib/chef/provider/easy.rb +0 -35
- data/spec/support/lib/chef/provider/snakeoil.rb +0 -40
- data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -43
- data/spec/support/matchers/leak.rb +0 -96
- data/spec/support/mock/constant.rb +0 -52
- data/spec/support/mock/platform.rb +0 -18
- data/spec/support/platform_helpers.rb +0 -31
- data/spec/support/platforms/prof/gc.rb +0 -54
- data/spec/support/platforms/prof/win32.rb +0 -46
- data/spec/support/shared/functional/directory_resource.rb +0 -85
- data/spec/support/shared/functional/file_resource.rb +0 -173
- data/spec/support/shared/functional/knife.rb +0 -37
- data/spec/support/shared/functional/securable_resource.rb +0 -394
- data/spec/support/shared/unit/api_error_inspector.rb +0 -192
- data/spec/support/shared/unit/platform_introspector.rb +0 -162
@@ -1,162 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Seth Falcon (<seth@opscode.com>)
|
3
|
-
# Author:: Daniel DeLeo (<dan@opscode.com>)
|
4
|
-
# Copyright:: Copyright (c) 2010, 2012 Opscode, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
shared_examples_for "a platform introspector" do
|
22
|
-
before(:each) do
|
23
|
-
@platform_hash = {}
|
24
|
-
%w{openbsd freebsd}.each do |x|
|
25
|
-
@platform_hash[x] = {
|
26
|
-
"default" => x,
|
27
|
-
"1.2.3" => "#{x}-1.2.3"
|
28
|
-
}
|
29
|
-
end
|
30
|
-
@platform_hash["debian"] = {["5", "6"] => "debian-5/6", "default" => "debian"}
|
31
|
-
@platform_hash["default"] = "default"
|
32
|
-
|
33
|
-
@platform_family_hash = {
|
34
|
-
"debian" => "debian value",
|
35
|
-
[:rhel, :fedora] => "redhatty value",
|
36
|
-
"suse" => "suse value",
|
37
|
-
:default => "default value"
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
it "returns a default value when there is no known platform" do
|
42
|
-
node = Hash.new
|
43
|
-
platform_introspector.value_for_platform(@platform_hash).should == "default"
|
44
|
-
end
|
45
|
-
|
46
|
-
it "returns a default value when there is no known platform family" do
|
47
|
-
platform_introspector.value_for_platform_family(@platform_family_hash).should == "default value"
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns a default value when the current platform doesn't match" do
|
51
|
-
node.automatic_attrs[:platform] = "not-a-known-platform"
|
52
|
-
platform_introspector.value_for_platform(@platform_hash).should == "default"
|
53
|
-
end
|
54
|
-
|
55
|
-
it "returns a default value when current platform_family doesn't match" do
|
56
|
-
node.automatic_attrs[:platform_family] = "ultra-derived-linux"
|
57
|
-
platform_introspector.value_for_platform_family(@platform_family_hash).should == "default value"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns a value based on the current platform" do
|
61
|
-
node.automatic_attrs[:platform] = "openbsd"
|
62
|
-
platform_introspector.value_for_platform(@platform_hash).should == "openbsd"
|
63
|
-
end
|
64
|
-
|
65
|
-
it "returns a value based on the current platform family" do
|
66
|
-
node.automatic_attrs[:platform_family] = "debian"
|
67
|
-
platform_introspector.value_for_platform_family(@platform_family_hash).should == "debian value"
|
68
|
-
end
|
69
|
-
|
70
|
-
it "returns a version-specific value based on the current platform" do
|
71
|
-
node.automatic_attrs[:platform] = "openbsd"
|
72
|
-
node.automatic_attrs[:platform_version] = "1.2.3"
|
73
|
-
platform_introspector.value_for_platform(@platform_hash).should == "openbsd-1.2.3"
|
74
|
-
end
|
75
|
-
|
76
|
-
it "returns a value based on the current platform if version not found" do
|
77
|
-
node.automatic_attrs[:platform] = "openbsd"
|
78
|
-
node.automatic_attrs[:platform_version] = "0.0.0"
|
79
|
-
platform_introspector.value_for_platform(@platform_hash).should == "openbsd"
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "when platform versions is an array" do
|
83
|
-
it "returns a version-specific value based on the current platform" do
|
84
|
-
node.automatic_attrs[:platform] = "debian"
|
85
|
-
node.automatic_attrs[:platform_version] = "6"
|
86
|
-
platform_introspector.value_for_platform(@platform_hash).should == "debian-5/6"
|
87
|
-
end
|
88
|
-
|
89
|
-
it "returns a value based on the current platform if version not found" do
|
90
|
-
node.automatic_attrs[:platform] = "debian"
|
91
|
-
node.automatic_attrs[:platform_version] = "0.0.0"
|
92
|
-
platform_introspector.value_for_platform(@platform_hash).should == "debian"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "when checking platform?" do
|
97
|
-
|
98
|
-
it "returns true if the node is a provided platform and platforms are provided as symbols" do
|
99
|
-
node.automatic_attrs[:platform] = 'ubuntu'
|
100
|
-
platform_introspector.platform?([:redhat, :ubuntu]).should == true
|
101
|
-
end
|
102
|
-
|
103
|
-
it "returns true if the node is a provided platform and platforms are provided as strings" do
|
104
|
-
node.automatic_attrs[:platform] = 'ubuntu'
|
105
|
-
platform_introspector.platform?(["redhat", "ubuntu"]).should == true
|
106
|
-
end
|
107
|
-
|
108
|
-
it "returns false if the node is not of the provided platforms" do
|
109
|
-
node.automatic_attrs[:platform] = 'ubuntu'
|
110
|
-
platform_introspector.platform?(:splatlinux).should == false
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "when checking platform_family?" do
|
115
|
-
|
116
|
-
it "returns true if the node is in a provided platform family and families are provided as symbols" do
|
117
|
-
node.automatic_attrs[:platform_family] = 'debian'
|
118
|
-
platform_introspector.platform_family?([:rhel, :debian]).should == true
|
119
|
-
end
|
120
|
-
|
121
|
-
it "returns true if the node is a provided platform and platforms are provided as strings" do
|
122
|
-
node.automatic_attrs[:platform_family] = 'rhel'
|
123
|
-
platform_introspector.platform_family?(["rhel", "debian"]).should == true
|
124
|
-
end
|
125
|
-
|
126
|
-
it "returns false if the node is not of the provided platforms" do
|
127
|
-
node.automatic_attrs[:platform_family] = 'suse'
|
128
|
-
platform_introspector.platform_family?(:splatlinux).should == false
|
129
|
-
end
|
130
|
-
|
131
|
-
it "returns false if the node is not of the provided platforms and platform_family is not set" do
|
132
|
-
platform_introspector.platform_family?(:splatlinux).should == false
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
|
-
# NOTE: this is a regression test for bug CHEF-1514
|
137
|
-
describe "when the value is an array" do
|
138
|
-
before do
|
139
|
-
@platform_hash = {
|
140
|
-
"debian" => { "4.0" => [ :restart, :reload ], "default" => [ :restart, :reload, :status ] },
|
141
|
-
"ubuntu" => { "default" => [ :restart, :reload, :status ] },
|
142
|
-
"centos" => { "default" => [ :restart, :reload, :status ] },
|
143
|
-
"redhat" => { "default" => [ :restart, :reload, :status ] },
|
144
|
-
"fedora" => { "default" => [ :restart, :reload, :status ] },
|
145
|
-
"default" => { "default" => [:restart, :reload ] }}
|
146
|
-
end
|
147
|
-
|
148
|
-
it "returns the correct default for a given platform" do
|
149
|
-
node.automatic_attrs[:platform] = "debian"
|
150
|
-
node.automatic_attrs[:platform_version] = '9000'
|
151
|
-
platform_introspector.value_for_platform(@platform_hash).should == [ :restart, :reload, :status ]
|
152
|
-
end
|
153
|
-
|
154
|
-
it "returns the correct platform+version specific value " do
|
155
|
-
node.automatic_attrs[:platform] = "debian"
|
156
|
-
node.automatic_attrs[:platform_version] = '4.0'
|
157
|
-
platform_introspector.value_for_platform(@platform_hash).should == [:restart, :reload]
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
162
|
-
|