chef 12.5.1-universal-mingw32 → 12.6.0-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -1
  3. data/README.md +6 -4
  4. data/Rakefile +1 -4
  5. data/chef-windows.gemspec +21 -0
  6. data/chef.gemspec +58 -0
  7. data/lib/chef/api_client/registration.rb +9 -4
  8. data/lib/chef/application.rb +3 -84
  9. data/lib/chef/application/apply.rb +9 -2
  10. data/lib/chef/application/client.rb +8 -3
  11. data/lib/chef/application/solo.rb +7 -1
  12. data/lib/chef/application/windows_service.rb +21 -6
  13. data/lib/chef/application/windows_service_manager.rb +2 -3
  14. data/lib/chef/audit/runner.rb +1 -0
  15. data/lib/chef/chef_class.rb +1 -11
  16. data/lib/chef/chef_fs/chef_fs_data_store.rb +181 -2
  17. data/lib/chef/chef_fs/file_system/cookbook_subdir.rb +5 -0
  18. data/lib/chef/chef_fs/file_system/file_system_entry.rb +11 -7
  19. data/lib/chef/client.rb +28 -1
  20. data/lib/chef/cookbook/cookbook_collection.rb +14 -1
  21. data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
  22. data/lib/chef/cookbook/metadata.rb +115 -9
  23. data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
  24. data/lib/chef/cookbook_version.rb +6 -2
  25. data/lib/chef/data_bag.rb +1 -1
  26. data/lib/chef/data_bag_item.rb +1 -1
  27. data/lib/chef/digester.rb +5 -1
  28. data/lib/chef/dsl/chef_provisioning.rb +57 -0
  29. data/lib/chef/dsl/cheffish.rb +64 -0
  30. data/lib/chef/dsl/declare_resource.rb +108 -0
  31. data/lib/chef/dsl/platform_introspection.rb +3 -3
  32. data/lib/chef/dsl/recipe.rb +3 -73
  33. data/lib/chef/dsl/resources.rb +27 -1
  34. data/lib/chef/event_dispatch/base.rb +3 -0
  35. data/lib/chef/event_dispatch/dispatcher.rb +5 -0
  36. data/lib/chef/event_dispatch/events_output_stream.rb +8 -0
  37. data/lib/chef/exceptions.rb +21 -1
  38. data/lib/chef/file_access_control/unix.rb +12 -12
  39. data/lib/chef/file_content_management/deploy/cp.rb +2 -2
  40. data/lib/chef/file_content_management/deploy/mv_unix.rb +4 -4
  41. data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
  42. data/lib/chef/formatters/base.rb +7 -0
  43. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +2 -2
  44. data/lib/chef/formatters/indentable_output_stream.rb +5 -0
  45. data/lib/chef/http.rb +19 -3
  46. data/lib/chef/http/decompressor.rb +2 -2
  47. data/lib/chef/json_compat.rb +1 -0
  48. data/lib/chef/knife.rb +16 -2
  49. data/lib/chef/knife/bootstrap.rb +55 -10
  50. data/lib/chef/knife/cookbook_site_install.rb +5 -1
  51. data/lib/chef/knife/core/bootstrap_context.rb +2 -1
  52. data/lib/chef/knife/core/node_presenter.rb +1 -1
  53. data/lib/chef/knife/ssh.rb +30 -16
  54. data/lib/chef/knife/ssl_check.rb +4 -2
  55. data/lib/chef/knife/ssl_fetch.rb +3 -2
  56. data/lib/chef/knife/status.rb +14 -1
  57. data/lib/chef/log.rb +14 -0
  58. data/lib/chef/mixin/get_source_from_package.rb +7 -2
  59. data/lib/chef/mixin/properties.rb +302 -0
  60. data/lib/chef/mixin/proxified_socket.rb +38 -0
  61. data/lib/chef/mixin/subclass_directive.rb +37 -0
  62. data/lib/chef/node.rb +13 -5
  63. data/lib/chef/platform/query_helpers.rb +14 -3
  64. data/lib/chef/platform/service_helpers.rb +20 -38
  65. data/lib/chef/policy_builder/expand_node_object.rb +3 -0
  66. data/lib/chef/policy_builder/policyfile.rb +1 -0
  67. data/lib/chef/property.rb +51 -12
  68. data/lib/chef/provider.rb +40 -35
  69. data/lib/chef/provider/deploy.rb +1 -1
  70. data/lib/chef/provider/dsc_resource.rb +54 -20
  71. data/lib/chef/provider/execute.rb +25 -4
  72. data/lib/chef/provider/group.rb +1 -1
  73. data/lib/chef/provider/lwrp_base.rb +1 -0
  74. data/lib/chef/provider/package.rb +76 -30
  75. data/lib/chef/provider/package/dpkg.rb +152 -69
  76. data/lib/chef/provider/package/openbsd.rb +6 -8
  77. data/lib/chef/provider/package/solaris.rb +2 -0
  78. data/lib/chef/provider/package/windows.rb +95 -14
  79. data/lib/chef/provider/package/windows/exe.rb +129 -0
  80. data/lib/chef/provider/package/windows/msi.rb +37 -13
  81. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +89 -0
  82. data/lib/chef/provider/package/yum.rb +13 -3
  83. data/lib/chef/provider/powershell_script.rb +3 -0
  84. data/lib/chef/provider/remote_file/cache_control_data.rb +37 -4
  85. data/lib/chef/provider/remote_file/http.rb +1 -1
  86. data/lib/chef/provider/script.rb +1 -0
  87. data/lib/chef/provider/service.rb +13 -10
  88. data/lib/chef/provider/service/solaris.rb +43 -17
  89. data/lib/chef/provider/service/upstart.rb +3 -3
  90. data/lib/chef/provider/user.rb +1 -1
  91. data/lib/chef/provider/user/dscl.rb +111 -100
  92. data/lib/chef/provider/user/windows.rb +5 -3
  93. data/lib/chef/recipe.rb +3 -5
  94. data/lib/chef/resource.rb +77 -320
  95. data/lib/chef/resource/action_class.rb +4 -0
  96. data/lib/chef/resource/dpkg_package.rb +4 -3
  97. data/lib/chef/resource/dsc_resource.rb +40 -2
  98. data/lib/chef/resource/execute.rb +9 -1
  99. data/lib/chef/resource/ksh.rb +32 -0
  100. data/lib/chef/resource/lwrp_base.rb +6 -10
  101. data/lib/chef/resource/package.rb +8 -9
  102. data/lib/chef/resource/registry_key.rb +1 -1
  103. data/lib/chef/resource/resource_notification.rb +14 -1
  104. data/lib/chef/resource/script.rb +1 -1
  105. data/lib/chef/resource/windows_package.rb +1 -1
  106. data/lib/chef/resource_builder.rb +14 -7
  107. data/lib/chef/resource_reporter.rb +6 -0
  108. data/lib/chef/resources.rb +1 -7
  109. data/lib/chef/rest.rb +1 -1
  110. data/lib/chef/run_context.rb +45 -2
  111. data/lib/chef/run_list/run_list_expansion.rb +47 -0
  112. data/lib/chef/runner.rb +25 -0
  113. data/lib/chef/search/query.rb +16 -2
  114. data/lib/chef/util/diff.rb +2 -2
  115. data/lib/chef/util/powershell/ps_credential.rb +2 -3
  116. data/lib/chef/version.rb +1 -1
  117. data/lib/chef/win32/api/file.rb +51 -1
  118. data/lib/chef/win32/file.rb +5 -0
  119. data/lib/chef/win32/file/version_info.rb +93 -0
  120. data/lib/chef/win32/mutex.rb +1 -1
  121. data/spec/data/apt/chef-integration-test2-1.0/debian/changelog +5 -0
  122. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.debhelper.log +45 -0
  123. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.substvars +1 -0
  124. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/conffiles +1 -0
  125. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/control +10 -0
  126. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/md5sums +1 -0
  127. data/spec/data/apt/chef-integration-test2-1.0/debian/compat +1 -0
  128. data/spec/data/apt/chef-integration-test2-1.0/debian/conffiles +1 -0
  129. data/spec/data/apt/chef-integration-test2-1.0/debian/control +13 -0
  130. data/spec/data/apt/chef-integration-test2-1.0/debian/copyright +34 -0
  131. data/spec/data/apt/chef-integration-test2-1.0/debian/files +1 -0
  132. data/spec/data/apt/chef-integration-test2-1.0/debian/rules +13 -0
  133. data/spec/data/apt/chef-integration-test2-1.0/debian/source/format +1 -0
  134. data/spec/data/apt/chef-integration-test2_1.0-1.debian.tar.gz +0 -0
  135. data/spec/data/apt/chef-integration-test2_1.0-1.dsc +18 -0
  136. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.build +91 -0
  137. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.changes +31 -0
  138. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.deb +0 -0
  139. data/spec/data/apt/chef-integration-test2_1.0.orig.tar.gz +0 -0
  140. data/spec/functional/application_spec.rb +1 -1
  141. data/spec/functional/audit/runner_spec.rb +4 -0
  142. data/spec/functional/knife/ssh_spec.rb +5 -5
  143. data/spec/functional/notifications_spec.rb +74 -4
  144. data/spec/functional/resource/aix_service_spec.rb +2 -2
  145. data/spec/functional/resource/dpkg_package_spec.rb +339 -0
  146. data/spec/functional/resource/ifconfig_spec.rb +3 -1
  147. data/spec/functional/resource/mount_spec.rb +5 -2
  148. data/spec/functional/resource/package_spec.rb +1 -1
  149. data/spec/functional/resource/user/windows_spec.rb +8 -0
  150. data/spec/functional/resource/windows_package_spec.rb +177 -0
  151. data/spec/functional/win32/version_info_spec.rb +50 -0
  152. data/spec/integration/client/client_spec.rb +80 -0
  153. data/spec/integration/knife/download_spec.rb +9 -0
  154. data/spec/integration/knife/upload_spec.rb +28 -1
  155. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +93 -23
  156. data/spec/integration/recipes/resource_action_spec.rb +211 -116
  157. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +72 -0
  158. data/spec/integration/solo/solo_spec.rb +34 -0
  159. data/spec/spec_helper.rb +11 -1
  160. data/spec/support/platform_helpers.rb +8 -0
  161. data/spec/support/shared/integration/integration_helper.rb +6 -0
  162. data/spec/support/shared/unit/execute_resource.rb +5 -0
  163. data/spec/support/shared/unit/platform_introspector.rb +7 -0
  164. data/spec/tiny_server.rb +6 -2
  165. data/spec/unit/api_client/registration_spec.rb +5 -4
  166. data/spec/unit/application_spec.rb +1 -181
  167. data/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb +34 -0
  168. data/spec/unit/cookbook/metadata_spec.rb +122 -2
  169. data/spec/unit/http_spec.rb +102 -0
  170. data/spec/unit/knife/bootstrap_spec.rb +55 -13
  171. data/spec/unit/knife/core/bootstrap_context_spec.rb +10 -3
  172. data/spec/unit/knife/ssl_check_spec.rb +7 -3
  173. data/spec/unit/knife/ssl_fetch_spec.rb +2 -2
  174. data/spec/unit/knife/status_spec.rb +13 -13
  175. data/spec/unit/knife_spec.rb +26 -2
  176. data/spec/unit/lwrp_spec.rb +1 -1
  177. data/spec/unit/mixin/properties_spec.rb +97 -0
  178. data/spec/unit/mixin/proxified_socket_spec.rb +94 -0
  179. data/spec/unit/mixin/subclass_directive_spec.rb +45 -0
  180. data/spec/unit/node_spec.rb +9 -1
  181. data/spec/unit/policy_builder/policyfile_spec.rb +2 -0
  182. data/spec/unit/property/validation_spec.rb +14 -12
  183. data/spec/unit/property_spec.rb +56 -0
  184. data/spec/unit/provider/deploy_spec.rb +1 -1
  185. data/spec/unit/provider/dsc_resource_spec.rb +63 -24
  186. data/spec/unit/provider/execute_spec.rb +95 -28
  187. data/spec/unit/provider/package/dpkg_spec.rb +185 -96
  188. data/spec/unit/provider/package/windows/exe_spec.rb +251 -0
  189. data/spec/unit/provider/package/windows/msi_spec.rb +94 -10
  190. data/spec/unit/provider/package/windows_spec.rb +227 -26
  191. data/spec/unit/provider/package/yum_spec.rb +6 -0
  192. data/spec/unit/provider/package_spec.rb +495 -366
  193. data/spec/unit/provider/remote_file/cache_control_data_spec.rb +62 -36
  194. data/spec/unit/provider/script_spec.rb +2 -2
  195. data/spec/unit/provider/service/solaris_smf_service_spec.rb +110 -39
  196. data/spec/unit/provider/service/upstart_service_spec.rb +19 -0
  197. data/spec/unit/provider/user/dscl_spec.rb +14 -0
  198. data/spec/unit/provider/user/windows_spec.rb +2 -2
  199. data/spec/unit/provider/user_spec.rb +9 -0
  200. data/spec/unit/provider_resolver_spec.rb +6 -30
  201. data/spec/unit/recipe_spec.rb +46 -20
  202. data/spec/unit/resource/chef_gem_spec.rb +1 -1
  203. data/spec/unit/resource/dsc_resource_spec.rb +14 -3
  204. data/spec/unit/resource/ksh_spec.rb +40 -0
  205. data/spec/unit/resource/registry_key_spec.rb +2 -2
  206. data/spec/unit/resource/resource_notification_spec.rb +44 -45
  207. data/spec/unit/resource_reporter_spec.rb +7 -0
  208. data/spec/unit/resource_spec.rb +268 -253
  209. data/spec/unit/rest_spec.rb +2 -2
  210. data/spec/unit/run_list/run_list_expansion_spec.rb +18 -3
  211. data/spec/unit/search/query_spec.rb +19 -1
  212. data/spec/unit/util/powershell/ps_credential_spec.rb +8 -1
  213. data/spec/unit/windows_service_spec.rb +83 -38
  214. data/tasks/external_tests.rb +19 -9
  215. data/tasks/rspec.rb +1 -1
  216. metadata +70 -21
  217. data/spec/support/pedant/Gemfile +0 -3
  218. data/spec/support/pedant/pedant_config.rb +0 -129
  219. data/spec/support/pedant/run_pedant.rb +0 -63
  220. data/spec/support/pedant/stickywicket.pem +0 -27
  221. data/spec/unit/provider/package_spec.rbe +0 -0
@@ -0,0 +1 @@
1
+ /usr/share/doc/chef-integration-test2/copyright
@@ -0,0 +1,10 @@
1
+ Package: chef-integration-test2
2
+ Version: 1.0-1
3
+ Architecture: amd64
4
+ Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
5
+ Installed-Size: 36
6
+ Section: ruby
7
+ Priority: extra
8
+ Homepage: http://tickets.opscode.com
9
+ Description: Chef integration tests for APT in Cucumber
10
+ This package is used for cucumber integration testing in Chef.
@@ -0,0 +1 @@
1
+ 8b3b9ff6cdfe7d7b2b8b8d4f7b9e381f usr/share/doc/chef-integration-test2/changelog.Debian.gz
@@ -0,0 +1 @@
1
+ /usr/share/doc/chef-integration-test2/copyright
@@ -0,0 +1,13 @@
1
+ Source: chef-integration-test2
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-test2
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.
@@ -0,0 +1,34 @@
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"
@@ -0,0 +1 @@
1
+ chef-integration-test2_1.0-1_amd64.deb ruby extra
@@ -0,0 +1,13 @@
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 $@
@@ -0,0 +1,18 @@
1
+ Format: 3.0 (quilt)
2
+ Source: chef-integration-test2
3
+ Binary: chef-integration-test2
4
+ Architecture: any
5
+ Version: 1.0-1
6
+ Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
7
+ Homepage: http://tickets.opscode.com
8
+ Standards-Version: 3.8.4
9
+ Build-Depends: debhelper (>= 7.0.50~)
10
+ Checksums-Sha1:
11
+ 755c304197c6559128aed206ea70643fec2bb90d 248 chef-integration-test2_1.0.orig.tar.gz
12
+ 8b7df49a9e2c57b4460c2738852db1156a21a089 1369 chef-integration-test2_1.0-1.debian.tar.gz
13
+ Checksums-Sha256:
14
+ 8b206a7b3d422290bc8d82bd700cb89f1c6e3962b96be6a3955c7a0159f9031c 248 chef-integration-test2_1.0.orig.tar.gz
15
+ 77a7956e222c35afcddc4a5a8d338ca6e36dc1fbd720af255ce2412885f82702 1369 chef-integration-test2_1.0-1.debian.tar.gz
16
+ Files:
17
+ f1f7d7bbe63ad631d25d707f564a8d33 248 chef-integration-test2_1.0.orig.tar.gz
18
+ 4fab5c1cd9a7b47c4f319af776f48a1d 1369 chef-integration-test2_1.0-1.debian.tar.gz
@@ -0,0 +1,91 @@
1
+ dpkg-buildpackage -rfakeroot -D -us -uc
2
+ dpkg-buildpackage: warning: using a gain-root-command while being root
3
+ dpkg-buildpackage: set CFLAGS to default value: -g -O2
4
+ dpkg-buildpackage: set CPPFLAGS to default value:
5
+ dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
6
+ dpkg-buildpackage: set FFLAGS to default value: -g -O2
7
+ dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
8
+ dpkg-buildpackage: source package chef-integration-test2
9
+ dpkg-buildpackage: source version 1.0-1
10
+ dpkg-buildpackage: source changed by Joshua Timberman <joshua@opscode.com>
11
+ dpkg-buildpackage: host architecture amd64
12
+ fakeroot debian/rules clean
13
+ dh clean
14
+ dh_testdir
15
+ dh_auto_clean
16
+ dh_clean
17
+ dpkg-source -b chef-integration-test2-1.0
18
+ dpkg-source: info: using source format `3.0 (quilt)'
19
+ dpkg-source: info: building chef-integration-test2 using existing ./chef-integration-test2_1.0.orig.tar.gz
20
+ dpkg-source: warning: ignoring deletion of directory cache
21
+ dpkg-source: warning: ignoring deletion of directory cache/chef-integration-test2
22
+ dpkg-source: warning: ignoring deletion of file cache/chef-integration-test2/contents
23
+ dpkg-source: info: building chef-integration-test2 in chef-integration-test2_1.0-1.debian.tar.gz
24
+ dpkg-source: info: building chef-integration-test2 in chef-integration-test2_1.0-1.dsc
25
+ debian/rules build
26
+ dh build
27
+ dh_testdir
28
+ dh_auto_configure
29
+ dh_auto_build
30
+ dh_auto_test
31
+ fakeroot debian/rules binary
32
+ dh binary
33
+ dh_testroot
34
+ dh_prep
35
+ dh_installdirs
36
+ dh_auto_install
37
+ dh_install
38
+ dh_installdocs
39
+ dh_installchangelogs
40
+ dh_installexamples
41
+ dh_installman
42
+ dh_installcatalogs
43
+ dh_installcron
44
+ dh_installdebconf
45
+ dh_installemacsen
46
+ dh_installifupdown
47
+ dh_installinfo
48
+ dh_pysupport
49
+ dh_installinit
50
+ dh_installmenu
51
+ dh_installmime
52
+ dh_installmodules
53
+ dh_installlogcheck
54
+ dh_installlogrotate
55
+ dh_installpam
56
+ dh_installppp
57
+ dh_installudev
58
+ dh_installwm
59
+ dh_installxfonts
60
+ dh_bugfiles
61
+ dh_lintian
62
+ dh_gconf
63
+ dh_icons
64
+ dh_perl
65
+ dh_usrlocal
66
+ dh_link
67
+ dh_compress
68
+ dh_fixperms
69
+ dh_strip
70
+ dh_makeshlibs
71
+ dh_shlibdeps
72
+ dh_installdeb
73
+ dh_gencontrol
74
+ dpkg-gencontrol: warning: unknown substitution variable ${shlibs:Depends}
75
+ dh_md5sums
76
+ dh_builddeb
77
+ dpkg-deb: building package `chef-integration-test2' in `../chef-integration-test2_1.0-1_amd64.deb'.
78
+ dpkg-genchanges >../chef-integration-test2_1.0-1_amd64.changes
79
+ dpkg-genchanges: including full source code in upload
80
+ dpkg-buildpackage: full upload (original source is included)
81
+ Now running lintian...
82
+ warning: lintian's authors do not recommend running it with root privileges!
83
+ E: chef-integration-test2 source: maintainer-address-malformed Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
84
+ W: chef-integration-test2 source: changelog-should-mention-nmu
85
+ W: chef-integration-test2 source: source-nmu-has-incorrect-version-number 1.0-1
86
+ W: chef-integration-test2: new-package-should-close-itp-bug
87
+ W: chef-integration-test2: wrong-bug-number-in-closes l3:#CHEF
88
+ E: chef-integration-test2: file-in-usr-marked-as-conffile /usr/share/doc/chef-integration-test2/copyright
89
+ E: chef-integration-test2: maintainer-address-malformed Joshua Timberman <Joshua Timberman <joshua@opscode.com>>
90
+ W: chef-integration-test2: empty-binary-package
91
+ Finished running lintian.
@@ -0,0 +1,31 @@
1
+ Format: 1.8
2
+ Date: Thu, 30 Sep 2010 09:53:45 -0600
3
+ Source: chef-integration-test2
4
+ Binary: chef-integration-test2
5
+ Architecture: source 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-test2 - Chef integration tests for APT in Cucumber
13
+ Changes:
14
+ chef-integration-test2 (1.0-1) unstable; urgency=low
15
+ .
16
+ * Initial release (Closes: #CHEF-1718)
17
+ Checksums-Sha1:
18
+ 7e065fdf71f4d798312b318a29cec43b7bc1c8e1 885 chef-integration-test2_1.0-1.dsc
19
+ 755c304197c6559128aed206ea70643fec2bb90d 248 chef-integration-test2_1.0.orig.tar.gz
20
+ 8b7df49a9e2c57b4460c2738852db1156a21a089 1369 chef-integration-test2_1.0-1.debian.tar.gz
21
+ f3f89c051bce36d40ef1be12d231c44b2d5be05b 1694 chef-integration-test2_1.0-1_amd64.deb
22
+ Checksums-Sha256:
23
+ 80d314349e1d978f242d05482ca81c9361739047daa4adcecc9e5e622fdc6fb4 885 chef-integration-test2_1.0-1.dsc
24
+ 8b206a7b3d422290bc8d82bd700cb89f1c6e3962b96be6a3955c7a0159f9031c 248 chef-integration-test2_1.0.orig.tar.gz
25
+ 77a7956e222c35afcddc4a5a8d338ca6e36dc1fbd720af255ce2412885f82702 1369 chef-integration-test2_1.0-1.debian.tar.gz
26
+ 19a767db0a947a350fb1c8492699e8a808fbe1838d4a582001106cfbe520ad8f 1694 chef-integration-test2_1.0-1_amd64.deb
27
+ Files:
28
+ 9f927b32d95b5406c696b5b0b23177e8 885 ruby extra chef-integration-test2_1.0-1.dsc
29
+ f1f7d7bbe63ad631d25d707f564a8d33 248 ruby extra chef-integration-test2_1.0.orig.tar.gz
30
+ 4fab5c1cd9a7b47c4f319af776f48a1d 1369 ruby extra chef-integration-test2_1.0-1.debian.tar.gz
31
+ 9914e6152e278b6828bcade3b3f5580c 1694 ruby extra chef-integration-test2_1.0-1_amd64.deb
@@ -42,7 +42,7 @@ describe Chef::Application do
42
42
  Chef::Config[:ftp_proxy] = nil
43
43
  Chef::Config[:no_proxy] = nil
44
44
 
45
- @app.configure_proxy_environment_variables
45
+ Chef::Config.export_proxies
46
46
  end
47
47
 
48
48
  it "saves built proxy to ENV which shell_out can use" do
@@ -52,6 +52,10 @@ describe Chef::Audit::Runner do
52
52
  let(:run_context) { instance_double(Chef::RunContext, :events => events, :audits => audits) }
53
53
  let(:control_group_name) { "control_group_name" }
54
54
 
55
+ # Set cookbook path to include our parent, so that it will recognize this
56
+ # rspec file as one that should show up in the backtrace.
57
+ before(:each) { Chef::Config[:cookbook_path] = File.dirname(__FILE__) }
58
+
55
59
  shared_context "passing audit" do
56
60
  let(:audits) do
57
61
  should_pass = lambda do
@@ -56,7 +56,7 @@ describe Chef::Knife::Ssh do
56
56
 
57
57
  it "uses the ssh_identity_file" do
58
58
  @knife.run
59
- expect(@knife.config[:identity_file]).to eq("~/.ssh/aws.rsa")
59
+ expect(@knife.config[:ssh_identity_file]).to eq("~/.ssh/aws.rsa")
60
60
  end
61
61
  end
62
62
 
@@ -68,7 +68,7 @@ describe Chef::Knife::Ssh do
68
68
 
69
69
  it "uses the ssh_identity_file" do
70
70
  @knife.run
71
- expect(@knife.config[:identity_file]).to eq("~/.ssh/aws.rsa")
71
+ expect(@knife.config[:ssh_identity_file]).to eq("~/.ssh/aws.rsa")
72
72
  end
73
73
  end
74
74
 
@@ -80,13 +80,13 @@ describe Chef::Knife::Ssh do
80
80
 
81
81
  it "should use the value on the command line" do
82
82
  @knife.run
83
- expect(@knife.config[:identity_file]).to eq("~/.ssh/aws.rsa")
83
+ expect(@knife.config[:ssh_identity_file]).to eq("~/.ssh/aws.rsa")
84
84
  end
85
85
 
86
86
  it "should override what is set in knife.rb" do
87
87
  Chef::Config[:knife][:ssh_identity_file] = "~/.ssh/other.rsa"
88
88
  @knife.run
89
- expect(@knife.config[:identity_file]).to eq("~/.ssh/aws.rsa")
89
+ expect(@knife.config[:ssh_identity_file]).to eq("~/.ssh/aws.rsa")
90
90
  end
91
91
  end
92
92
 
@@ -98,7 +98,7 @@ describe Chef::Knife::Ssh do
98
98
 
99
99
  it "uses the default" do
100
100
  @knife.run
101
- expect(@knife.config[:identity_file]).to eq(nil)
101
+ expect(@knife.config[:ssh_identity_file]).to eq(nil)
102
102
  end
103
103
  end
104
104
  end
@@ -74,6 +74,76 @@ describe "Notifications" do
74
74
  runner.converge
75
75
  end
76
76
 
77
+ it "should notify from one resource to another before" do
78
+ log_resource = recipe.declare_resource(:log, "log") do
79
+ message "This is a log message"
80
+ action :write
81
+ notifies :install, "package[vim]", :before
82
+ end
83
+ update_action(log_resource, 2)
84
+
85
+ package_resource = recipe.declare_resource(:package, "vim") do
86
+ action :nothing
87
+ end
88
+
89
+ actions = []
90
+ [ log_resource, package_resource ].each do |resource|
91
+ allow(resource).to receive(:run_action).and_wrap_original do |m, action, notification_type, notifying_resource|
92
+ actions << { resource: resource.to_s, action: action }
93
+ actions[-1][:why_run] = Chef::Config[:why_run] if Chef::Config[:why_run]
94
+ actions[-1][:notification_type] = notification_type if notification_type
95
+ actions[-1][:notifying_resource] = notifying_resource.to_s if notifying_resource
96
+ m.call(action, notification_type, notifying_resource)
97
+ end
98
+ end
99
+
100
+ runner.converge
101
+
102
+ expect(actions).to eq [
103
+ # First it runs why-run to check if the resource would update
104
+ { resource: log_resource.to_s, action: :write, why_run: true },
105
+ # Then it runs the before action
106
+ { resource: package_resource.to_s, action: :install, notification_type: :before, notifying_resource: log_resource.to_s },
107
+ # Then it runs the actual action
108
+ { resource: log_resource.to_s, action: :write },
109
+ { resource: package_resource.to_s, action: :nothing }
110
+ ]
111
+ end
112
+
113
+ it "should not notify from one resource to another before if the resource is not updated" do
114
+ log_resource = recipe.declare_resource(:log, "log") do
115
+ message "This is a log message"
116
+ action :write
117
+ notifies :install, "package[vim]", :before
118
+ end
119
+
120
+ package_resource = recipe.declare_resource(:package, "vim") do
121
+ action :nothing
122
+ end
123
+
124
+ actions = []
125
+ [ log_resource, package_resource ].each do |resource|
126
+ allow(resource).to receive(:run_action).and_wrap_original do |m, action, notification_type, notifying_resource|
127
+ actions << { resource: resource.to_s, action: action }
128
+ actions[-1][:why_run] = Chef::Config[:why_run] if Chef::Config[:why_run]
129
+ actions[-1][:notification_type] = notification_type if notification_type
130
+ actions[-1][:notifying_resource] = notifying_resource.to_s if notifying_resource
131
+ m.call(action, notification_type, notifying_resource)
132
+ end
133
+ end
134
+
135
+ runner.converge
136
+
137
+ expect(actions).to eq [
138
+ # First it runs why-run to check if the resource would update
139
+ { resource: log_resource.to_s, action: :write, why_run: true },
140
+ # Then it does NOT run the before action
141
+ # Then it runs the actual action
142
+ { resource: log_resource.to_s, action: :write },
143
+ { resource: package_resource.to_s, action: :nothing }
144
+ ]
145
+ end
146
+
77
147
  it "should notify from one resource to another delayed" do
78
148
  log_resource = recipe.declare_resource(:log, "log") do
79
149
  message "This is a log message"
@@ -94,7 +164,7 @@ describe "Notifications" do
94
164
 
95
165
  runner.converge
96
166
  end
97
-
167
+
98
168
  describe "when one resource is defined lazily" do
99
169
 
100
170
  it "subscribes to a resource defined in a ruby block" do
@@ -158,10 +228,10 @@ describe "Notifications" do
158
228
  end
159
229
 
160
230
  # Mocks having the provider run successfully and update the resource
161
- def update_action(resource)
231
+ def update_action(resource, times=1)
162
232
  p = Chef::Provider.new(resource, run_context)
163
- expect(resource).to receive(:provider_for_action).and_return(p)
164
- expect(p).to receive(:run_action) {
233
+ expect(resource).to receive(:provider_for_action).exactly(times).times.and_return(p)
234
+ expect(p).to receive(:run_action).exactly(times).times {
165
235
  resource.updated_by_last_action(true)
166
236
  }
167
237
  end
@@ -108,8 +108,8 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
108
108
  it_behaves_like "src service"
109
109
  end
110
110
 
111
-
112
- describe "When service is a group" do
111
+ # Cannot run this test on a WPAR
112
+ describe "When service is a group", :not_wpar do
113
113
  before(:all) do
114
114
  script_dir = File.join(File.dirname(__FILE__), "/../assets/")
115
115
  shell_out!("mkssys -s ctestsys -p #{script_dir}/testchefsubsys -u #{get_user_id} -S -n 15 -f 9 -R -Q -G ctestgrp")
@@ -0,0 +1,339 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2014-2015 Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'spec_helper'
19
+ require 'chef/mixin/shell_out'
20
+
21
+ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch: "x86_64" do
22
+ include Chef::Mixin::ShellOut
23
+
24
+ let(:apt_data) { File.join(CHEF_SPEC_DATA, "apt") }
25
+
26
+ let(:test1_0) { File.join(apt_data, "chef-integration-test_1.0-1_amd64.deb") }
27
+ let(:test1_1) { File.join(apt_data, "chef-integration-test_1.1-1_amd64.deb") }
28
+ let(:test2_0) { File.join(apt_data, "chef-integration-test2_1.0-1_amd64.deb") }
29
+
30
+ let(:run_context) {
31
+ node = TEST_NODE.dup
32
+ events = Chef::EventDispatch::Dispatcher.new
33
+ Chef::RunContext.new(node, {}, events)
34
+ }
35
+
36
+ let(:dpkg_package) { Chef::Resource::DpkgPackage.new(test1_0, run_context)}
37
+
38
+ before(:each) do
39
+ shell_out("dpkg -P chef-integration-test chef-integration-test2")
40
+ end
41
+
42
+ # handles setting the name property after the initializer runs
43
+ def set_dpkg_package_name(name)
44
+ dpkg_package.name name
45
+ dpkg_package.package_name name
46
+ end
47
+
48
+ def should_be_purged_or_removed(package, action=nil)
49
+ status = shell_out("dpkg -s #{package}")
50
+ output = status.stdout + status.stderr
51
+ if action.nil? || action == :purge
52
+ expect(output).to match(/no info|not-installed|not installed/)
53
+ elsif action == :remove
54
+ expect(output).to match(/deinstall ok config-files/)
55
+ else
56
+ raise "Unknown action"
57
+ end
58
+ end
59
+
60
+ shared_examples_for "common behavior for upgrade or install" do
61
+ it "installs a package when given only the filename as a name argument (no source)" do
62
+ dpkg_package.run_action(action)
63
+ expect(dpkg_package).to be_updated_by_last_action
64
+ shell_out!('dpkg -s chef-integration-test')
65
+ end
66
+
67
+ it "installs a package when given the name and a source argument" do
68
+ set_dpkg_package_name "chef-integration-test"
69
+ dpkg_package.source test1_0
70
+ dpkg_package.run_action(action)
71
+ expect(dpkg_package).to be_updated_by_last_action
72
+ shell_out!('dpkg -s chef-integration-test')
73
+ end
74
+
75
+ it "installs a package when given a different name and a source argument" do
76
+ set_dpkg_package_name "some other name"
77
+ dpkg_package.source test1_0
78
+ dpkg_package.run_action(action)
79
+ expect(dpkg_package).to be_updated_by_last_action
80
+ shell_out!('dpkg -s chef-integration-test')
81
+ end
82
+
83
+ it "installs a package when given a path as a package_name and no source" do
84
+ set_dpkg_package_name "chef-integration-test"
85
+ dpkg_package.package_name test1_0
86
+ dpkg_package.run_action(action)
87
+ expect(dpkg_package).to be_updated_by_last_action
88
+ shell_out!('dpkg -s chef-integration-test')
89
+ end
90
+
91
+ it "raises an error when the name is not a path and the source is not given" do
92
+ set_dpkg_package_name "chef-integration-test"
93
+ dpkg_package.package_name "chef-integration-test"
94
+ expect { dpkg_package.run_action(action) }.to raise_error(Chef::Exceptions::Package)
95
+ end
96
+
97
+ it "raises an error when passed a package_name that does not exist" do
98
+ set_dpkg_package_name File.join(test1_0, "make.it.fail")
99
+ expect { dpkg_package.run_action(action) }.to raise_error(Chef::Exceptions::Package)
100
+ end
101
+
102
+ it "raises an error when passed a source that does not exist" do
103
+ set_dpkg_package_name "chef-integration-test"
104
+ dpkg_package.source File.join(test1_0, "make.it.fail")
105
+ expect { dpkg_package.run_action(action) }.to raise_error(Chef::Exceptions::Package)
106
+ end
107
+
108
+ it "should not install an already installed package" do
109
+ shell_out!("dpkg -i #{test1_0}")
110
+ dpkg_package.run_action(action)
111
+ expect(dpkg_package).not_to be_updated_by_last_action
112
+ shell_out!('dpkg -s chef-integration-test')
113
+ end
114
+
115
+ it "should handle a multipackage install" do
116
+ set_dpkg_package_name [ test1_0, test2_0 ]
117
+ dpkg_package.run_action(action)
118
+ expect(dpkg_package).to be_updated_by_last_action
119
+ shell_out!('dpkg -s chef-integration-test')
120
+ shell_out!('dpkg -s chef-integration-test2')
121
+ end
122
+
123
+ it "should not update multipackages that are up-to-date" do
124
+ shell_out!("dpkg -i #{test1_0} #{test2_0}")
125
+ set_dpkg_package_name [ test1_0, test2_0 ]
126
+ dpkg_package.run_action(action)
127
+ expect(dpkg_package).not_to be_updated_by_last_action
128
+ shell_out!('dpkg -s chef-integration-test')
129
+ shell_out!('dpkg -s chef-integration-test2')
130
+ end
131
+
132
+ it "should install the second if the first is installed" do
133
+ shell_out!("dpkg -i #{test1_0}")
134
+ set_dpkg_package_name [ test1_0, test2_0 ]
135
+ dpkg_package.run_action(action)
136
+ expect(dpkg_package).to be_updated_by_last_action
137
+ shell_out!('dpkg -s chef-integration-test')
138
+ shell_out!('dpkg -s chef-integration-test2')
139
+ end
140
+
141
+ it "should install the first if the second is installed" do
142
+ shell_out!("dpkg -i #{test2_0}")
143
+ set_dpkg_package_name [ test1_0, test2_0 ]
144
+ dpkg_package.run_action(action)
145
+ expect(dpkg_package).to be_updated_by_last_action
146
+ shell_out!('dpkg -s chef-integration-test')
147
+ shell_out!('dpkg -s chef-integration-test2')
148
+ end
149
+ end
150
+
151
+ context "action :install" do
152
+ let(:action) { :install }
153
+ it_behaves_like "common behavior for upgrade or install"
154
+
155
+ it "should not upgrade a package" do
156
+ shell_out!("dpkg -i #{test1_0}")
157
+ set_dpkg_package_name test1_1
158
+ dpkg_package.run_action(action)
159
+ expect(dpkg_package).not_to be_updated_by_last_action
160
+ end
161
+
162
+ it "should not upgrade on a multipackage install" do
163
+ shell_out!("dpkg -i #{test1_0} #{test2_0}")
164
+ set_dpkg_package_name [ test1_1, test2_0 ]
165
+ dpkg_package.run_action(action)
166
+ expect(dpkg_package).not_to be_updated_by_last_action
167
+ end
168
+ end
169
+
170
+ context "action :upgrade" do
171
+ let(:action) { :upgrade }
172
+ it_behaves_like "common behavior for upgrade or install"
173
+
174
+ it "should upgrade a package" do
175
+ shell_out!("dpkg -i #{test1_0}")
176
+ set_dpkg_package_name test1_1
177
+ dpkg_package.run_action(action)
178
+ expect(dpkg_package).to be_updated_by_last_action
179
+ end
180
+
181
+ it "should upgrade on a multipackage install" do
182
+ shell_out!("dpkg -i #{test1_0} #{test2_0}")
183
+ set_dpkg_package_name [ test1_1, test2_0 ]
184
+ dpkg_package.run_action(action)
185
+ expect(dpkg_package).to be_updated_by_last_action
186
+ end
187
+ end
188
+
189
+ shared_examples_for "common behavior for remove or purge" do
190
+ it "should remove a package that is installed when the name is a source" do
191
+ shell_out!("dpkg -i #{test1_0}")
192
+ dpkg_package.run_action(action)
193
+ expect(dpkg_package).to be_updated_by_last_action
194
+ should_be_purged_or_removed('chef-integration-test')
195
+ end
196
+
197
+ it "should do nothing if the package is not installed when the name is a source" do
198
+ dpkg_package.run_action(action)
199
+ expect(dpkg_package).not_to be_updated_by_last_action
200
+ should_be_purged_or_removed('chef-integration-test')
201
+ end
202
+
203
+ it "should remove a package that is installed when the name is the package name and source is nil" do
204
+ shell_out!("dpkg -i #{test1_0}")
205
+ set_dpkg_package_name "chef-integration-test"
206
+ dpkg_package.run_action(action)
207
+ expect(dpkg_package).to be_updated_by_last_action
208
+ should_be_purged_or_removed('chef-integration-test')
209
+ end
210
+
211
+ it "should do nothing if the package is not installed when the name is the package name and the source is nil" do
212
+ set_dpkg_package_name "chef-integration-test"
213
+ dpkg_package.run_action(action)
214
+ expect(dpkg_package).not_to be_updated_by_last_action
215
+ should_be_purged_or_removed('chef-integration-test')
216
+ end
217
+
218
+ it "should remove a package that is installed when the name is changed but the source is a package" do
219
+ shell_out!("dpkg -i #{test1_0}")
220
+ set_dpkg_package_name "some other name"
221
+ dpkg_package.source test1_0
222
+ dpkg_package.run_action(action)
223
+ expect(dpkg_package).to be_updated_by_last_action
224
+ should_be_purged_or_removed('chef-integration-test')
225
+ end
226
+
227
+ it "should do nothing if the package is not installed when the name is changed but the source is a package" do
228
+ set_dpkg_package_name "some other name"
229
+ dpkg_package.source test1_0
230
+ dpkg_package.run_action(action)
231
+ expect(dpkg_package).not_to be_updated_by_last_action
232
+ should_be_purged_or_removed('chef-integration-test')
233
+ end
234
+
235
+ it "should remove a package if the name is a file that does not exist, but the source exists" do
236
+ shell_out!("dpkg -i #{test1_0}")
237
+ dpkg_package.name "whatever"
238
+ dpkg_package.package_name File.join(test1_0, "make.it.fail")
239
+ dpkg_package.source test1_0
240
+ dpkg_package.run_action(action)
241
+ expect(dpkg_package).to be_updated_by_last_action
242
+ should_be_purged_or_removed('chef-integration-test')
243
+ end
244
+
245
+ it "should do nothing if the package is not installed when the name is a file that does not exist, but the source exists" do
246
+ set_dpkg_package_name "some other name"
247
+ dpkg_package.name "whatever"
248
+ dpkg_package.package_name File.join(test1_0, "make.it.fail")
249
+ dpkg_package.source test1_0
250
+ dpkg_package.run_action(action)
251
+ expect(dpkg_package).not_to be_updated_by_last_action
252
+ should_be_purged_or_removed('chef-integration-test')
253
+ end
254
+
255
+ it "should remove a package if the package_name is correct, but the source does not exist" do
256
+ shell_out!("dpkg -i #{test1_0}")
257
+ dpkg_package.name "whatever"
258
+ dpkg_package.package_name "chef-integration-test"
259
+ dpkg_package.source File.join(test1_0, "make.it.fail")
260
+ dpkg_package.run_action(action)
261
+ expect(dpkg_package).to be_updated_by_last_action
262
+ should_be_purged_or_removed('chef-integration-test')
263
+ end
264
+
265
+ it "should do nothing if the package_name is correct, but the source does not exist, and the package is not installed" do
266
+ dpkg_package.name "whatever"
267
+ dpkg_package.package_name "chef-integration-test"
268
+ dpkg_package.source File.join(test1_0, "make.it.fail")
269
+ dpkg_package.run_action(action)
270
+ expect(dpkg_package).not_to be_updated_by_last_action
271
+ should_be_purged_or_removed('chef-integration-test')
272
+ end
273
+
274
+ it "should remove both packages when called with two" do
275
+ shell_out!("dpkg -i #{test1_0} #{test2_0}")
276
+ set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
277
+ dpkg_package.run_action(action)
278
+ expect(dpkg_package).to be_updated_by_last_action
279
+ should_be_purged_or_removed('chef-integration-test')
280
+ should_be_purged_or_removed('chef-integration-test2', action)
281
+ end
282
+
283
+ it "should remove a package when only the first one is installed" do
284
+ shell_out!("dpkg -i #{test1_0}")
285
+ set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
286
+ dpkg_package.run_action(action)
287
+ expect(dpkg_package).to be_updated_by_last_action
288
+ should_be_purged_or_removed('chef-integration-test')
289
+ should_be_purged_or_removed('chef-integration-test2')
290
+ end
291
+
292
+ it "should remove a package when only the second one is installed" do
293
+ shell_out!("dpkg -i #{test2_0}")
294
+ set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
295
+ dpkg_package.run_action(action)
296
+ expect(dpkg_package).to be_updated_by_last_action
297
+ should_be_purged_or_removed('chef-integration-test')
298
+ should_be_purged_or_removed('chef-integration-test2', action)
299
+ end
300
+
301
+ it "should do nothing when both packages are not installed" do
302
+ set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
303
+ dpkg_package.run_action(action)
304
+ expect(dpkg_package).not_to be_updated_by_last_action
305
+ should_be_purged_or_removed('chef-integration-test')
306
+ should_be_purged_or_removed('chef-integration-test2')
307
+ end
308
+ end
309
+
310
+ context "action :remove" do
311
+ let(:action) { :remove }
312
+ it_behaves_like "common behavior for remove or purge"
313
+
314
+ it "should not remove a removed package when the name is a source" do
315
+ # the "test2" file has a conffile declared in it
316
+ shell_out!("dpkg -i #{test2_0}")
317
+ shell_out!("dpkg -r chef-integration-test2")
318
+ set_dpkg_package_name "chef-integration-test2"
319
+ dpkg_package.run_action(action)
320
+ expect(dpkg_package).not_to be_updated_by_last_action
321
+ shell_out!('dpkg -s chef-integration-test2') # its still 'installed'
322
+ end
323
+ end
324
+
325
+ context "action :purge" do
326
+ let(:action) { :purge }
327
+ it_behaves_like "common behavior for remove or purge"
328
+
329
+ it "should purge a removed package when the name is a source" do
330
+ # the "test2" file has a conffile declared in it
331
+ shell_out!("dpkg -i #{test2_0}")
332
+ shell_out!("dpkg -r chef-integration-test2")
333
+ set_dpkg_package_name "chef-integration-test2"
334
+ dpkg_package.run_action(action)
335
+ expect(dpkg_package).to be_updated_by_last_action
336
+ should_be_purged_or_removed('chef-integration-test2', action)
337
+ end
338
+ end
339
+ end