chef 15.8.23 → 15.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +1 -1
  4. data/Rakefile +9 -0
  5. data/lib/chef/application.rb +1 -1
  6. data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
  7. data/lib/chef/chef_fs/command_line.rb +5 -5
  8. data/lib/chef/cookbook/metadata.rb +5 -4
  9. data/lib/chef/cookbook/synchronizer.rb +1 -0
  10. data/lib/chef/cookbook_loader.rb +1 -1
  11. data/lib/chef/data_collector/config_validation.rb +7 -7
  12. data/lib/chef/deprecated.rb +5 -5
  13. data/lib/chef/dsl/platform_introspection.rb +2 -2
  14. data/lib/chef/dsl/reboot_pending.rb +3 -3
  15. data/lib/chef/http/json_output.rb +1 -1
  16. data/lib/chef/knife.rb +1 -1
  17. data/lib/chef/knife/bootstrap/templates/README.md +2 -2
  18. data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
  19. data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +2 -2
  20. data/lib/chef/knife/core/ui.rb +1 -1
  21. data/lib/chef/knife/core/windows_bootstrap_context.rb +8 -8
  22. data/lib/chef/knife/data_bag_edit.rb +2 -2
  23. data/lib/chef/knife/edit.rb +1 -1
  24. data/lib/chef/knife/environment_compare.rb +1 -1
  25. data/lib/chef/knife/list.rb +1 -1
  26. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  27. data/lib/chef/provider/group/usermod.rb +2 -5
  28. data/lib/chef/provider/mount/mount.rb +1 -1
  29. data/lib/chef/provider/package/homebrew.rb +1 -2
  30. data/lib/chef/provider/package/rubygems.rb +1 -1
  31. data/lib/chef/provider/package/yum/python_helper.rb +2 -2
  32. data/lib/chef/provider/package/yum/rpm_utils.rb +4 -4
  33. data/lib/chef/provider/package/zypper.rb +2 -1
  34. data/lib/chef/provider/remote_file.rb +2 -2
  35. data/lib/chef/provider/route.rb +4 -4
  36. data/lib/chef/provider/windows_env.rb +3 -3
  37. data/lib/chef/resource.rb +7 -2
  38. data/lib/chef/resource/build_essential.rb +46 -22
  39. data/lib/chef/resource/cron.rb +1 -1
  40. data/lib/chef/resource/cron_d.rb +1 -1
  41. data/lib/chef/resource/execute.rb +1 -1
  42. data/lib/chef/resource/freebsd_package.rb +0 -3
  43. data/lib/chef/resource/homebrew_package.rb +1 -2
  44. data/lib/chef/resource/hostname.rb +2 -2
  45. data/lib/chef/resource/kernel_module.rb +3 -2
  46. data/lib/chef/resource/openbsd_package.rb +0 -3
  47. data/lib/chef/resource/remote_file.rb +1 -1
  48. data/lib/chef/resource/rhsm_errata.rb +9 -2
  49. data/lib/chef/resource/rhsm_errata_level.rb +11 -5
  50. data/lib/chef/resource/rhsm_register.rb +27 -12
  51. data/lib/chef/resource/swap_file.rb +2 -2
  52. data/lib/chef/resource/timezone.rb +2 -2
  53. data/lib/chef/resource/windows_certificate.rb +0 -2
  54. data/lib/chef/resource/windows_share.rb +1 -1
  55. data/lib/chef/shell/ext.rb +1 -1
  56. data/lib/chef/util/diff.rb +3 -3
  57. data/lib/chef/util/selinux.rb +2 -2
  58. data/lib/chef/version.rb +1 -1
  59. data/lib/chef/win32/error.rb +1 -1
  60. data/lib/chef/win32/registry.rb +1 -1
  61. data/lib/chef/win32/system.rb +0 -0
  62. data/spec/data/cookbooks/starter/recipes/default.rb +1 -1
  63. data/spec/data/windows_certificates/base64_test.cer +18 -20
  64. data/spec/data/windows_certificates/othertest.cer +0 -0
  65. data/spec/data/windows_certificates/test.cer +0 -0
  66. data/spec/data/windows_certificates/test.p7b +0 -0
  67. data/spec/data/windows_certificates/test.pem +18 -19
  68. data/spec/data/windows_certificates/test.pfx +0 -0
  69. data/spec/functional/resource/ifconfig_spec.rb +2 -2
  70. data/spec/functional/resource/windows_certificate_spec.rb +9 -9
  71. data/spec/functional/resource/windows_service_spec.rb +1 -2
  72. data/spec/functional/run_lock_spec.rb +7 -1
  73. data/spec/functional/win32/service_manager_spec.rb +1 -1
  74. data/spec/functional/win32/version_info_spec.rb +4 -4
  75. data/spec/integration/client/client_spec.rb +2 -2
  76. data/spec/integration/client/exit_code_spec.rb +1 -0
  77. data/spec/integration/client/ipv6_spec.rb +1 -0
  78. data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -0
  79. data/spec/integration/knife/chef_repo_path_spec.rb +1 -0
  80. data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -0
  81. data/spec/integration/knife/chefignore_spec.rb +1 -0
  82. data/spec/integration/knife/client_bulk_delete_spec.rb +1 -0
  83. data/spec/integration/knife/client_create_spec.rb +1 -0
  84. data/spec/integration/knife/client_delete_spec.rb +1 -0
  85. data/spec/integration/knife/client_key_create_spec.rb +1 -0
  86. data/spec/integration/knife/client_key_delete_spec.rb +1 -0
  87. data/spec/integration/knife/client_key_list_spec.rb +1 -0
  88. data/spec/integration/knife/client_key_show_spec.rb +1 -0
  89. data/spec/integration/knife/client_list_spec.rb +1 -0
  90. data/spec/integration/knife/client_show_spec.rb +1 -0
  91. data/spec/integration/knife/common_options_spec.rb +1 -0
  92. data/spec/integration/knife/config_get_profile_spec.rb +1 -0
  93. data/spec/integration/knife/config_get_spec.rb +1 -0
  94. data/spec/integration/knife/config_list_profiles_spec.rb +1 -0
  95. data/spec/integration/knife/config_use_profile_spec.rb +1 -0
  96. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -0
  97. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +1 -0
  98. data/spec/integration/knife/cookbook_download_spec.rb +1 -0
  99. data/spec/integration/knife/cookbook_list_spec.rb +1 -0
  100. data/spec/integration/knife/cookbook_show_spec.rb +1 -0
  101. data/spec/integration/knife/cookbook_upload_spec.rb +1 -0
  102. data/spec/integration/knife/data_bag_create_spec.rb +1 -0
  103. data/spec/integration/knife/data_bag_delete_spec.rb +1 -0
  104. data/spec/integration/knife/data_bag_edit_spec.rb +1 -0
  105. data/spec/integration/knife/data_bag_from_file_spec.rb +1 -0
  106. data/spec/integration/knife/data_bag_list_spec.rb +1 -0
  107. data/spec/integration/knife/data_bag_show_spec.rb +1 -0
  108. data/spec/integration/knife/delete_spec.rb +1 -0
  109. data/spec/integration/knife/deps_spec.rb +3 -2
  110. data/spec/integration/knife/diff_spec.rb +1 -0
  111. data/spec/integration/knife/download_spec.rb +1 -0
  112. data/spec/integration/knife/environment_compare_spec.rb +1 -0
  113. data/spec/integration/knife/environment_create_spec.rb +1 -0
  114. data/spec/integration/knife/environment_delete_spec.rb +1 -0
  115. data/spec/integration/knife/environment_from_file_spec.rb +1 -0
  116. data/spec/integration/knife/environment_list_spec.rb +1 -0
  117. data/spec/integration/knife/environment_show_spec.rb +1 -0
  118. data/spec/integration/knife/list_spec.rb +1 -0
  119. data/spec/integration/knife/node_bulk_delete_spec.rb +1 -0
  120. data/spec/integration/knife/node_create_spec.rb +1 -0
  121. data/spec/integration/knife/node_delete_spec.rb +1 -0
  122. data/spec/integration/knife/node_environment_set_spec.rb +1 -0
  123. data/spec/integration/knife/node_from_file_spec.rb +1 -0
  124. data/spec/integration/knife/node_list_spec.rb +1 -0
  125. data/spec/integration/knife/node_run_list_add_spec.rb +1 -0
  126. data/spec/integration/knife/node_run_list_remove_spec.rb +1 -0
  127. data/spec/integration/knife/node_run_list_set_spec.rb +1 -0
  128. data/spec/integration/knife/node_show_spec.rb +1 -0
  129. data/spec/integration/knife/raw_spec.rb +1 -0
  130. data/spec/integration/knife/redirection_spec.rb +1 -0
  131. data/spec/integration/knife/role_bulk_delete_spec.rb +1 -0
  132. data/spec/integration/knife/role_create_spec.rb +1 -0
  133. data/spec/integration/knife/role_delete_spec.rb +1 -0
  134. data/spec/integration/knife/role_from_file_spec.rb +1 -0
  135. data/spec/integration/knife/role_list_spec.rb +1 -0
  136. data/spec/integration/knife/role_show_spec.rb +1 -0
  137. data/spec/integration/knife/search_node_spec.rb +1 -0
  138. data/spec/integration/knife/show_spec.rb +1 -0
  139. data/spec/integration/knife/upload_spec.rb +1 -0
  140. data/spec/integration/recipes/accumulator_spec.rb +1 -0
  141. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -0
  142. data/spec/integration/recipes/lwrp_spec.rb +1 -0
  143. data/spec/integration/recipes/notifies_spec.rb +1 -0
  144. data/spec/integration/recipes/notifying_block_spec.rb +1 -0
  145. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -0
  146. data/spec/integration/recipes/resource_action_spec.rb +1 -0
  147. data/spec/integration/recipes/unified_mode_spec.rb +1 -0
  148. data/spec/integration/solo/solo_spec.rb +1 -0
  149. data/spec/spec_helper.rb +7 -10
  150. data/spec/support/chef_helpers.rb +1 -1
  151. data/spec/support/key_helpers.rb +0 -2
  152. data/spec/support/platform_helpers.rb +7 -3
  153. data/spec/support/platforms/win32/spec_service.rb +27 -25
  154. data/spec/support/shared/context/config.rb +0 -3
  155. data/spec/support/shared/integration/integration_helper.rb +0 -1
  156. data/spec/support/shared/unit/execute_resource.rb +0 -2
  157. data/spec/support/shared/unit/provider/file.rb +0 -1
  158. data/spec/support/shared/unit/script_resource.rb +2 -4
  159. data/spec/support/shared/unit/windows_script_resource.rb +0 -2
  160. data/spec/unit/cookbook/gem_installer_spec.rb +1 -1
  161. data/spec/unit/cookbook/metadata_spec.rb +1 -10
  162. data/spec/unit/data_collector_spec.rb +1 -1
  163. data/spec/unit/deprecated_spec.rb +3 -3
  164. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +1 -1
  165. data/spec/unit/encrypted_data_bag_item_spec.rb +2 -2
  166. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +3 -3
  167. data/spec/unit/knife_spec.rb +6 -7
  168. data/spec/unit/mixin/shell_out_spec.rb +27 -29
  169. data/spec/unit/provider/file_spec.rb +1 -0
  170. data/spec/unit/resource/build_essential_spec.rb +48 -2
  171. data/spec/unit/resource/data/InstallHistory_with_CLT.plist +92 -0
  172. data/spec/unit/resource/data/InstallHistory_without_CLT.plist +38 -0
  173. data/spec/unit/resource/execute_spec.rb +1 -1
  174. data/spec/unit/resource/rhsm_register_spec.rb +24 -0
  175. data/spec/unit/resource/windows_share_spec.rb +3 -1
  176. data/tasks/rspec.rb +1 -0
  177. metadata +8 -6
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "support/shared/integration/integration_helper"
19
20
  require "support/shared/context/config"
20
21
  require "chef/knife/list"
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
  require "openssl"
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "support/shared/integration/integration_helper"
19
20
  require "support/shared/context/config"
20
21
  require "chef/knife/raw"
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "tiny_server"
19
20
  require "support/shared/integration/integration_helper"
20
21
  require "support/shared/context/config"
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -14,6 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+ require "spec_helper"
17
18
  require "support/shared/integration/integration_helper"
18
19
  require "support/shared/context/config"
19
20
 
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "support/shared/integration/integration_helper"
19
20
  require "support/shared/context/config"
20
21
  require "chef/knife/show"
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "support/shared/integration/integration_helper"
19
20
  require "chef/knife/upload"
20
21
  require "chef/knife/diff"
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
 
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
 
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
 
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
 
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ require "spec_helper"
18
19
  require "support/shared/integration/integration_helper"
19
20
  require "chef/mixin/shell_out"
20
21
 
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
 
3
4
  describe "Recipe DSL methods" do
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
 
3
4
  class NoActionJackson < Chef::Resource
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
 
@@ -1,3 +1,4 @@
1
+ require "spec_helper"
1
2
  require "support/shared/integration/integration_helper"
2
3
  require "chef/mixin/shell_out"
3
4
  require "chef/run_lock"
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
- # Copyright:: Copyright 2008-2019, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2020, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,18 +24,16 @@ module Shell
24
24
  IRB = nil unless defined? IRB
25
25
  end
26
26
 
27
- # Ruby 1.9 Compat
28
- $:.unshift File.expand_path("../..", __FILE__)
27
+ $LOAD_PATH.unshift File.expand_path("../..", __FILE__)
28
+
29
+ $LOAD_PATH.unshift File.expand_path("../../chef-config/lib", __FILE__)
30
+ $LOAD_PATH.unshift File.expand_path("../../chef-utils/lib", __FILE__)
29
31
 
30
32
  require "rubygems"
31
33
  require "rspec/mocks"
32
34
 
33
35
  require "webmock/rspec"
34
36
 
35
- $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
36
- $:.unshift(File.expand_path("../lib", __FILE__))
37
- $:.unshift(File.dirname(__FILE__))
38
-
39
37
  if ENV["COVERAGE"]
40
38
  require "simplecov"
41
39
  SimpleCov.start do
@@ -140,9 +138,6 @@ RSpec.configure do |config|
140
138
  config.filter_run_excluding volatile_on_solaris: true if solaris?
141
139
  config.filter_run_excluding volatile_from_verify: false
142
140
 
143
- config.filter_run_excluding skip_appveyor: true if ENV["APPVEYOR"]
144
- config.filter_run_excluding appveyor_only: true unless ENV["APPVEYOR"]
145
-
146
141
  config.filter_run_excluding skip_buildkite: true if ENV["BUILDKITE"]
147
142
 
148
143
  config.filter_run_excluding windows_only: true unless windows?
@@ -205,7 +200,9 @@ RSpec.configure do |config|
205
200
  config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION)
206
201
  config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
207
202
 
203
+ # check for particular binaries we need
208
204
  config.filter_run_excluding choco_installed: true unless choco_installed?
205
+ config.filter_run_excluding requires_ifconfig: true unless ifconfig?
209
206
 
210
207
  running_platform_arch = `uname -m`.strip unless windows?
211
208
 
@@ -63,7 +63,7 @@ end
63
63
  # win32/service gem. windows_service_manager tests create a windows
64
64
  # service that starts with the system ruby and requires this gem.
65
65
  def system_windows_service_gem?
66
- windows_service_gem_check_command = %q{ruby -r "win32/daemon" -e ":noop"}
66
+ windows_service_gem_check_command = %{ruby -r "win32/daemon" -e ":noop" > #{DEV_NULL} 2>&1}
67
67
  if defined?(Bundler)
68
68
  Bundler.with_clean_env do
69
69
  # This returns true if the gem can be loaded
@@ -16,8 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require "spec_helper"
20
-
21
19
  shared_examples_for "a knife key command" do
22
20
  let(:stderr) { StringIO.new }
23
21
  let(:command) do
@@ -222,16 +222,16 @@ def selinux_enabled?
222
222
  cmd_result = cmd.run_command
223
223
  case cmd_result.exitstatus
224
224
  when 1
225
- return false
225
+ false
226
226
  when 0
227
- return true
227
+ true
228
228
  else
229
229
  raise "Unknown exit code from command #{selinuxenabled_path}: #{cmd.exitstatus}"
230
230
  end
231
231
  else
232
232
  # We assume selinux is not enabled if selinux utils are not
233
233
  # installed.
234
- return false
234
+ false
235
235
  end
236
236
  end
237
237
 
@@ -275,6 +275,10 @@ rescue SocketError
275
275
  false
276
276
  end
277
277
 
278
+ def ifconfig?
279
+ which("ifconfig")
280
+ end
281
+
278
282
  def choco_installed?
279
283
  result = ShellHelpers.powershell_out("choco --version")
280
284
  result.stderr.empty? ? true : false
@@ -16,40 +16,42 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require "win32/daemon"
19
+ if RUBY_PLATFORM =~ /mswin|mingw|windows/
20
+ require "win32/daemon"
20
21
 
21
- class SpecService < ::Win32::Daemon
22
- def service_init
23
- @test_service_file = "#{ENV["TMP"]}/spec_service_file"
24
- end
22
+ class SpecService < ::Win32::Daemon
23
+ def service_init
24
+ @test_service_file = "#{ENV["TMP"]}/spec_service_file"
25
+ end
25
26
 
26
- def service_main(*startup_parameters)
27
- while running?
28
- unless File.exists?(@test_service_file)
29
- File.open(@test_service_file, "wb") do |f|
30
- f.write("This file is created by SpecService")
27
+ def service_main(*startup_parameters)
28
+ while running?
29
+ unless File.exists?(@test_service_file)
30
+ File.open(@test_service_file, "wb") do |f|
31
+ f.write("This file is created by SpecService")
32
+ end
31
33
  end
32
- end
33
34
 
34
- sleep 1
35
+ sleep 1
36
+ end
35
37
  end
36
- end
37
38
 
38
- ################################################################################
39
- # Control Signal Callback Methods
40
- ################################################################################
39
+ ################################################################################
40
+ # Control Signal Callback Methods
41
+ ################################################################################
41
42
 
42
- def service_stop; end
43
+ def service_stop; end
43
44
 
44
- def service_pause; end
45
+ def service_pause; end
45
46
 
46
- def service_resume; end
47
+ def service_resume; end
47
48
 
48
- def service_shutdown; end
49
- end
49
+ def service_shutdown; end
50
+ end
50
51
 
51
- # To run this file as a service, it must be called as a script from within
52
- # the Windows Service framework. In that case, kick off the main loop!
53
- if __FILE__ == $0
54
- SpecService.mainloop
52
+ # To run this file as a service, it must be called as a script from within
53
+ # the Windows Service framework. In that case, kick off the main loop!
54
+ if __FILE__ == $0
55
+ SpecService.mainloop
56
+ end
55
57
  end
@@ -7,9 +7,6 @@
7
7
  # Required chef files here:
8
8
  require "chef/config"
9
9
 
10
- # Required spec files here:
11
- require "spec_helper"
12
-
13
10
  # Basic config. Nothing fancy.
14
11
  shared_context "default config options" do
15
12
  before do