chef-rewind 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/spec/unwind_recipe_spec.rb
CHANGED
@@ -29,10 +29,21 @@ describe Chef::Recipe do
|
|
29
29
|
@recipe.unwind "zen_master[foobar]"
|
30
30
|
|
31
31
|
resources = @run_context.resource_collection.all_resources
|
32
|
-
resources.
|
32
|
+
expect(resources.empty?).to be_truthy
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it 'should only remove the correct resource' do
|
36
|
+
@recipe.zen_master "foobar"
|
37
|
+
@recipe.cat "blanket"
|
38
|
+
@recipe.zen_master "bar"
|
39
|
+
|
40
|
+
@recipe.unwind "cat[blanket]"
|
41
|
+
|
42
|
+
resources = @run_context.resource_collection.all_resources
|
43
|
+
expect(resources.length).to eq 2
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should delete resource completely when unwind is called" do
|
36
47
|
@recipe.zen_master "foo" do
|
37
48
|
action :nothing
|
38
49
|
peace false
|
@@ -52,13 +63,31 @@ describe Chef::Recipe do
|
|
52
63
|
notifies :blowup, "cat[blanket]"
|
53
64
|
end
|
54
65
|
|
55
|
-
|
66
|
+
expect { @runner.converge }.to raise_error(Chef::Provider::Cat::CatError)
|
56
67
|
end
|
57
68
|
|
58
69
|
it "should throw an error when unwinding a nonexistent resource" do
|
59
|
-
|
70
|
+
expect {
|
60
71
|
@recipe.unwind "zen_master[foobar]"
|
61
|
-
|
72
|
+
}.to raise_error(Chef::Exceptions::ResourceNotFound)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should correctly unwind a resource that was defined more than once" do
|
76
|
+
@recipe.zen_master "foo" do
|
77
|
+
peace true
|
78
|
+
end
|
79
|
+
@recipe.cat "blanket"
|
80
|
+
@recipe.zen_master "foo" do
|
81
|
+
peace false
|
82
|
+
end
|
83
|
+
@recipe.zen_master "bar"
|
84
|
+
|
85
|
+
@recipe.unwind "zen_master[foo]"
|
86
|
+
|
87
|
+
%w(zen_master[bar] cat[blanket]).each do |name|
|
88
|
+
resource = @run_context.resource_collection.lookup(name)
|
89
|
+
expect(resource.to_s).to eq(name)
|
90
|
+
end
|
62
91
|
end
|
63
92
|
end
|
64
93
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-rewind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Berry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Monkey patches Chef to allow rewinding and unwinding of existing resources
|
14
14
|
email:
|
@@ -17,63 +17,33 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- .gitignore
|
20
|
+
- ".gitignore"
|
21
|
+
- ".kitchen.yml"
|
22
|
+
- ".travis.yml"
|
23
|
+
- Berksfile
|
21
24
|
- CHANGELOG
|
22
25
|
- Gemfile
|
23
26
|
- LICENSE
|
24
27
|
- README.md
|
25
28
|
- Rakefile
|
26
29
|
- chef-rewind.gemspec
|
30
|
+
- gemfiles/chef-11.gemfile
|
31
|
+
- gemfiles/chef-12.gemfile
|
27
32
|
- lib/chef/rewind.rb
|
28
|
-
- spec/data/cookbooks/
|
29
|
-
- spec/data/cookbooks/
|
30
|
-
- spec/data/cookbooks/
|
31
|
-
- spec/data/cookbooks/
|
32
|
-
- spec/data/cookbooks/
|
33
|
-
- spec/data/cookbooks/
|
34
|
-
- spec/data/cookbooks/java/files/default/java.response
|
35
|
-
- spec/data/cookbooks/openldap/attributes/default.rb
|
36
|
-
- spec/data/cookbooks/openldap/attributes/smokey.rb
|
37
|
-
- spec/data/cookbooks/openldap/definitions/client.rb
|
38
|
-
- spec/data/cookbooks/openldap/definitions/server.rb
|
39
|
-
- spec/data/cookbooks/openldap/files/default/.dotfile
|
40
|
-
- spec/data/cookbooks/openldap/files/default/.ssh/id_rsa
|
41
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir
|
42
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt
|
43
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt
|
44
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile
|
45
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt
|
46
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt
|
47
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/subdir_with_no_file_just_a_subsubdir/the_subsubdir/some_file.txt
|
48
|
-
- spec/data/cookbooks/openldap/recipes/default.rb
|
49
|
-
- spec/data/cookbooks/openldap/recipes/gigantor.rb
|
50
|
-
- spec/data/cookbooks/openldap/recipes/one.rb
|
51
|
-
- spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb
|
52
|
-
- spec/data/cookbooks/openldap/templates/default/openldap_variable_stuff.conf.erb
|
53
|
-
- spec/data/cookbooks/openldap/templates/default/test.erb
|
33
|
+
- spec/data/cookbooks/rewind/Berksfile
|
34
|
+
- spec/data/cookbooks/rewind/README.md
|
35
|
+
- spec/data/cookbooks/rewind/files/default/test/default_test.rb
|
36
|
+
- spec/data/cookbooks/rewind/metadata.rb
|
37
|
+
- spec/data/cookbooks/rewind/recipes/base.rb
|
38
|
+
- spec/data/cookbooks/rewind/recipes/default.rb
|
54
39
|
- spec/rewind_recipe_spec.rb
|
55
40
|
- spec/rewind_resource_spec.rb
|
56
41
|
- spec/spec_helper.rb
|
57
42
|
- spec/support/chef_helpers.rb
|
58
43
|
- spec/support/lib/chef/provider/cat.rb
|
59
|
-
- spec/support/lib/chef/provider/easy.rb
|
60
|
-
- spec/support/lib/chef/provider/snakeoil.rb
|
61
44
|
- spec/support/lib/chef/provider/zen_master.rb
|
62
45
|
- spec/support/lib/chef/resource/cat.rb
|
63
|
-
- spec/support/lib/chef/resource/one_two_three_four.rb
|
64
46
|
- spec/support/lib/chef/resource/zen_master.rb
|
65
|
-
- spec/support/matchers/leak.rb
|
66
|
-
- spec/support/mock/constant.rb
|
67
|
-
- spec/support/mock/platform.rb
|
68
|
-
- spec/support/platform_helpers.rb
|
69
|
-
- spec/support/platforms/prof/gc.rb
|
70
|
-
- spec/support/platforms/prof/win32.rb
|
71
|
-
- spec/support/shared/functional/directory_resource.rb
|
72
|
-
- spec/support/shared/functional/file_resource.rb
|
73
|
-
- spec/support/shared/functional/knife.rb
|
74
|
-
- spec/support/shared/functional/securable_resource.rb
|
75
|
-
- spec/support/shared/unit/api_error_inspector.rb
|
76
|
-
- spec/support/shared/unit/platform_introspector.rb
|
77
47
|
- spec/unwind_recipe_spec.rb
|
78
48
|
homepage: ''
|
79
49
|
licenses: []
|
@@ -84,69 +54,33 @@ require_paths:
|
|
84
54
|
- lib
|
85
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
56
|
requirements:
|
87
|
-
- -
|
57
|
+
- - ">="
|
88
58
|
- !ruby/object:Gem::Version
|
89
59
|
version: '0'
|
90
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
61
|
requirements:
|
92
|
-
- -
|
62
|
+
- - ">="
|
93
63
|
- !ruby/object:Gem::Version
|
94
64
|
version: '0'
|
95
65
|
requirements: []
|
96
66
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.2.2
|
98
68
|
signing_key:
|
99
69
|
specification_version: 4
|
100
70
|
summary: Monkey patches Chef to allow rewinding and unwinding of existing resources
|
101
71
|
test_files:
|
102
|
-
- spec/data/cookbooks/
|
103
|
-
- spec/data/cookbooks/
|
104
|
-
- spec/data/cookbooks/
|
105
|
-
- spec/data/cookbooks/
|
106
|
-
- spec/data/cookbooks/
|
107
|
-
- spec/data/cookbooks/
|
108
|
-
- spec/data/cookbooks/java/files/default/java.response
|
109
|
-
- spec/data/cookbooks/openldap/attributes/default.rb
|
110
|
-
- spec/data/cookbooks/openldap/attributes/smokey.rb
|
111
|
-
- spec/data/cookbooks/openldap/definitions/client.rb
|
112
|
-
- spec/data/cookbooks/openldap/definitions/server.rb
|
113
|
-
- spec/data/cookbooks/openldap/files/default/.dotfile
|
114
|
-
- spec/data/cookbooks/openldap/files/default/.ssh/id_rsa
|
115
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir
|
116
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt
|
117
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt
|
118
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile
|
119
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt
|
120
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt
|
121
|
-
- spec/data/cookbooks/openldap/files/default/remotedir/subdir_with_no_file_just_a_subsubdir/the_subsubdir/some_file.txt
|
122
|
-
- spec/data/cookbooks/openldap/recipes/default.rb
|
123
|
-
- spec/data/cookbooks/openldap/recipes/gigantor.rb
|
124
|
-
- spec/data/cookbooks/openldap/recipes/one.rb
|
125
|
-
- spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb
|
126
|
-
- spec/data/cookbooks/openldap/templates/default/openldap_variable_stuff.conf.erb
|
127
|
-
- spec/data/cookbooks/openldap/templates/default/test.erb
|
72
|
+
- spec/data/cookbooks/rewind/Berksfile
|
73
|
+
- spec/data/cookbooks/rewind/README.md
|
74
|
+
- spec/data/cookbooks/rewind/files/default/test/default_test.rb
|
75
|
+
- spec/data/cookbooks/rewind/metadata.rb
|
76
|
+
- spec/data/cookbooks/rewind/recipes/base.rb
|
77
|
+
- spec/data/cookbooks/rewind/recipes/default.rb
|
128
78
|
- spec/rewind_recipe_spec.rb
|
129
79
|
- spec/rewind_resource_spec.rb
|
130
80
|
- spec/spec_helper.rb
|
131
81
|
- spec/support/chef_helpers.rb
|
132
82
|
- spec/support/lib/chef/provider/cat.rb
|
133
|
-
- spec/support/lib/chef/provider/easy.rb
|
134
|
-
- spec/support/lib/chef/provider/snakeoil.rb
|
135
83
|
- spec/support/lib/chef/provider/zen_master.rb
|
136
84
|
- spec/support/lib/chef/resource/cat.rb
|
137
|
-
- spec/support/lib/chef/resource/one_two_three_four.rb
|
138
85
|
- spec/support/lib/chef/resource/zen_master.rb
|
139
|
-
- spec/support/matchers/leak.rb
|
140
|
-
- spec/support/mock/constant.rb
|
141
|
-
- spec/support/mock/platform.rb
|
142
|
-
- spec/support/platform_helpers.rb
|
143
|
-
- spec/support/platforms/prof/gc.rb
|
144
|
-
- spec/support/platforms/prof/win32.rb
|
145
|
-
- spec/support/shared/functional/directory_resource.rb
|
146
|
-
- spec/support/shared/functional/file_resource.rb
|
147
|
-
- spec/support/shared/functional/knife.rb
|
148
|
-
- spec/support/shared/functional/securable_resource.rb
|
149
|
-
- spec/support/shared/unit/api_error_inspector.rb
|
150
|
-
- spec/support/shared/unit/platform_introspector.rb
|
151
86
|
- spec/unwind_recipe_spec.rb
|
152
|
-
has_rdoc:
|
@@ -1,16 +0,0 @@
|
|
1
|
-
chef_env ||= nil
|
2
|
-
case chef_env
|
3
|
-
when "prod"
|
4
|
-
default[:ldap_server] = "ops1prod"
|
5
|
-
default[:ldap_basedn] = "dc=hjksolutions,dc=com"
|
6
|
-
default[:ldap_replication_password] = "yes"
|
7
|
-
when "corp"
|
8
|
-
default[:ldap_server] = "ops1prod"
|
9
|
-
default[:ldap_basedn] = "dc=hjksolutions,dc=com"
|
10
|
-
default[:ldap_replication_password] = "yougotit"
|
11
|
-
else
|
12
|
-
|
13
|
-
default[:ldap_server] = "ops1prod"
|
14
|
-
default[:ldap_basedn] = "dc=hjksolutions,dc=com"
|
15
|
-
default[:ldap_replication_password] = "forsure"
|
16
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
default[:smokey] = "robinson"
|
@@ -1 +0,0 @@
|
|
1
|
-
I am here to test .dotfiles work in file directories.
|
@@ -1 +0,0 @@
|
|
1
|
-
FAKE KEY
|
@@ -1 +0,0 @@
|
|
1
|
-
this is a dotfile in a dotdir
|
@@ -1 +0,0 @@
|
|
1
|
-
this is a file with a name beginning with a . dot
|
@@ -1,15 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Nodes should have a unique name
|
3
|
-
##
|
4
|
-
name "test.example.com-default"
|
5
|
-
|
6
|
-
##
|
7
|
-
# Nodes can set arbitrary arguments
|
8
|
-
##
|
9
|
-
sunshine "in"
|
10
|
-
something "else"
|
11
|
-
|
12
|
-
##
|
13
|
-
# Nodes should have recipes
|
14
|
-
##
|
15
|
-
recipes "operations-master", "operations-monitoring"
|
@@ -1 +0,0 @@
|
|
1
|
-
slappiness is <%= node[:slappiness] -%>
|
@@ -1 +0,0 @@
|
|
1
|
-
super secret is <%= @secret -%>
|
@@ -1 +0,0 @@
|
|
1
|
-
We could be diving for pearls!
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 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
|
-
class Chef
|
20
|
-
class Provider
|
21
|
-
class Easy < Chef::Provider
|
22
|
-
def load_current_resource
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
def action_sell
|
27
|
-
true
|
28
|
-
end
|
29
|
-
|
30
|
-
def action_buy
|
31
|
-
true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 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
|
-
class Chef
|
20
|
-
class Provider
|
21
|
-
class SnakeOil < Chef::Provider
|
22
|
-
def load_current_resource
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
def action_purr
|
27
|
-
@new_resource.updated_by_last_action(true)
|
28
|
-
true
|
29
|
-
end
|
30
|
-
|
31
|
-
def action_sell
|
32
|
-
true
|
33
|
-
end
|
34
|
-
|
35
|
-
def action_buy
|
36
|
-
true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|