chef 10.16.0 → 10.16.2

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.
Files changed (61) hide show
  1. data/distro/common/html/chef-client.8.html +3 -3
  2. data/distro/common/html/chef-expander.8.html +3 -3
  3. data/distro/common/html/chef-expanderctl.8.html +3 -3
  4. data/distro/common/html/chef-server-webui.8.html +3 -3
  5. data/distro/common/html/chef-server.8.html +3 -3
  6. data/distro/common/html/chef-solo.8.html +3 -3
  7. data/distro/common/html/chef-solr.8.html +3 -3
  8. data/distro/common/html/knife-bootstrap.1.html +3 -3
  9. data/distro/common/html/knife-client.1.html +4 -4
  10. data/distro/common/html/knife-configure.1.html +4 -4
  11. data/distro/common/html/knife-cookbook-site.1.html +3 -3
  12. data/distro/common/html/knife-cookbook.1.html +3 -3
  13. data/distro/common/html/knife-data-bag.1.html +3 -3
  14. data/distro/common/html/knife-environment.1.html +6 -6
  15. data/distro/common/html/knife-exec.1.html +4 -4
  16. data/distro/common/html/knife-index.1.html +4 -4
  17. data/distro/common/html/knife-node.1.html +4 -4
  18. data/distro/common/html/knife-role.1.html +6 -6
  19. data/distro/common/html/knife-search.1.html +3 -3
  20. data/distro/common/html/knife-ssh.1.html +3 -3
  21. data/distro/common/html/knife-status.1.html +3 -3
  22. data/distro/common/html/knife-tag.1.html +3 -3
  23. data/distro/common/html/knife.1.html +0 -320
  24. data/distro/common/html/shef.1.html +3 -3
  25. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  26. data/distro/common/man/man1/knife-client.1 +1 -1
  27. data/distro/common/man/man1/knife-configure.1 +1 -1
  28. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  30. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  31. data/distro/common/man/man1/knife-environment.1 +1 -1
  32. data/distro/common/man/man1/knife-exec.1 +1 -1
  33. data/distro/common/man/man1/knife-index.1 +1 -1
  34. data/distro/common/man/man1/knife-node.1 +1 -1
  35. data/distro/common/man/man1/knife-role.1 +1 -1
  36. data/distro/common/man/man1/knife-search.1 +1 -1
  37. data/distro/common/man/man1/knife-ssh.1 +1 -1
  38. data/distro/common/man/man1/knife-status.1 +1 -1
  39. data/distro/common/man/man1/knife-tag.1 +1 -1
  40. data/distro/common/man/man1/knife.1 +1 -1
  41. data/distro/common/man/man1/shef.1 +1 -1
  42. data/distro/common/man/man8/chef-client.8 +1 -1
  43. data/distro/common/man/man8/chef-expander.8 +1 -1
  44. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  45. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  46. data/distro/common/man/man8/chef-server.8 +1 -1
  47. data/distro/common/man/man8/chef-solo.8 +1 -1
  48. data/distro/common/man/man8/chef-solr.8 +1 -1
  49. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +6 -0
  50. data/lib/chef/knife/cookbook_site_install.rb +10 -1
  51. data/lib/chef/provider/cookbook_file.rb +0 -3
  52. data/lib/chef/provider/file.rb +21 -4
  53. data/lib/chef/provider/remote_directory.rb +24 -15
  54. data/lib/chef/version.rb +1 -1
  55. data/spec/functional/resource/cookbook_file_spec.rb +51 -0
  56. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +31 -1
  57. data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +2 -0
  58. data/spec/unit/provider/directory_spec.rb +72 -66
  59. data/spec/unit/provider/file_spec.rb +72 -66
  60. data/spec/unit/provider/remote_directory_spec.rb +7 -0
  61. metadata +5 -4
@@ -79,6 +79,8 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
79
79
  end
80
80
 
81
81
  it "sets updated_by_last_action on the new resource" do
82
+ @provider.new_resource.owner(0) # CHEF-3557 hack - Set these because we don't for windows
83
+ @provider.new_resource.group(0) # CHEF-3557 hack - Set these because we don't for windows
82
84
  @provider.new_resource.should_receive(:updated_by_last_action)
83
85
  Chef::FileAccessControl.any_instance.stub(:set_all)
84
86
  @provider.run_action(:create)
@@ -33,74 +33,80 @@ describe Chef::Provider::Directory do
33
33
  @directory = Chef::Provider::Directory.new(@new_resource, @run_context)
34
34
  end
35
35
 
36
- it "should load the current resource based on the new resource" do
37
- File.stub!(:exist?).and_return(true)
38
- cstats = mock("stats")
39
- cstats.stub!(:uid).and_return(500)
40
- cstats.stub!(:gid).and_return(500)
41
- cstats.stub!(:mode).and_return(0755)
42
- File.should_receive(:stat).twice.and_return(cstats)
43
- @directory.load_current_resource
44
- @directory.current_resource.path.should eql(@new_resource.path)
45
- @directory.current_resource.owner.should eql(500)
46
- @directory.current_resource.group.should eql(500)
47
- @directory.current_resource.mode.should == 00755
48
- end
49
-
50
- it "should create a new directory on create, setting updated to true" do
51
- @new_resource.path "/tmp/foo"
52
-
53
- File.should_receive(:exist?).exactly(3).and_return(false)
54
- Dir.should_receive(:mkdir).with(@new_resource.path).once.and_return(true)
55
-
56
- @directory.should_receive(:set_all_access_controls)
57
- @directory.stub!(:update_new_file_state)
58
- @directory.run_action(:create)
59
- @directory.new_resource.should be_updated
60
- end
61
-
62
- it "should raise an exception if the parent directory does not exist and recursive is false" do
63
- @new_resource.path "/tmp/some/dir"
64
- @new_resource.recursive false
65
- lambda { @directory.run_action(:create) }.should raise_error(Chef::Exceptions::EnclosingDirectoryDoesNotExist)
66
- end
67
-
68
- it "should create a new directory when parent directory does not exist if recursive is true and permissions are correct" do
69
- @new_resource.path "/path/to/dir"
70
- @new_resource.recursive true
71
- File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
72
- File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
73
-
74
- File.should_receive(:exist?).with('/path/to').ordered.and_return(false)
75
- File.should_receive(:exist?).with('/path').ordered.and_return(true)
76
- File.should_receive(:writable?).with('/path').ordered.and_return(true)
77
- File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
78
-
79
- FileUtils.should_receive(:mkdir_p).with(@new_resource.path).and_return(true)
80
- @directory.should_receive(:set_all_access_controls)
81
- @directory.stub!(:update_new_file_state)
82
- @directory.run_action(:create)
83
- @new_resource.should be_updated
84
- end
85
-
86
- # it "should raise an error when creating a directory recursively and permissions do not allow creation" do
36
+ context "load_current_resource_attrs", :unix_only do
37
+ it "should load the current resource based on the new resource" do
38
+ File.stub!(:exist?).and_return(true)
39
+ cstats = mock("stats")
40
+ cstats.stub!(:uid).and_return(500)
41
+ cstats.stub!(:gid).and_return(500)
42
+ cstats.stub!(:mode).and_return(0755)
43
+ File.should_receive(:stat).twice.and_return(cstats)
44
+ @directory.load_current_resource
45
+ @directory.current_resource.path.should eql(@new_resource.path)
46
+ @directory.current_resource.owner.should eql(500)
47
+ @directory.current_resource.group.should eql(500)
48
+ @directory.current_resource.mode.should == 00755
49
+ end
50
+
51
+ it "should create a new directory on create, setting updated to true" do
52
+ @new_resource.path "/tmp/foo"
53
+
54
+ File.should_receive(:exist?).exactly(3).and_return(false)
55
+ Dir.should_receive(:mkdir).with(@new_resource.path).once.and_return(true)
56
+
57
+ @directory.should_receive(:set_all_access_controls)
58
+ @directory.stub!(:update_new_file_state)
59
+ @directory.run_action(:create)
60
+ @directory.new_resource.should be_updated
61
+ end
62
+
63
+ it "should raise an exception if the parent directory does not exist and recursive is false" do
64
+ @new_resource.path "/tmp/some/dir"
65
+ @new_resource.recursive false
66
+ lambda { @directory.run_action(:create) }.should raise_error(Chef::Exceptions::EnclosingDirectoryDoesNotExist)
67
+ end
68
+
69
+ it "should create a new directory when parent directory does not exist if recursive is true and permissions are correct" do
70
+ @new_resource.path "/path/to/dir"
71
+ @new_resource.recursive true
72
+ File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
73
+ File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
74
+
75
+ File.should_receive(:exist?).with('/path/to').ordered.and_return(false)
76
+ File.should_receive(:exist?).with('/path').ordered.and_return(true)
77
+ File.should_receive(:writable?).with('/path').ordered.and_return(true)
78
+ File.should_receive(:exist?).with(@new_resource.path).ordered.and_return(false)
79
+
80
+ FileUtils.should_receive(:mkdir_p).with(@new_resource.path).and_return(true)
81
+ @directory.should_receive(:set_all_access_controls)
82
+ @directory.stub!(:update_new_file_state)
83
+ @directory.run_action(:create)
84
+ @new_resource.should be_updated
85
+ end
86
+
87
+ # it "should raise an error when creating a directory recursively and permissions do not allow creation" do
88
+
89
+ # end
90
+
91
+ it "should raise an error when creating a directory when parent directory is a file" do
92
+ File.should_receive(:directory?).and_return(false)
93
+ Dir.should_not_receive(:mkdir).with(@new_resource.path)
94
+ lambda { @directory.run_action(:create) }.should raise_error(Chef::Exceptions::EnclosingDirectoryDoesNotExist)
95
+ @directory.new_resource.should_not be_updated
96
+ end
87
97
 
88
- # end
89
-
90
- it "should raise an error when creating a directory when parent directory is a file" do
91
- File.should_receive(:directory?).and_return(false)
92
- Dir.should_not_receive(:mkdir).with(@new_resource.path)
93
- lambda { @directory.run_action(:create) }.should raise_error(Chef::Exceptions::EnclosingDirectoryDoesNotExist)
94
- @directory.new_resource.should_not be_updated
98
+ it "should not create the directory if it already exists" do
99
+ stub_file_cstats
100
+ @new_resource.path "/tmp/foo"
101
+ File.should_receive(:exist?).exactly(3).and_return(true)
102
+ Dir.should_not_receive(:mkdir).with(@new_resource.path)
103
+ @directory.should_receive(:set_all_access_controls)
104
+ @directory.run_action(:create)
105
+ end
95
106
  end
96
-
97
- it "should not create the directory if it already exists" do
98
- stub_file_cstats
99
- @new_resource.path "/tmp/foo"
100
- File.should_receive(:exist?).exactly(3).and_return(true)
101
- Dir.should_not_receive(:mkdir).with(@new_resource.path)
102
- @directory.should_receive(:set_all_access_controls)
103
- @directory.run_action(:create)
107
+
108
+ context "load_current_resource_attrs", :windows_only do
109
+ pending "CHEF-3557: Fix implicit resource change collection on Windows"
104
110
  end
105
111
 
106
112
  it "should delete the directory if it exists, and is writable with action_delete" do
@@ -53,76 +53,82 @@ describe Chef::Provider::File do
53
53
  @provider.current_resource.content.should eql(nil)
54
54
  end
55
55
 
56
- it "should collect the current state of the file on the filesystem and populate current_resource" do
57
- # test setup
58
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
59
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
60
-
61
- # test execution
62
- @provider.load_current_resource
63
-
64
- # post-condition checks
65
- @provider.current_resource.mode.should == 0600
66
- @provider.current_resource.owner.should == 0
67
- @provider.current_resource.group.should == 0
68
- end
69
-
70
- it "should NOT update the new_resource state with the current_resourse state if new_resource state is already specified" do
71
- # test setup
72
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
73
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
74
-
75
- @provider.new_resource.group(1)
76
- @provider.new_resource.owner(1)
77
- @provider.new_resource.mode(0644)
78
-
79
- # test execution
80
- @provider.load_current_resource
81
-
82
- # post-condition checks
83
- @provider.new_resource.group.should == 1
84
- @provider.new_resource.owner.should == 1
85
- @provider.new_resource.mode.should == 0644
56
+ context "load_current_resource_attrs", :unix_only do
57
+ it "should collect the current state of the file on the filesystem and populate current_resource" do
58
+ # test setup
59
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
60
+ ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
61
+
62
+ # test execution
63
+ @provider.load_current_resource
64
+
65
+ # post-condition checks
66
+ @provider.current_resource.mode.should == 0600
67
+ @provider.current_resource.owner.should == 0
68
+ @provider.current_resource.group.should == 0
69
+ end
70
+
71
+ it "should NOT update the new_resource state with the current_resourse state if new_resource state is already specified" do
72
+ # test setup
73
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
74
+ ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
75
+
76
+ @provider.new_resource.group(1)
77
+ @provider.new_resource.owner(1)
78
+ @provider.new_resource.mode(0644)
79
+
80
+ # test execution
81
+ @provider.load_current_resource
82
+
83
+ # post-condition checks
84
+ @provider.new_resource.group.should == 1
85
+ @provider.new_resource.owner.should == 1
86
+ @provider.new_resource.mode.should == 0644
87
+ end
88
+
89
+ it "should update the new_resource state with the current_resource state if the new_resource state is not specified." do
90
+ # test setup
91
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
92
+ ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
93
+
94
+ @provider.new_resource.group(nil)
95
+ @provider.new_resource.owner(nil)
96
+ @provider.new_resource.mode(nil)
97
+
98
+ # test execution
99
+ @provider.load_current_resource
100
+
101
+ # post-condition checks
102
+ @provider.new_resource.group.should eql(@provider.current_resource.group)
103
+ @provider.new_resource.owner.should eql(@provider.current_resource.owner)
104
+ @provider.new_resource.mode.should eql(@provider.current_resource.mode)
105
+ end
106
+
107
+ it "should update the new_resource when attempting to set the new state" do
108
+ # test setup
109
+ stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
110
+ # called once in update_new_file_state and once in checksum
111
+ ::File.should_receive(:stat).twice.with(@provider.new_resource.path).and_return(stat_struct)
112
+ ::File.should_receive(:directory?).once.with(@provider.new_resource.path).and_return(false)
113
+
114
+ @provider.new_resource.group(nil)
115
+ @provider.new_resource.owner(nil)
116
+ @provider.new_resource.mode(nil)
117
+
118
+ # test exectution
119
+ @provider.update_new_file_state
120
+
121
+ # post-condition checks
122
+ @provider.new_resource.group.should == 0
123
+ @provider.new_resource.owner.should == 0
124
+ @provider.new_resource.mode.should == 0600
125
+ end
86
126
  end
87
127
 
88
- it "should update the new_resource state with the current_resource state if the new_resource state is not specified." do
89
- # test setup
90
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
91
- ::File.should_receive(:stat).exactly(3).with(@resource.path).and_return(stat_struct)
92
-
93
- @provider.new_resource.group(nil)
94
- @provider.new_resource.owner(nil)
95
- @provider.new_resource.mode(nil)
96
-
97
- # test execution
98
- @provider.load_current_resource
99
-
100
- # post-condition checks
101
- @provider.new_resource.group.should eql(@provider.current_resource.group)
102
- @provider.new_resource.owner.should eql(@provider.current_resource.owner)
103
- @provider.new_resource.mode.should eql(@provider.current_resource.mode)
128
+ context "load_current_resource_attrs", :windows_only do
129
+ pending "CHEF-3557: Fix implicit resource change collection on Windows"
104
130
  end
105
131
 
106
- it "should update the new_resource when attempting to set the new state" do
107
- # test setup
108
- stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
109
- # called once in update_new_file_state and once in checksum
110
- ::File.should_receive(:stat).twice.with(@provider.new_resource.path).and_return(stat_struct)
111
- ::File.should_receive(:directory?).once.with(@provider.new_resource.path).and_return(false)
112
-
113
- @provider.new_resource.group(nil)
114
- @provider.new_resource.owner(nil)
115
- @provider.new_resource.mode(nil)
116
-
117
- # test exectution
118
- @provider.update_new_file_state
119
-
120
- # post-condition checks
121
- @provider.new_resource.group.should == 0
122
- @provider.new_resource.owner.should == 0
123
- @provider.new_resource.mode.should == 0600
124
- end
125
-
126
132
  it "should load a mostly blank current resource if the file specified in new_resource doesn't exist/isn't readable" do
127
133
  resource = Chef::Resource::File.new("seattle")
128
134
  resource.path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates", "woot.txt")))
@@ -98,6 +98,13 @@ describe Chef::Provider::RemoteDirectory do
98
98
 
99
99
  after {FileUtils.rm_rf(@destination_dir)}
100
100
 
101
+ # CHEF-3552
102
+ it "creates the toplevel directory without error " do
103
+ @resource.recursive(false)
104
+ @provider.run_action(:create)
105
+ ::File.exist?(@destination_dir).should be_true
106
+ end
107
+
101
108
  it "transfers the directory with all contents" do
102
109
  @provider.run_action(:create)
103
110
  ::File.exist?(@destination_dir + '/remote_dir_file1.txt').should be_true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 10
8
8
  - 16
9
- - 0
10
- version: 10.16.0
9
+ - 2
10
+ version: 10.16.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Jacob
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-22 00:00:00 Z
18
+ date: 2012-10-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mixlib-config
@@ -1383,6 +1383,7 @@ files:
1383
1383
  - spec/functional/knife/exec_spec.rb
1384
1384
  - spec/functional/knife/ssh_spec.rb
1385
1385
  - spec/functional/resource/file_spec.rb
1386
+ - spec/functional/resource/cookbook_file_spec.rb
1386
1387
  - spec/functional/resource/link_spec.rb
1387
1388
  - spec/functional/resource/remote_directory_spec.rb
1388
1389
  - spec/functional/resource/template_spec.rb