chef 11.6.0.hotfix.1 → 11.6.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +15 -0
  2. data/distro/common/html/chef-client.8.html +4 -4
  3. data/distro/common/html/chef-expander.8.html +4 -4
  4. data/distro/common/html/chef-expanderctl.8.html +4 -4
  5. data/distro/common/html/chef-server-webui.8.html +4 -4
  6. data/distro/common/html/chef-server.8.html +4 -4
  7. data/distro/common/html/chef-shell.1.html +4 -4
  8. data/distro/common/html/chef-solo.8.html +4 -4
  9. data/distro/common/html/chef-solr.8.html +4 -4
  10. data/distro/common/html/knife-bootstrap.1.html +4 -4
  11. data/distro/common/html/knife-client.1.html +4 -4
  12. data/distro/common/html/knife-configure.1.html +4 -4
  13. data/distro/common/html/knife-cookbook-site.1.html +4 -4
  14. data/distro/common/html/knife-cookbook.1.html +4 -4
  15. data/distro/common/html/knife-data-bag.1.html +4 -4
  16. data/distro/common/html/knife-environment.1.html +4 -4
  17. data/distro/common/html/knife-exec.1.html +4 -4
  18. data/distro/common/html/knife-index.1.html +4 -4
  19. data/distro/common/html/knife-node.1.html +4 -4
  20. data/distro/common/html/knife-role.1.html +4 -4
  21. data/distro/common/html/knife-search.1.html +4 -4
  22. data/distro/common/html/knife-ssh.1.html +4 -4
  23. data/distro/common/html/knife-status.1.html +4 -4
  24. data/distro/common/html/knife-tag.1.html +4 -4
  25. data/distro/common/html/knife.1.html +4 -4
  26. data/distro/common/man/man1/chef-shell.1 +1 -1
  27. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  28. data/distro/common/man/man1/knife-client.1 +1 -1
  29. data/distro/common/man/man1/knife-configure.1 +1 -1
  30. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  31. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  32. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  33. data/distro/common/man/man1/knife-environment.1 +1 -1
  34. data/distro/common/man/man1/knife-exec.1 +1 -1
  35. data/distro/common/man/man1/knife-index.1 +1 -1
  36. data/distro/common/man/man1/knife-node.1 +1 -1
  37. data/distro/common/man/man1/knife-role.1 +1 -1
  38. data/distro/common/man/man1/knife-search.1 +1 -1
  39. data/distro/common/man/man1/knife-ssh.1 +1 -1
  40. data/distro/common/man/man1/knife-status.1 +1 -1
  41. data/distro/common/man/man1/knife-tag.1 +1 -1
  42. data/distro/common/man/man1/knife.1 +1 -1
  43. data/distro/common/man/man8/chef-client.8 +1 -1
  44. data/distro/common/man/man8/chef-expander.8 +1 -1
  45. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  46. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  47. data/distro/common/man/man8/chef-server.8 +1 -1
  48. data/distro/common/man/man8/chef-solo.8 +1 -1
  49. data/distro/common/man/man8/chef-solr.8 +1 -1
  50. data/lib/chef/application/client.rb +2 -0
  51. data/lib/chef/application/solo.rb +1 -0
  52. data/lib/chef/application/windows_service.rb +1 -0
  53. data/lib/chef/client.rb +6 -28
  54. data/lib/chef/config.rb +1 -1
  55. data/lib/chef/cookbook/cookbook_version_loader.rb +19 -10
  56. data/lib/chef/cookbook/file_system_file_vendor.rb +7 -4
  57. data/lib/chef/cookbook/metadata.rb +10 -1
  58. data/lib/chef/cookbook/syntax_check.rb +4 -4
  59. data/lib/chef/cookbook_uploader.rb +1 -1
  60. data/lib/chef/cookbook_version.rb +10 -6
  61. data/lib/chef/deprecation/provider/template.rb +1 -1
  62. data/lib/chef/exceptions.rb +0 -2
  63. data/lib/chef/formatters/error_descriptor.rb +4 -5
  64. data/lib/chef/knife/cookbook_site_share.rb +0 -1
  65. data/lib/chef/knife/cookbook_test.rb +0 -1
  66. data/lib/chef/provider/file.rb +1 -2
  67. data/lib/chef/provider/package/yum.rb +1 -2
  68. data/lib/chef/provider/remote_file/cache_control_data.rb +6 -12
  69. data/lib/chef/resource/file.rb +0 -2
  70. data/lib/chef/resource_reporter.rb +2 -5
  71. data/lib/chef/scan_access_control.rb +1 -6
  72. data/lib/chef/util/diff.rb +5 -31
  73. data/lib/chef/version.rb +1 -1
  74. data/lib/chef/win32/api/file.rb +0 -7
  75. data/spec/data/cookbooks/not-nginx/attributes/default.rb +1 -0
  76. data/spec/data/cookbooks/not-nginx/metadata.rb +1 -0
  77. data/spec/data/kitchen/no-really-not-nginx/attributes/default.rb +1 -0
  78. data/spec/data/kitchen/no-really-not-nginx/metadata.rb +1 -0
  79. data/spec/functional/knife/exec_spec.rb +2 -2
  80. data/spec/functional/resource/user_spec.rb +14 -6
  81. data/spec/spec_helper.rb +0 -32
  82. data/spec/support/platform_helpers.rb +0 -12
  83. data/spec/support/shared/functional/file_resource.rb +10 -87
  84. data/spec/support/shared/unit/provider/file.rb +2 -4
  85. data/spec/unit/cookbook/metadata_spec.rb +56 -50
  86. data/spec/unit/cookbook_loader_spec.rb +22 -1
  87. data/spec/unit/provider/package/rubygems_spec.rb +1 -1
  88. data/spec/unit/provider/package/yum_spec.rb +36 -17
  89. data/spec/unit/provider/remote_file/cache_control_data_spec.rb +0 -50
  90. data/spec/unit/resource_reporter_spec.rb +1 -52
  91. data/spec/unit/scan_access_control_spec.rb +2 -4
  92. data/spec/unit/util/diff_spec.rb +11 -351
  93. metadata +9 -93
  94. data/spec/data/apt/chef-integration-test-1.0/debian/changelog +0 -5
  95. data/spec/data/apt/chef-integration-test-1.0/debian/compat +0 -1
  96. data/spec/data/apt/chef-integration-test-1.0/debian/control +0 -13
  97. data/spec/data/apt/chef-integration-test-1.0/debian/copyright +0 -34
  98. data/spec/data/apt/chef-integration-test-1.0/debian/files +0 -1
  99. data/spec/data/apt/chef-integration-test-1.0/debian/rules +0 -13
  100. data/spec/data/apt/chef-integration-test-1.0/debian/source/format +0 -1
  101. data/spec/data/apt/chef-integration-test-1.1/debian/changelog +0 -11
  102. data/spec/data/apt/chef-integration-test-1.1/debian/compat +0 -1
  103. data/spec/data/apt/chef-integration-test-1.1/debian/control +0 -13
  104. data/spec/data/apt/chef-integration-test-1.1/debian/copyright +0 -34
  105. data/spec/data/apt/chef-integration-test-1.1/debian/files +0 -1
  106. data/spec/data/apt/chef-integration-test-1.1/debian/rules +0 -13
  107. data/spec/data/apt/chef-integration-test-1.1/debian/source/format +0 -1
  108. data/spec/data/apt/chef-integration-test_1.0-1_amd64.changes +0 -22
  109. data/spec/data/apt/chef-integration-test_1.0-1_amd64.deb +0 -0
  110. data/spec/data/apt/chef-integration-test_1.0.orig.tar.gz +0 -0
  111. data/spec/data/apt/chef-integration-test_1.1-1_amd64.changes +0 -22
  112. data/spec/data/apt/chef-integration-test_1.1-1_amd64.deb +0 -0
  113. data/spec/data/apt/chef-integration-test_1.1.orig.tar.gz +0 -0
  114. data/spec/data/apt/var/www/apt/conf/distributions +0 -7
  115. data/spec/data/apt/var/www/apt/conf/incoming +0 -4
  116. data/spec/data/apt/var/www/apt/conf/pulls +0 -3
  117. data/spec/data/apt/var/www/apt/db/checksums.db +0 -0
  118. data/spec/data/apt/var/www/apt/db/contents.cache.db +0 -0
  119. data/spec/data/apt/var/www/apt/db/packages.db +0 -0
  120. data/spec/data/apt/var/www/apt/db/references.db +0 -0
  121. data/spec/data/apt/var/www/apt/db/release.caches.db +0 -0
  122. data/spec/data/apt/var/www/apt/db/version +0 -4
  123. data/spec/data/apt/var/www/apt/dists/sid/Release +0 -19
  124. data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +0 -16
  125. data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +0 -0
  126. data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +0 -5
  127. data/spec/data/apt/var/www/apt/dists/sid/main/binary-i386/Packages +0 -0
  128. data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +0 -0
  129. data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +0 -0
  130. data/spec/data/cookbooks/preseed/files/default/preseed-file.seed +0 -1
  131. data/spec/data/cookbooks/preseed/templates/default/preseed-template.seed +0 -1
  132. data/spec/functional/provider/remote_file/cache_control_data_spec.rb +0 -101
  133. data/spec/functional/resource/package_spec.rb +0 -297
@@ -1,5 +0,0 @@
1
- chef-integration-test (1.0-1) unstable; urgency=low
2
-
3
- * Initial release (Closes: #CHEF-1718)
4
-
5
- -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 09:53:45 -0600
@@ -1,13 +0,0 @@
1
- Source: chef-integration-test
2
- Section: ruby
3
- Priority: extra
4
- Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
5
- Build-Depends: debhelper (>= 7.0.50~)
6
- Standards-Version: 3.8.4
7
- Homepage: http://tickets.opscode.com
8
-
9
- Package: chef-integration-test
10
- Architecture: any
11
- Depends: ${shlibs:Depends}, ${misc:Depends}
12
- Description: Chef integration tests for APT in Cucumber
13
- This package is used for cucumber integration testing in Chef.
@@ -1,34 +0,0 @@
1
- This work was packaged by:
2
-
3
- Joshua Timberman <Joshua Timberman <joshua@opscode.com>> on Thu, 30 Sep 2010 09:53:45 -0600
4
-
5
- Upstream Author(s):
6
-
7
- Opscode, Inc.
8
-
9
- Copyright:
10
-
11
- Copyright (C) 2010 Opscode, Inc
12
-
13
- License:
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License");
16
- you may not use this file except in compliance with the License.
17
- You may obtain a copy of the License at
18
-
19
- http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- Unless required by applicable law or agreed to in writing, software
22
- distributed under the License is distributed on an "AS IS" BASIS,
23
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- See the License for the specific language governing permissions and
25
- limitations under the License.
26
-
27
- The Debian packaging is:
28
-
29
- Copyright (C) 2010 Opscode, Inc (<legal@opscode.com>)
30
-
31
-
32
- and is licensed under the Apache 2.0 license.
33
-
34
- See "/usr/share/common-licenses/Apache-2.0"
@@ -1 +0,0 @@
1
- chef-integration-test_1.0-1_amd64.deb ruby extra
@@ -1,13 +0,0 @@
1
- #!/usr/bin/make -f
2
- # -*- makefile -*-
3
- # Sample debian/rules that uses debhelper.
4
- # This file was originally written by Joey Hess and Craig Small.
5
- # As a special exception, when this file is copied by dh-make into a
6
- # dh-make output file, you may use that output file without restriction.
7
- # This special exception was added by Craig Small in version 0.37 of dh-make.
8
-
9
- # Uncomment this to turn on verbose mode.
10
- #export DH_VERBOSE=1
11
-
12
- %:
13
- dh $@
@@ -1,11 +0,0 @@
1
- chef-integration-test (1.1-1) unstable; urgency=low
2
-
3
- * New upstream release (1.1)
4
-
5
- -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 10:09:34 -0600
6
-
7
- chef-integration-test (1.0-1) unstable; urgency=low
8
-
9
- * Initial release (Closes: #CHEF-1718)
10
-
11
- -- Joshua Timberman <joshua@opscode.com> Thu, 30 Sep 2010 09:53:45 -0600
@@ -1,13 +0,0 @@
1
- Source: chef-integration-test
2
- Section: ruby
3
- Priority: extra
4
- Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
5
- Build-Depends: debhelper (>= 7.0.50~)
6
- Standards-Version: 3.8.4
7
- Homepage: http://tickets.opscode.com
8
-
9
- Package: chef-integration-test
10
- Architecture: any
11
- Depends: ${shlibs:Depends}, ${misc:Depends}
12
- Description: Chef integration tests for APT in Cucumber
13
- This package is used for cucumber integration testing in Chef.
@@ -1,34 +0,0 @@
1
- This work was packaged by:
2
-
3
- Joshua Timberman <Joshua Timberman <joshua@opscode.com>> on Thu, 30 Sep 2010 09:53:45 -0600
4
-
5
- Upstream Author(s):
6
-
7
- Opscode, Inc.
8
-
9
- Copyright:
10
-
11
- Copyright (C) 2010 Opscode, Inc
12
-
13
- License:
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License");
16
- you may not use this file except in compliance with the License.
17
- You may obtain a copy of the License at
18
-
19
- http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- Unless required by applicable law or agreed to in writing, software
22
- distributed under the License is distributed on an "AS IS" BASIS,
23
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- See the License for the specific language governing permissions and
25
- limitations under the License.
26
-
27
- The Debian packaging is:
28
-
29
- Copyright (C) 2010 Opscode, Inc (<legal@opscode.com>)
30
-
31
-
32
- and is licensed under the Apache 2.0 license.
33
-
34
- See "/usr/share/common-licenses/Apache-2.0"
@@ -1 +0,0 @@
1
- chef-integration-test_1.1-1_amd64.deb ruby extra
@@ -1,13 +0,0 @@
1
- #!/usr/bin/make -f
2
- # -*- makefile -*-
3
- # Sample debian/rules that uses debhelper.
4
- # This file was originally written by Joey Hess and Craig Small.
5
- # As a special exception, when this file is copied by dh-make into a
6
- # dh-make output file, you may use that output file without restriction.
7
- # This special exception was added by Craig Small in version 0.37 of dh-make.
8
-
9
- # Uncomment this to turn on verbose mode.
10
- #export DH_VERBOSE=1
11
-
12
- %:
13
- dh $@
@@ -1,22 +0,0 @@
1
- Format: 1.8
2
- Date: Thu, 30 Sep 2010 09:53:45 -0600
3
- Source: chef-integration-test
4
- Binary: chef-integration-test
5
- Architecture: amd64
6
- Version: 1.0-1
7
- Distribution: unstable
8
- Urgency: low
9
- Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
10
- Changed-By: Joshua Timberman <joshua@opscode.com>
11
- Description:
12
- chef-integration-test - Chef integration tests for APT in Cucumber
13
- Changes:
14
- chef-integration-test (1.0-1) unstable; urgency=low
15
- .
16
- * Initial release (Closes: #CHEF-1718)
17
- Checksums-Sha1:
18
- b44685ff59626bc94c67e60665f06c4643fe9767 1680 chef-integration-test_1.0-1_amd64.deb
19
- Checksums-Sha256:
20
- da176f4405fa21fd7207d4785680c6996d395a1ca132f2d5565a61c5479b1116 1680 chef-integration-test_1.0-1_amd64.deb
21
- Files:
22
- 713722480408ecc8e7220aea52bdd76e 1680 ruby extra chef-integration-test_1.0-1_amd64.deb
@@ -1,22 +0,0 @@
1
- Format: 1.8
2
- Date: Thu, 30 Sep 2010 10:09:34 -0600
3
- Source: chef-integration-test
4
- Binary: chef-integration-test
5
- Architecture: amd64
6
- Version: 1.1-1
7
- Distribution: unstable
8
- Urgency: low
9
- Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
10
- Changed-By: Joshua Timberman <joshua@opscode.com>
11
- Description:
12
- chef-integration-test - Chef integration tests for APT in Cucumber
13
- Changes:
14
- chef-integration-test (1.1-1) unstable; urgency=low
15
- .
16
- * New upstream release (1.1)
17
- Checksums-Sha1:
18
- 43c5653a9a5b9419849173a4ec3a9855cf0327a3 1722 chef-integration-test_1.1-1_amd64.deb
19
- Checksums-Sha256:
20
- 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1 1722 chef-integration-test_1.1-1_amd64.deb
21
- Files:
22
- 4b05bace483dbca54efc21f97ee47e1d 1722 ruby extra chef-integration-test_1.1-1_amd64.deb
@@ -1,7 +0,0 @@
1
- Origin: localhost
2
- Label: apt repository
3
- Codename: sid
4
- Architectures: amd64
5
- Components: main
6
- Description: Apt repository
7
- Pull: sid
@@ -1,4 +0,0 @@
1
- Name: default
2
- IncomingDir: /tmp/incoming
3
- TempDir: /tmp
4
- Allow: sid unstable>sid
@@ -1,3 +0,0 @@
1
- Name: sid
2
- From: sid
3
- Components: main
@@ -1,4 +0,0 @@
1
- 4.2.0
2
- 3.3.0
3
- bdb4.8.30
4
- bdb4.8.0
@@ -1,19 +0,0 @@
1
- Origin: localhost
2
- Label: apt repository
3
- Codename: sid
4
- Date: Thu, 30 Sep 2010 16:33:01 UTC
5
- Architectures: amd64
6
- Components: main
7
- Description: Apt repository
8
- MD5Sum:
9
- 92ed2cc14e37e9ab23466b27857d29ac 596 main/binary-amd64/Packages
10
- c7726773341137b71cc971d44ddec4f5 394 main/binary-amd64/Packages.gz
11
- 46cd71c965ce0813c94ef78c836cc7d3 104 main/binary-amd64/Release
12
- SHA1:
13
- cde25071c5fcee59cee8dcd773ca419dcb40d946 596 main/binary-amd64/Packages
14
- ce04daff75d4b27371d691d645282b198045544a 394 main/binary-amd64/Packages.gz
15
- 91ca9531e3afa7a540cabdc6030c6f75d315fec7 104 main/binary-amd64/Release
16
- SHA256:
17
- af601ce143f33405425746462973adc0fda3aceb381d1c739851b95ee0814ca3 596 main/binary-amd64/Packages
18
- 15e98119705a08018d4583caabc91d36ba12e6f1c8af0f799a3ec8ca5bfaa80d 394 main/binary-amd64/Packages.gz
19
- 098c599ac5b0a98785336afb2bc9c47002570ffa07dd62321c6f70b9fdb74325 104 main/binary-amd64/Release
@@ -1,16 +0,0 @@
1
- Package: chef-integration-test
2
- Version: 1.1-1
3
- Architecture: amd64
4
- Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
5
- Installed-Size: 32
6
- Homepage: http://tickets.opscode.com
7
- Priority: extra
8
- Section: ruby
9
- Filename: pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb
10
- Size: 1722
11
- SHA256: 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1
12
- SHA1: 43c5653a9a5b9419849173a4ec3a9855cf0327a3
13
- MD5sum: 4b05bace483dbca54efc21f97ee47e1d
14
- Description: Chef integration tests for APT in Cucumber
15
- This package is used for cucumber integration testing in Chef.
16
-
@@ -1,5 +0,0 @@
1
- Component: main
2
- Origin: localhost
3
- Label: apt repository
4
- Architecture: amd64
5
- Description: Apt repository
@@ -1 +0,0 @@
1
- chef-integration-test chef-integration-test/sample-var string "hello world"
@@ -1 +0,0 @@
1
- chef-integration-test chef-integration-test/sample-var string "<%= node[:preseed_value] -%>"
@@ -1,101 +0,0 @@
1
- #
2
- # Author:: Adam Edwards (<adamed@opscode.com>)
3
- # Copyright:: Copyright (c) 2013 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
- require 'uri'
21
-
22
- describe Chef::Provider::RemoteFile::CacheControlData do
23
-
24
- before do
25
- @original_config = Chef::Config.hash_dup
26
- end
27
-
28
- after do
29
- Chef::Config.configuration = @original_config if @original_config
30
- end
31
-
32
- before(:each) do
33
- Chef::Config[:file_cache_path] = Dir.mktmpdir
34
- end
35
-
36
- after(:each) do
37
- FileUtils.rm_rf(Chef::Config[:file_cache_path])
38
- end
39
-
40
- let(:uri) { URI.parse("http://www.bing.com/robots.txt") }
41
-
42
- describe "when the cache control data save method is invoked" do
43
-
44
- subject(:cache_control_data) do
45
- Chef::Provider::RemoteFile::CacheControlData.load_and_validate(uri, file_checksum)
46
- end
47
-
48
- # the checksum of the file last we fetched it.
49
- let(:file_checksum) { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
50
-
51
- let(:etag) { "\"a-strong-identifier\"" }
52
- let(:mtime) { "Thu, 01 Aug 2013 08:16:32 GMT" }
53
-
54
- before do
55
- cache_control_data.etag = etag
56
- cache_control_data.mtime = mtime
57
- cache_control_data.checksum = file_checksum
58
- end
59
-
60
- it "writes data to the cache" do
61
- cache_control_data.save
62
- end
63
-
64
- it "writes the data to the cache and the same data can be read back" do
65
- cache_control_data.save
66
- saved_cache_control_data = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(uri, file_checksum)
67
- saved_cache_control_data.etag.should == cache_control_data.etag
68
- saved_cache_control_data.mtime.should == cache_control_data.mtime
69
- saved_cache_control_data.checksum.should == cache_control_data.checksum
70
- end
71
-
72
- # Cover the very long remote file path case -- see CHEF-4422 where
73
- # local cache file names generated from the long uri exceeded
74
- # local file system path limits resulting in exceptions from
75
- # file system API's on both Windows and Unix systems.
76
- context "when the length of the uri exceeds the path length limits for the local file system" do
77
- let(:uri_exceeds_file_system_limit) do
78
- URI.parse("http://www.bing.com/" + ('0' * 1024))
79
- end
80
-
81
- let(:uri) { uri_exceeds_file_system_limit }
82
-
83
- it "writes data to the cache" do
84
- lambda do
85
- cache_control_data.save
86
- end.should_not raise_error
87
- end
88
-
89
- it "writes the data to the cache and the same data can be read back" do
90
- cache_control_data.save
91
- saved_cache_control_data = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(uri, file_checksum)
92
- saved_cache_control_data.etag.should == cache_control_data.etag
93
- saved_cache_control_data.mtime.should == cache_control_data.mtime
94
- saved_cache_control_data.checksum.should == cache_control_data.checksum
95
- end
96
-
97
- end
98
- end
99
-
100
- end
101
-
@@ -1,297 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Author:: Daniel DeLeo (<dan@opscode.com>)
4
- # Copyright:: Copyright (c) 2013 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
- require 'spec_helper'
21
- require 'webrick'
22
-
23
- module AptServer
24
- def enable_testing_apt_source
25
- File.open("/etc/apt/sources.list.d/chef-integration-test.list", "w+") do |f|
26
- f.puts "deb http://localhost:9000/ sid main"
27
- end
28
- # Magic to update apt cache for only our repo
29
- shell_out!("apt-get update " +
30
- '-o Dir::Etc::sourcelist="sources.list.d/chef-integration-test.list" ' +
31
- '-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"')
32
- end
33
-
34
- def disable_testing_apt_source
35
- FileUtils.rm("/etc/apt/sources.list.d/chef-integration-test.list")
36
- rescue Errno::ENOENT
37
- puts("Attempted to remove integration test from /etc/apt/sources.list.d but it didn't exist")
38
- end
39
-
40
- def tcp_test_port(hostname, port)
41
- tcp_socket = TCPSocket.new(hostname, port)
42
- true
43
- rescue Errno::ETIMEDOUT
44
- false
45
- rescue Errno::ECONNREFUSED
46
- false
47
- ensure
48
- tcp_socket && tcp_socket.close
49
- end
50
-
51
- def apt_server
52
- @apt_server ||= WEBrick::HTTPServer.new(
53
- :Port => 9000,
54
- :DocumentRoot => apt_data_dir + "/var/www/apt",
55
- # Make WEBrick quiet, comment out for debug.
56
- :Logger => Logger.new(StringIO.new),
57
- :AccessLog => [ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ]
58
- )
59
- end
60
-
61
- def run_apt_server
62
- apt_server.start
63
- end
64
-
65
- def start_apt_server
66
- @apt_server_thread = Thread.new do
67
- run_apt_server
68
- end
69
- until tcp_test_port("localhost", 9000) do
70
- if @apt_server_thread.alive?
71
- sleep 1
72
- else
73
- @apt_server_thread.join
74
- raise "apt server failed to start"
75
- end
76
- end
77
- end
78
-
79
- def stop_apt_server
80
- apt_server.shutdown
81
- @apt_server_thread.join
82
- end
83
-
84
- def apt_data_dir
85
- File.join(CHEF_SPEC_DATA, "apt")
86
- end
87
- end
88
-
89
- metadata = { :unix_only => true,
90
- :requires_root => true,
91
- :provider => {:package => Chef::Provider::Package::Apt},
92
- :arch => "x86_64" # test packages are 64bit
93
- }
94
-
95
- describe Chef::Resource::Package, metadata do
96
- include Chef::Mixin::ShellOut
97
-
98
- def chef_test_dpkg_installed?
99
- shell_out("dpkg -l chef-integration-test").status.success?
100
- end
101
-
102
- def dpkg_should_be_installed(pkg_name)
103
- shell_out!("dpkg -l #{pkg_name}")
104
- end
105
-
106
-
107
- context "with a remote package source" do
108
-
109
- include AptServer
110
-
111
- before(:all) do
112
- # Disable mixlib-shellout live streams
113
- Chef::Log.level = :warn
114
- start_apt_server
115
- enable_testing_apt_source
116
- end
117
-
118
- after(:all) do
119
- stop_apt_server
120
- disable_testing_apt_source
121
- shell_out!("apt-get clean")
122
- end
123
-
124
-
125
- after do
126
- shell_out!("dpkg -r chef-integration-test")
127
- shell_out("dpkg --clear-avail")
128
- shell_out!("apt-get clean")
129
- end
130
-
131
- let(:node) do
132
- n = Chef::Node.new
133
- n.consume_external_attrs(OHAI_SYSTEM.data.dup, {})
134
- n
135
- end
136
-
137
- let(:events) do
138
- Chef::EventDispatch::Dispatcher.new
139
- end
140
-
141
- # TODO: lots of duplication from client.rb;
142
- # All of this must be setup for preseed files to get found
143
- let(:cookbook_collection) do
144
- cookbook_path = File.join(CHEF_SPEC_DATA, "cookbooks")
145
- cl = Chef::CookbookLoader.new(cookbook_path)
146
- cl.load_cookbooks
147
- Chef::Cookbook::FileVendor.on_create do |manifest|
148
- Chef::Cookbook::FileSystemFileVendor.new(manifest, cookbook_path)
149
- end
150
- Chef::CookbookCollection.new(cl)
151
- end
152
-
153
- let(:run_context) do
154
- Chef::RunContext.new(node, cookbook_collection, events)
155
- end
156
-
157
- def base_resource
158
- r = Chef::Resource::Package.new("chef-integration-test", run_context)
159
- # The apt repository in the spec data is not gpg signed, so we need to
160
- # force apt to accept the package:
161
- r.options("--force-yes")
162
- r
163
- end
164
-
165
- let(:package_resource) do
166
- base_resource
167
- end
168
-
169
- # it "results in a usable apt server" do
170
- # shell_out!("apt-get install -q -y --force-yes chef-integration-test ", :env => { "DEBIAN_FRONTEND" => "noninteractive" })
171
- # shell_out!("dpkg -l chef-integration-test")
172
- # end
173
-
174
- context "when the package is not yet installed" do
175
- it "installs the package with action :install" do
176
- package_resource.run_action(:install)
177
- shell_out!("dpkg -l chef-integration-test")
178
- package_resource.should be_updated_by_last_action
179
- end
180
-
181
- it "installs the package for action :upgrade" do
182
- package_resource.run_action(:upgrade)
183
- shell_out!("dpkg -l chef-integration-test")
184
- package_resource.should be_updated_by_last_action
185
- end
186
-
187
- it "does nothing for action :remove" do
188
- package_resource.run_action(:remove)
189
- shell_out!("dpkg -l chef-integration-test", :returns => [1])
190
- package_resource.should_not be_updated_by_last_action
191
- end
192
-
193
- it "does nothing for action :purge" do
194
- package_resource.run_action(:purge)
195
- shell_out!("dpkg -l chef-integration-test", :returns => [1])
196
- package_resource.should_not be_updated_by_last_action
197
- end
198
-
199
- context "and a not-available package version is specified" do
200
- let(:package_resource) do
201
- r = base_resource
202
- r.version("2.0")
203
- r
204
- end
205
-
206
- it "raises a reasonable error for action :install" do
207
- expect do
208
- package_resource.run_action(:install)
209
- end.to raise_error(Chef::Exceptions::Exec)
210
- end
211
-
212
- end
213
-
214
- describe "when preseeding the install" do
215
-
216
- let(:file_cache_path) { Dir.mktmpdir }
217
-
218
- before do
219
- @old_config = Chef::Config.configuration.dup
220
- Chef::Config[:file_cache_path] = file_cache_path
221
- debconf_reset = 'chef-integration-test chef-integration-test/sample-var string "INVALID"'
222
- shell_out!("echo #{debconf_reset} |debconf-set-selections")
223
- end
224
-
225
- after do
226
- FileUtils.rm_rf(file_cache_path)
227
- Chef::Config.configuration = @old_config
228
- end
229
-
230
- context "with a preseed file" do
231
-
232
- let(:package_resource) do
233
- r = base_resource
234
- r.cookbook_name = "preseed"
235
- r.response_file("preseed-file.seed")
236
- r
237
- end
238
-
239
- it "preseeds the package, then installs it" do
240
- package_resource.run_action(:install)
241
- cmd = shell_out!("debconf-show chef-integration-test")
242
- cmd.stdout.should include('chef-integration-test/sample-var: "hello world"')
243
- package_resource.should be_updated_by_last_action
244
- end
245
-
246
- context "and the preseed file exists and is up-to-date" do
247
-
248
- before do
249
- # Code here is duplicated from the implementation. Not great, but
250
- # it should at least fail if the code gets out of sync.
251
- source = File.join(CHEF_SPEC_DATA, "cookbooks/preseed/files/default/preseed-file.seed")
252
- file_cache_dir = Chef::FileCache.create_cache_path("preseed/preseed")
253
- dest = "#{file_cache_dir}/chef-integration-test-1.1-1.seed"
254
- FileUtils.cp(source, dest)
255
- end
256
-
257
- it "does not update the package configuration" do
258
- package_resource.run_action(:install)
259
- cmd = shell_out!("debconf-show chef-integration-test")
260
- cmd.stdout.should include('chef-integration-test/sample-var: INVALID')
261
- package_resource.should be_updated_by_last_action
262
- end
263
-
264
- end
265
-
266
- end
267
-
268
- context "with a preseed template" do
269
-
270
- let(:package_resource) do
271
- r = base_resource
272
- r.cookbook_name = "preseed"
273
- r.response_file("preseed-template.seed")
274
- r
275
- end
276
-
277
- before do
278
- node.set[:preseed_value] = "FROM TEMPLATE"
279
- end
280
-
281
- it "preseeds the package, then installs it" do
282
- package_resource.run_action(:install)
283
- cmd = shell_out!("debconf-show chef-integration-test")
284
- cmd.stdout.should include('chef-integration-test/sample-var: "FROM TEMPLATE"')
285
- package_resource.should be_updated_by_last_action
286
- end
287
-
288
- end
289
-
290
- end
291
- end
292
-
293
- end
294
-
295
- end
296
-
297
-