vagrant-clone 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/.rakeTasks +7 -0
  3. data/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. data/.idea/misc.xml +4 -0
  5. data/.idea/modules.xml +8 -0
  6. data/.idea/runConfigurations/clone.xml +21 -0
  7. data/.idea/runConfigurations/libvirt.xml +21 -0
  8. data/.idea/vagrant-clone.iml +114 -0
  9. data/.idea/vcs.xml +6 -0
  10. data/.idea/workspace.xml +948 -0
  11. data/Gemfile +9 -3
  12. data/Gemfile.lock +123 -37
  13. data/Rakefile +2 -1
  14. data/Vagrantfile +9 -0
  15. data/cookbooks/apt/CHANGELOG.md +321 -0
  16. data/cookbooks/apt/CONTRIBUTING.md +2 -0
  17. data/cookbooks/apt/MAINTAINERS.md +15 -0
  18. data/cookbooks/apt/README.md +250 -0
  19. data/cookbooks/apt/attributes/default.rb +57 -0
  20. data/cookbooks/apt/files/15update-stamp +1 -0
  21. data/cookbooks/apt/files/apt-proxy-v2.conf +50 -0
  22. data/cookbooks/apt/libraries/helpers.rb +49 -0
  23. data/cookbooks/apt/libraries/matchers.rb +16 -0
  24. data/cookbooks/apt/metadata.json +1 -0
  25. data/cookbooks/apt/recipes/cacher-client.rb +52 -0
  26. data/cookbooks/apt/recipes/cacher-ng.rb +39 -0
  27. data/cookbooks/apt/recipes/default.rb +93 -0
  28. data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
  29. data/cookbooks/apt/resources/preference.rb +90 -0
  30. data/cookbooks/apt/templates/01proxy.erb +11 -0
  31. data/cookbooks/apt/templates/10dpkg-options.erb +8 -0
  32. data/cookbooks/apt/templates/10recommends.erb +3 -0
  33. data/cookbooks/apt/templates/20auto-upgrades.erb +5 -0
  34. data/cookbooks/apt/templates/50unattended-upgrades.erb +75 -0
  35. data/cookbooks/apt/templates/acng.conf.erb +275 -0
  36. data/cookbooks/apt/templates/unattended-upgrades.seed.erb +1 -0
  37. data/cookbooks/build-essential/.foodcritic +1 -0
  38. data/cookbooks/build-essential/CHANGELOG.md +257 -0
  39. data/cookbooks/build-essential/CONTRIBUTING.md +2 -0
  40. data/cookbooks/build-essential/MAINTAINERS.md +15 -0
  41. data/cookbooks/build-essential/README.md +134 -0
  42. data/cookbooks/build-essential/attributes/default.rb +21 -0
  43. data/cookbooks/build-essential/libraries/matchers.rb +9 -0
  44. data/cookbooks/build-essential/metadata.json +1 -0
  45. data/cookbooks/build-essential/recipes/_windows.rb +53 -0
  46. data/cookbooks/build-essential/recipes/default.rb +24 -0
  47. data/cookbooks/build-essential/resources/build_essential.rb +106 -0
  48. data/cookbooks/build-essential/resources/xcode_command_line_tools.rb +61 -0
  49. data/cookbooks/compat_resource/CHANGELOG.md +53 -0
  50. data/cookbooks/compat_resource/CONTRIBUTING.md +2 -0
  51. data/cookbooks/compat_resource/MAINTAINERS.md +16 -0
  52. data/cookbooks/compat_resource/README.md +60 -0
  53. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb +47 -0
  54. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb +40 -0
  55. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/core.rb +73 -0
  56. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb +315 -0
  57. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/platform_introspection.rb +292 -0
  58. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb +37 -0
  59. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/universal.rb +70 -0
  60. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/lazy_module_include.rb +98 -0
  61. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb +74 -0
  62. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb +510 -0
  63. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/powershell_out.rb +117 -0
  64. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb +328 -0
  65. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb +713 -0
  66. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_repository.rb +269 -0
  67. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_update.rb +105 -0
  68. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/noop.rb +56 -0
  69. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/support/yum_repo.erb +132 -0
  70. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/systemd_unit.rb +253 -0
  71. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/yum_repository.rb +136 -0
  72. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb +164 -0
  73. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb +114 -0
  74. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb +65 -0
  75. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb +52 -0
  76. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb +81 -0
  77. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/yum_repository.rb +97 -0
  78. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource.rb +214 -0
  79. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb +174 -0
  80. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb +29 -0
  81. data/cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb +8 -0
  82. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/exceptions.rb +10 -0
  83. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/log.rb +30 -0
  84. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/mixin/params_validate.rb +17 -0
  85. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/node.rb +9 -0
  86. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/property.rb +15 -0
  87. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb +65 -0
  88. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe.rb +118 -0
  89. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe_hook.rb +20 -0
  90. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb +60 -0
  91. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource.rb +156 -0
  92. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb +167 -0
  93. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_list.rb +49 -0
  94. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_set.rb +49 -0
  95. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection.rb +103 -0
  96. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb +691 -0
  97. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb +153 -0
  98. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb +33 -0
  99. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb +41 -0
  100. data/cookbooks/compat_resource/files/lib/chef_compat/property.rb +6 -0
  101. data/cookbooks/compat_resource/files/lib/chef_compat/recipe.rb +8 -0
  102. data/cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb +44 -0
  103. data/cookbooks/compat_resource/files/lib/chef_compat/resource.rb +56 -0
  104. data/cookbooks/compat_resource/files/lib/chef_upstream_version.rb +3 -0
  105. data/cookbooks/compat_resource/files/lib/compat_resource.rb +35 -0
  106. data/cookbooks/compat_resource/libraries/autoload.rb +31 -0
  107. data/cookbooks/compat_resource/metadata.json +1 -0
  108. data/cookbooks/inifile_chef_gem/CHANGELOG.md +11 -0
  109. data/cookbooks/inifile_chef_gem/README.md +46 -0
  110. data/cookbooks/inifile_chef_gem/metadata.json +51 -0
  111. data/cookbooks/inifile_chef_gem/metadata.rb +11 -0
  112. data/cookbooks/inifile_chef_gem/resources/default.rb +28 -0
  113. data/cookbooks/mariadb/CHANGELOG.md +332 -0
  114. data/cookbooks/mariadb/README.md +225 -0
  115. data/cookbooks/mariadb/attributes/default.rb +199 -0
  116. data/cookbooks/mariadb/libraries/mariadb_conn_helper.rb +53 -0
  117. data/cookbooks/mariadb/libraries/mariadb_helper.rb +216 -0
  118. data/cookbooks/mariadb/libraries/matchers.rb +21 -0
  119. data/cookbooks/mariadb/metadata.json +1 -0
  120. data/cookbooks/mariadb/providers/configuration.rb +39 -0
  121. data/cookbooks/mariadb/recipes/_audit_plugin.rb +63 -0
  122. data/cookbooks/mariadb/recipes/_debian_galera.rb +62 -0
  123. data/cookbooks/mariadb/recipes/_debian_server.rb +78 -0
  124. data/cookbooks/mariadb/recipes/_mariadb_repository.rb +29 -0
  125. data/cookbooks/mariadb/recipes/_redhat_client.rb +27 -0
  126. data/cookbooks/mariadb/recipes/_redhat_galera.rb +55 -0
  127. data/cookbooks/mariadb/recipes/_redhat_server.rb +58 -0
  128. data/cookbooks/mariadb/recipes/client.rb +47 -0
  129. data/cookbooks/mariadb/recipes/config.rb +115 -0
  130. data/cookbooks/mariadb/recipes/default.rb +46 -0
  131. data/cookbooks/mariadb/recipes/devel.rb +41 -0
  132. data/cookbooks/mariadb/recipes/galera.rb +324 -0
  133. data/cookbooks/mariadb/recipes/plugins.rb +3 -0
  134. data/cookbooks/mariadb/recipes/repository.rb +45 -0
  135. data/cookbooks/mariadb/recipes/server.rb +157 -0
  136. data/cookbooks/mariadb/resources/configuration.rb +13 -0
  137. data/cookbooks/mariadb/resources/mysql2_gem.rb +25 -0
  138. data/cookbooks/mariadb/resources/replication.rb +192 -0
  139. data/cookbooks/mariadb/templates/default/conf.d.generic.erb +19 -0
  140. data/cookbooks/mariadb/templates/default/debian.cnf.erb +12 -0
  141. data/cookbooks/mariadb/templates/default/mariadb-server.seed.erb +13 -0
  142. data/cookbooks/mariadb/templates/default/mariadb_grants.erb +42 -0
  143. data/cookbooks/mariadb/templates/default/my.cnf.erb +210 -0
  144. data/cookbooks/mariadb/templates/default/root.cnf.erb +5 -0
  145. data/cookbooks/mingw/.foodcritic +1 -0
  146. data/cookbooks/mingw/CHANGELOG.md +50 -0
  147. data/cookbooks/mingw/CONTRIBUTING.md +2 -0
  148. data/cookbooks/mingw/MAINTAINERS.md +14 -0
  149. data/cookbooks/mingw/README.md +133 -0
  150. data/cookbooks/mingw/files/default/bash.bat +17 -0
  151. data/cookbooks/mingw/files/default/custom-upgrade.sh +23 -0
  152. data/cookbooks/mingw/files/default/custom_prefix.sh +13 -0
  153. data/cookbooks/mingw/files/default/pthread.h +719 -0
  154. data/cookbooks/mingw/files/default/time.h +297 -0
  155. data/cookbooks/mingw/libraries/_helper.rb +38 -0
  156. data/cookbooks/mingw/metadata.json +1 -0
  157. data/cookbooks/mingw/recipes/default.rb +19 -0
  158. data/cookbooks/mingw/resources/get.rb +56 -0
  159. data/cookbooks/mingw/resources/msys2_package.rb +139 -0
  160. data/cookbooks/mingw/resources/tdm_gcc.rb +114 -0
  161. data/cookbooks/ohai/.foodcritic +2 -0
  162. data/cookbooks/ohai/CHANGELOG.md +166 -0
  163. data/cookbooks/ohai/CONTRIBUTING.md +2 -0
  164. data/cookbooks/ohai/MAINTAINERS.md +15 -0
  165. data/cookbooks/ohai/README.md +134 -0
  166. data/cookbooks/ohai/libraries/matchers.rb +41 -0
  167. data/cookbooks/ohai/metadata.json +1 -0
  168. data/cookbooks/ohai/recipes/default.rb +20 -0
  169. data/cookbooks/ohai/resources/hint.rb +55 -0
  170. data/cookbooks/ohai/resources/plugin.rb +117 -0
  171. data/cookbooks/selinux_policy/.gitignore +51 -0
  172. data/cookbooks/selinux_policy/.kitchen.yml +25 -0
  173. data/cookbooks/selinux_policy/.rubocop.yml +2 -0
  174. data/cookbooks/selinux_policy/.travis.yml +26 -0
  175. data/cookbooks/selinux_policy/Berksfile +8 -0
  176. data/cookbooks/selinux_policy/CHANGELOG.md +155 -0
  177. data/cookbooks/selinux_policy/LICENSE +13 -0
  178. data/cookbooks/selinux_policy/README.md +217 -0
  179. data/cookbooks/selinux_policy/Rakefile +68 -0
  180. data/cookbooks/selinux_policy/TESTING.md +2 -0
  181. data/cookbooks/selinux_policy/Thorfile +12 -0
  182. data/cookbooks/selinux_policy/attributes/default.rb +5 -0
  183. data/cookbooks/selinux_policy/chefignore +102 -0
  184. data/cookbooks/selinux_policy/libraries/helper-disabled.rb +29 -0
  185. data/cookbooks/selinux_policy/libraries/matchers.rb +57 -0
  186. data/cookbooks/selinux_policy/metadata.json +58 -0
  187. data/cookbooks/selinux_policy/metadata.rb +20 -0
  188. data/cookbooks/selinux_policy/providers/boolean.rb +28 -0
  189. data/cookbooks/selinux_policy/providers/fcontext.rb +78 -0
  190. data/cookbooks/selinux_policy/providers/module.rb +81 -0
  191. data/cookbooks/selinux_policy/providers/permissive.rb +26 -0
  192. data/cookbooks/selinux_policy/providers/port.rb +58 -0
  193. data/cookbooks/selinux_policy/recipes/default.rb +9 -0
  194. data/cookbooks/selinux_policy/recipes/install.rb +32 -0
  195. data/cookbooks/selinux_policy/resources/boolean.rb +8 -0
  196. data/cookbooks/selinux_policy/resources/fcontext.rb +8 -0
  197. data/cookbooks/selinux_policy/resources/module.rb +21 -0
  198. data/cookbooks/selinux_policy/resources/permissive.rb +6 -0
  199. data/cookbooks/selinux_policy/resources/port.rb +9 -0
  200. data/cookbooks/seven_zip/CHANGELOG.md +30 -0
  201. data/cookbooks/seven_zip/README.md +108 -0
  202. data/cookbooks/seven_zip/attributes/default.rb +31 -0
  203. data/cookbooks/seven_zip/libraries/matchers.rb +33 -0
  204. data/cookbooks/seven_zip/metadata.json +1 -0
  205. data/cookbooks/seven_zip/providers/archive.rb +68 -0
  206. data/cookbooks/seven_zip/recipes/default.rb +41 -0
  207. data/cookbooks/seven_zip/resources/archive.rb +29 -0
  208. data/cookbooks/windows/.foodcritic +2 -0
  209. data/cookbooks/windows/CHANGELOG.md +528 -0
  210. data/cookbooks/windows/CONTRIBUTING.md +2 -0
  211. data/cookbooks/windows/MAINTAINERS.md +21 -0
  212. data/cookbooks/windows/README.md +803 -0
  213. data/cookbooks/windows/attributes/default.rb +21 -0
  214. data/cookbooks/windows/files/dism_features.rb +45 -0
  215. data/cookbooks/windows/libraries/matchers.rb +586 -0
  216. data/cookbooks/windows/libraries/powershell_helper.rb +53 -0
  217. data/cookbooks/windows/libraries/registry_helper.rb +356 -0
  218. data/cookbooks/windows/libraries/version.rb +207 -0
  219. data/cookbooks/windows/libraries/version_helper.rb +79 -0
  220. data/cookbooks/windows/libraries/windows_helper.rb +174 -0
  221. data/cookbooks/windows/libraries/windows_privileged.rb +103 -0
  222. data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
  223. data/cookbooks/windows/metadata.json +1 -0
  224. data/cookbooks/windows/recipes/default.rb +21 -0
  225. data/cookbooks/windows/resources/auto_run.rb +46 -0
  226. data/cookbooks/windows/resources/certificate.rb +166 -0
  227. data/cookbooks/windows/resources/certificate_binding.rb +128 -0
  228. data/cookbooks/windows/resources/feature.rb +82 -0
  229. data/cookbooks/windows/resources/feature_dism.rb +108 -0
  230. data/cookbooks/windows/resources/feature_powershell.rb +70 -0
  231. data/cookbooks/windows/resources/feature_servermanagercmd.rb +76 -0
  232. data/cookbooks/windows/resources/font.rb +80 -0
  233. data/cookbooks/windows/resources/http_acl.rb +110 -0
  234. data/cookbooks/windows/resources/pagefile.rb +152 -0
  235. data/cookbooks/windows/resources/path.rb +54 -0
  236. data/cookbooks/windows/resources/printer.rb +103 -0
  237. data/cookbooks/windows/resources/printer_port.rb +101 -0
  238. data/cookbooks/windows/resources/share.rb +291 -0
  239. data/cookbooks/windows/resources/shortcut.rb +53 -0
  240. data/cookbooks/windows/resources/task.rb +384 -0
  241. data/cookbooks/windows/resources/zipfile.rb +125 -0
  242. data/cookbooks/yum/.foodcritic +1 -0
  243. data/cookbooks/yum/CHANGELOG.md +351 -0
  244. data/cookbooks/yum/CONTRIBUTING.md +2 -0
  245. data/cookbooks/yum/MAINTAINERS.md +16 -0
  246. data/cookbooks/yum/README.md +125 -0
  247. data/cookbooks/yum/attributes/main.rb +103 -0
  248. data/cookbooks/yum/libraries/matchers.rb +9 -0
  249. data/cookbooks/yum/metadata.json +1 -0
  250. data/cookbooks/yum/recipes/default.rb +26 -0
  251. data/cookbooks/yum/recipes/dnf_yum_compat.rb +29 -0
  252. data/cookbooks/yum/resources/globalconfig.rb +119 -0
  253. data/cookbooks/yum/templates/.DS_Store +0 -0
  254. data/cookbooks/yum/templates/main.erb +276 -0
  255. data/cookbooks/yum-epel/CHANGELOG.md +138 -0
  256. data/cookbooks/yum-epel/CONTRIBUTING.md +2 -0
  257. data/cookbooks/yum-epel/MAINTAINERS.md +19 -0
  258. data/cookbooks/yum-epel/README.md +172 -0
  259. data/cookbooks/yum-epel/attributes/default.rb +8 -0
  260. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +15 -0
  261. data/cookbooks/yum-epel/attributes/epel-source.rb +15 -0
  262. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +15 -0
  263. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +15 -0
  264. data/cookbooks/yum-epel/attributes/epel-testing.rb +15 -0
  265. data/cookbooks/yum-epel/attributes/epel.rb +21 -0
  266. data/cookbooks/yum-epel/metadata.json +1 -0
  267. data/cookbooks/yum-epel/recipes/default.rb +27 -0
  268. data/cookbooks/yum-scl/.kitchen.dokken.yml +24 -0
  269. data/cookbooks/yum-scl/.kitchen.yml +24 -0
  270. data/cookbooks/yum-scl/.rubocop.yml +6 -0
  271. data/cookbooks/yum-scl/.travis.yml +28 -0
  272. data/cookbooks/yum-scl/Berksfile +3 -0
  273. data/cookbooks/yum-scl/Berksfile.lock +25 -0
  274. data/cookbooks/yum-scl/CHANGELOG.md +11 -0
  275. data/cookbooks/yum-scl/Gemfile +46 -0
  276. data/cookbooks/yum-scl/README.md +76 -0
  277. data/cookbooks/yum-scl/attributes/centos.rb +83 -0
  278. data/cookbooks/yum-scl/attributes/default.rb +15 -0
  279. data/cookbooks/yum-scl/attributes/scientific.rb +1 -0
  280. data/cookbooks/yum-scl/files/default/RPM-GPG-KEY-CentOS-SIG-SCLo +20 -0
  281. data/cookbooks/yum-scl/libraries/yum_scl_helper.rb +33 -0
  282. data/cookbooks/yum-scl/metadata.json +42 -0
  283. data/cookbooks/yum-scl/metadata.rb +12 -0
  284. data/cookbooks/yum-scl/recipes/chef_install.rb +52 -0
  285. data/cookbooks/yum-scl/recipes/default.rb +17 -0
  286. data/cookbooks/yum-scl/recipes/native_install.rb +35 -0
  287. data/lib/vagrant-clone/command/clone.rb +66 -61
  288. data/lib/vagrant-clone/errors.rb +61 -0
  289. data/lib/vagrant-clone/util/clone_manager_base.rb +69 -0
  290. data/lib/vagrant-clone/util/clone_managers/docker.rb +31 -0
  291. data/lib/vagrant-clone/util/clone_managers/libvirt.rb +254 -0
  292. data/lib/vagrant-clone/util/vagrantfile_managers/docker.rb +154 -0
  293. data/lib/vagrant-clone/util/vagrantfile_managers/libvirt.rb +159 -0
  294. data/lib/vagrant-clone/version.rb +2 -2
  295. data/lib/vagrant-clone.rb +6 -6
  296. data/libvirt.txt +7 -0
  297. data/performance_testing.rb +165 -0
  298. data/results.txt +45 -0
  299. data/scripts/create_box.sh +134 -0
  300. data/test.rb +92 -0
  301. data/tools/create_box.sh +130 -0
  302. data/vagrant-clone.gemspec +7 -7
  303. metadata +296 -5
  304. data/lib/vagrant-clone/command/errors.rb +0 -16
  305. data/lib/vagrant-clone/command/provider/docker.rb +0 -13
  306. data/lib/vagrant-clone/utils/vagrantfile_manager.rb +0 -47
@@ -0,0 +1,21 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
+ # Cookbook:: windows
4
+ # Attribute:: default
5
+ #
6
+ # Copyright:: 2011-2017, Chef Software, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ default['windows']['rubyzipversion'] = nil
@@ -0,0 +1,45 @@
1
+ #
2
+ # Author:: Wade Peacock <wade.peacock@visioncritical.com>
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
+ Ohai.plugin(:DismFeatures) do
19
+ provides 'dism_features'
20
+ collect_data(:windows) do
21
+ dism_features Mash.new
22
+ # This is for 32-bit ruby/chef client on 64-bit Windows
23
+ # This emulates the locate_sysnative_cmd helper as it is not available
24
+ cmd = 'dism.exe'
25
+ dism = if ::File.exist?("#{ENV['WINDIR']}\\sysnative\\#{cmd}")
26
+ "#{ENV['WINDIR']}\\sysnative\\#{cmd}"
27
+ elsif ::File.exist?("#{ENV['WINDIR']}\\system32\\#{cmd}")
28
+ "#{ENV['WINDIR']}\\system32\\#{cmd}"
29
+ else
30
+ cmd
31
+ end
32
+ # Grab raw feature information from dism command line
33
+ raw_list_of_features = shell_out("#{dism} /Get-Features /Online /Format:Table").stdout
34
+ # Split stdout into an array by windows line ending
35
+ features_list = raw_list_of_features.split("\r\n")
36
+ features_list.each do |feature_details_raw|
37
+ # Skip lines that do not match Enable / Disable
38
+ next unless feature_details_raw =~ /(En|Dis)able/
39
+ # Strip trailing whitespace characters then split on n number of spaces + | + n number of spaces
40
+ feature_details = feature_details_raw.strip.split(/\s+[|]\s+/)
41
+ # Add to Mash
42
+ dism_features[feature_details.first] = feature_details.last
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,586 @@
1
+ if defined?(ChefSpec)
2
+
3
+ ChefSpec.define_matcher :windows_auto_run
4
+ ChefSpec.define_matcher :windows_certificate
5
+ ChefSpec.define_matcher :windows_certificate_binding
6
+ ChefSpec.define_matcher :windows_feature
7
+ ChefSpec.define_matcher :windows_feature_dism
8
+ ChefSpec.define_matcher :windows_feature_servermanagercmd
9
+ ChefSpec.define_matcher :windows_feature_powershell
10
+ ChefSpec.define_matcher :windows_font
11
+ ChefSpec.define_matcher :windows_http_acl
12
+ ChefSpec.define_matcher :windows_pagefile
13
+ ChefSpec.define_matcher :windows_path
14
+ ChefSpec.define_matcher :windows_printer
15
+ ChefSpec.define_matcher :windows_printer_port
16
+ ChefSpec.define_matcher :windows_share
17
+ ChefSpec.define_matcher :windows_shortcut
18
+ ChefSpec.define_matcher :windows_task
19
+ ChefSpec.define_matcher :windows_zipfile
20
+
21
+ #
22
+ # Assert that a +windows_certificate+ resource exists in the Chef run with the
23
+ # action +:create+. Given a Chef Recipe that creates 'c:\test\mycert.pfx' as a
24
+ # +windows_certificate+:
25
+ #
26
+ # windows_certificate 'c:\test\mycert.pfx' do
27
+ # action :create
28
+ # end
29
+ #
30
+ # The Examples section demonstrates the different ways to test a
31
+ # +windows_certificate+ resource with ChefSpec.
32
+ #
33
+ # @example Assert that a +windows_certificate+ was created
34
+ # expect(chef_run).to create_windows_certificate('c:\test\mycert.pfx')
35
+ #
36
+ #
37
+ # @param [String, Regex] resource_name
38
+ # the name of the resource to match
39
+ #
40
+ # @return [ChefSpec::Matchers::ResourceMatcher]
41
+ #
42
+ def create_windows_certificate(resource_name)
43
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_certificate, :create, resource_name)
44
+ end
45
+
46
+ #
47
+ # Assert that a +windows_certificate+ resource exists in the Chef run with the
48
+ # action +:delete+. Given a Chef Recipe that deletes "me.acme.com" as a
49
+ # +windows_certificate+:
50
+ #
51
+ # windows_certificate 'me.acme.com' do
52
+ # action :delete
53
+ # end
54
+ #
55
+ # The Examples section demonstrates the different ways to test a
56
+ # +windows_certificate+ resource with ChefSpec.
57
+ #
58
+ # @example Assert that a +windows_certificate+ was _not_ deleted
59
+ # expect(chef_run).to_not delete_windows_certificate('me.acme.com')
60
+ #
61
+ #
62
+ # @param [String, Regex] resource_name
63
+ # the name of the resource to match
64
+ #
65
+ # @return [ChefSpec::Matchers::ResourceMatcher]
66
+ #
67
+ def delete_windows_certificate(resource_name)
68
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_certificate, :delete, resource_name)
69
+ end
70
+
71
+ #
72
+ # Assert that a +windows_certificate+ resource exists in the Chef run with the
73
+ # action +:acl_add+. Given a Chef Recipe that adds a private key acl to "me.acme.com" as a
74
+ # +windows_certificate+:
75
+ #
76
+ # windows_certificate 'me.acme.com' do
77
+ # private_key_acl ['acme\fred', 'pc\jane']
78
+ # action :acl_add
79
+ # end
80
+ #
81
+ # The Examples section demonstrates the different ways to test a
82
+ # +windows_certificate+ resource with ChefSpec.
83
+ #
84
+ # @example Assert that a +windows_certificate+ was _not_ removed
85
+ # expect(chef_run).to add_acl_to_windows_certificate('me.acme.com').with(private_key_acl: ['acme\fred', 'pc\jane'])
86
+ #
87
+ #
88
+ # @param [String, Regex] resource_name
89
+ # the name of the resource to match
90
+ #
91
+ # @return [ChefSpec::Matchers::ResourceMatcher]
92
+ #
93
+ def add_acl_to_windows_certificate(resource_name)
94
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_certificate, :acl_add, resource_name)
95
+ end
96
+
97
+ #
98
+ # Assert that a +windows_feature+ resource exists in the Chef run with the
99
+ # action +:install+. Given a Chef Recipe that installs "NetFX3" as a
100
+ # +windows_feature+:
101
+ #
102
+ # windows_feature 'NetFX3' do
103
+ # action :install
104
+ # end
105
+ #
106
+ # The Examples section demonstrates the different ways to test a
107
+ # +windows_feature+ resource with ChefSpec.
108
+ #
109
+ # @example Assert that a +windows_feature+ was installed
110
+ # expect(chef_run).to install_windows_feature('NetFX3')
111
+ #
112
+ # @example Assert that a +windows_feature+ was _not_ installed
113
+ # expect(chef_run).to_not install_windows_feature('NetFX3')
114
+ #
115
+ #
116
+ # @param [String, Regex] resource_name
117
+ # the name of the resource to match
118
+ #
119
+ # @return [ChefSpec::Matchers::ResourceMatcher]
120
+ #
121
+ def install_windows_feature(resource_name)
122
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature, :install, resource_name)
123
+ end
124
+
125
+ def install_windows_feature_servermanagercmd(resource_name)
126
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_servermanagercmd, :install, resource_name)
127
+ end
128
+
129
+ def install_windows_feature_dism(resource_name)
130
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_dism, :install, resource_name)
131
+ end
132
+
133
+ def install_windows_feature_powershell(resource_name)
134
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_powershell, :install, resource_name)
135
+ end
136
+
137
+ #
138
+ # Assert that a +windows_feature+ resource exists in the Chef run with the
139
+ # action +:remove+. Given a Chef Recipe that removes "NetFX3" as a
140
+ # +windows_feature+:
141
+ #
142
+ # windows_feature 'NetFX3' do
143
+ # action :remove
144
+ # end
145
+ #
146
+ # The Examples section demonstrates the different ways to test a
147
+ # +windows_feature+ resource with ChefSpec.
148
+ #
149
+ # @example Assert that a +windows_feature+ was removed
150
+ # expect(chef_run).to remove_windows_feature('NetFX3')
151
+ #
152
+ #
153
+ # @param [String, Regex] resource_name
154
+ # the name of the resource to match
155
+ #
156
+ # @return [ChefSpec::Matchers::ResourceMatcher]
157
+ #
158
+ def remove_windows_feature(resource_name)
159
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature, :remove, resource_name)
160
+ end
161
+
162
+ def remove_windows_feature_servermanagercmd(resource_name)
163
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_servermanagercmd, :remove, resource_name)
164
+ end
165
+
166
+ def remove_windows_feature_dism(resource_name)
167
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_dism, :remove, resource_name)
168
+ end
169
+
170
+ def remove_windows_feature_powershell(resource_name)
171
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_powershell, :remove, resource_name)
172
+ end
173
+
174
+ #
175
+ # Assert that a +windows_feature+ resource exists in the Chef run with the
176
+ # action +:delete+. Given a Chef Recipe that deletes "NetFX3" as a
177
+ # +windows_feature+:
178
+ #
179
+ # windows_feature 'NetFX3' do
180
+ # action :delete
181
+ # end
182
+ #
183
+ # The Examples section demonstrates the different ways to test a
184
+ # +windows_feature+ resource with ChefSpec.
185
+ #
186
+ # @example Assert that a +windows_feature+ was deleted
187
+ # expect(chef_run).to delete_windows_feature('NetFX3')
188
+ #
189
+ #
190
+ # @param [String, Regex] resource_name
191
+ # the name of the resource to match
192
+ #
193
+ # @return [ChefSpec::Matchers::ResourceMatcher]
194
+ #
195
+ def delete_windows_feature(resource_name)
196
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature, :delete, resource_name)
197
+ end
198
+
199
+ def delete_windows_feature_dism(resource_name)
200
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_dism, :delete, resource_name)
201
+ end
202
+
203
+ def delete_windows_feature_powershell(resource_name)
204
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_feature_powershell, :delete, resource_name)
205
+ end
206
+
207
+ #
208
+ # Assert that a +windows_task+ resource exists in the Chef run with the
209
+ # action +:create+. Given a Chef Recipe that creates "mytask" as a
210
+ # +windows_task+:
211
+ #
212
+ # windows_task 'mytask' do
213
+ # command 'mybatch.bat'
214
+ # action :create
215
+ # end
216
+ #
217
+ # The Examples section demonstrates the different ways to test a
218
+ # +windows_task+ resource with ChefSpec.
219
+ #
220
+ # @example Assert that a +windows_task+ was created
221
+ # expect(chef_run).to create_windows_task('mytask')
222
+ #
223
+ #
224
+ # @param [String, Regex] resource_name
225
+ # the name of the resource to match
226
+ #
227
+ # @return [ChefSpec::Matchers::ResourceMatcher]
228
+ #
229
+ def create_windows_task(resource_name)
230
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :create, resource_name)
231
+ end
232
+
233
+ #
234
+ # Assert that a +windows_task+ resource exists in the Chef run with the
235
+ # action +:disable+. Given a Chef Recipe that creates "mytask" as a
236
+ # +windows_task+:
237
+ #
238
+ # windows_task 'mytask' do
239
+ # action :disable
240
+ # end
241
+ #
242
+ # The Examples section demonstrates the different ways to test a
243
+ # +windows_task+ resource with ChefSpec.
244
+ #
245
+ # @example Assert that a +windows_task+ was disabled
246
+ # expect(chef_run).to disable_windows_task('mytask')
247
+ #
248
+ #
249
+ # @param [String, Regex] resource_name
250
+ # the name of the resource to match
251
+ #
252
+ # @return [ChefSpec::Matchers::ResourceMatcher]
253
+ #
254
+ def disable_windows_task(resource_name)
255
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :disable, resource_name)
256
+ end
257
+
258
+ #
259
+ # Assert that a +windows_task+ resource exists in the Chef run with the
260
+ # action +:enable+. Given a Chef Recipe that creates "mytask" as a
261
+ # +windows_task+:
262
+ #
263
+ # windows_task 'mytask' do
264
+ # action :enable
265
+ # end
266
+ #
267
+ # The Examples section demonstrates the different ways to test a
268
+ # +windows_task+ resource with ChefSpec.
269
+ #
270
+ # @example Assert that a +windows_task+ was enabled
271
+ # expect(chef_run).to enable_windows_task('mytask')
272
+ #
273
+ #
274
+ # @param [String, Regex] resource_name
275
+ # the name of the resource to match
276
+ #
277
+ # @return [ChefSpec::Matchers::ResourceMatcher]
278
+ #
279
+ def enable_windows_task(resource_name)
280
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :enable, resource_name)
281
+ end
282
+
283
+ #
284
+ # Assert that a +windows_task+ resource exists in the Chef run with the
285
+ # action +:delete+. Given a Chef Recipe that deletes "mytask" as a
286
+ # +windows_task+:
287
+ #
288
+ # windows_task 'mytask' do
289
+ # action :delete
290
+ # end
291
+ #
292
+ # The Examples section demonstrates the different ways to test a
293
+ # +windows_task+ resource with ChefSpec.
294
+ #
295
+ # @example Assert that a +windows_task+ was deleted
296
+ # expect(chef_run).to delete_windows_task('mytask')
297
+ #
298
+ #
299
+ # @param [String, Regex] resource_name
300
+ # the name of the resource to match
301
+ #
302
+ # @return [ChefSpec::Matchers::ResourceMatcher]
303
+ #
304
+ def delete_windows_task(resource_name)
305
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :delete, resource_name)
306
+ end
307
+
308
+ #
309
+ # Assert that a +windows_task+ resource exists in the Chef run with the
310
+ # action +:run+. Given a Chef Recipe that runs "mytask" as a
311
+ # +windows_task+:
312
+ #
313
+ # windows_task 'mytask' do
314
+ # action :run
315
+ # end
316
+ #
317
+ # The Examples section demonstrates the different ways to test a
318
+ # +windows_task+ resource with ChefSpec.
319
+ #
320
+ # @example Assert that a +windows_task+ was run
321
+ # expect(chef_run).to run_windows_task('mytask')
322
+ #
323
+ #
324
+ # @param [String, Regex] resource_name
325
+ # the name of the resource to match
326
+ #
327
+ # @return [ChefSpec::Matchers::ResourceMatcher]
328
+ #
329
+ def run_windows_task(resource_name)
330
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :run, resource_name)
331
+ end
332
+
333
+ #
334
+ # Assert that a +windows_task+ resource exists in the Chef run with the
335
+ # action +:change+. Given a Chef Recipe that changes "mytask" as a
336
+ # +windows_task+:
337
+ #
338
+ # windows_task 'mytask' do
339
+ # action :change
340
+ # end
341
+ #
342
+ # The Examples section demonstrates the different ways to test a
343
+ # +windows_task+ resource with ChefSpec.
344
+ #
345
+ # @example Assert that a +windows_task+ was changed
346
+ # expect(chef_run).to change_windows_task('mytask')
347
+ #
348
+ #
349
+ # @param [String, Regex] resource_name
350
+ # the name of the resource to match
351
+ #
352
+ # @return [ChefSpec::Matchers::ResourceMatcher]
353
+ #
354
+ def change_windows_task(resource_name)
355
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_task, :change, resource_name)
356
+ end
357
+
358
+ #
359
+ # Assert that a +windows_path+ resource exists in the Chef run with the
360
+ # action +:add+. Given a Chef Recipe that adds "C:\7-Zip" to the Windows
361
+ # PATH env var
362
+ #
363
+ # windows_path 'C:\7-Zip' do
364
+ # action :add
365
+ # end
366
+ #
367
+ # The Examples section demonstrates the different ways to test a
368
+ # +windows_path+ resource with ChefSpec.
369
+ #
370
+ # @example Assert that a +windows_path+ was added
371
+ # expect(chef_run).to add_windows_path('C:\7-Zip')
372
+ #
373
+ #
374
+ # @param [String, Regex] resource_name
375
+ # the name of the resource to match
376
+ #
377
+ # @return [ChefSpec::Matchers::ResourceMatcher]
378
+ #
379
+ def add_windows_path(resource_name)
380
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_path, :add, resource_name)
381
+ end
382
+
383
+ #
384
+ # Assert that a +windows_path+ resource exists in the Chef run with the
385
+ # action +:remove+. Given a Chef Recipe that removes "C:\7-Zip" from the
386
+ # Windows PATH env var
387
+ #
388
+ # windows_path 'C:\7-Zip' do
389
+ # action :remove
390
+ # end
391
+ #
392
+ # The Examples section demonstrates the different ways to test a
393
+ # +windows_path+ resource with ChefSpec.
394
+ #
395
+ # @example Assert that a +windows_path+ was removed
396
+ # expect(chef_run).to remove_windows_path('C:\7-Zip')
397
+ #
398
+ #
399
+ # @param [String, Regex] resource_name
400
+ # the name of the resource to match
401
+ #
402
+ # @return [ChefSpec::Matchers::ResourceMatcher]
403
+ #
404
+ def remove_windows_path(resource_name)
405
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_path, :remove, resource_name)
406
+ end
407
+
408
+ #
409
+ # Assert that a +windows_pagefile+ resource exists in the Chef run with the
410
+ # action +:set+. Given a Chef Recipe that sets a pagefile
411
+ #
412
+ # windows_pagefile "pagefile" do
413
+ # system_managed true
414
+ # initial_size 1024
415
+ # maximum_size 4096
416
+ # end
417
+ #
418
+ # The Examples section demonstrates the different ways to test a
419
+ # +windows_pagefile+ resource with ChefSpec.
420
+ #
421
+ # @example Assert that a +windows_pagefile+ was set
422
+ # expect(chef_run).to set_windows_pagefile('pagefile').with(
423
+ # initial_size: 1024)
424
+ #
425
+ #
426
+ # @param [String, Regex] resource_name
427
+ # the name of the resource to match
428
+ #
429
+ # @return [ChefSpec::Matchers::ResourceMatcher]
430
+ #
431
+ def set_windows_pagefile(resource_name)
432
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_pagefile, :set, resource_name)
433
+ end
434
+
435
+ #
436
+ # Assert that a +windows_zipfile+ resource exists in the Chef run with the
437
+ # action +:unzip+. Given a Chef Recipe that extracts "SysinternalsSuite.zip"
438
+ # to c:/bin
439
+ #
440
+ # windows_zipfile "c:/bin" do
441
+ # source "http://download.sysinternals.com/Files/SysinternalsSuite.zip"
442
+ # action :unzip
443
+ # not_if {::File.exists?("c:/bin/PsExec.exe")}
444
+ # end
445
+ #
446
+ # The Examples section demonstrates the different ways to test a
447
+ # +windows_zipfile+ resource with ChefSpec.
448
+ #
449
+ # @example Assert that a +windows_zipfile+ was unzipped
450
+ # expect(chef_run).to unzip_windows_zipfile_to('c:/bin')
451
+ #
452
+ #
453
+ # @param [String, Regex] resource_name
454
+ # the name of the resource to match
455
+ #
456
+ # @return [ChefSpec::Matchers::ResourceMatcher]
457
+ #
458
+ def unzip_windows_zipfile_to(resource_name)
459
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_zipfile, :unzip, resource_name)
460
+ end
461
+
462
+ #
463
+ # Assert that a +windows_zipfile+ resource exists in the Chef run with the
464
+ # action +:zip+. Given a Chef Recipe that zips "c:/src"
465
+ # to c:/code.zip
466
+ #
467
+ # windows_zipfile "c:/code.zip" do
468
+ # source "c:/src"
469
+ # action :zip
470
+ # end
471
+ #
472
+ # The Examples section demonstrates the different ways to test a
473
+ # +windows_zipfile+ resource with ChefSpec.
474
+ #
475
+ # @example Assert that a +windows_zipfile+ was zipped
476
+ # expect(chef_run).to zip_windows_zipfile_to('c:/code.zip')
477
+ #
478
+ #
479
+ # @param [String, Regex] resource_name
480
+ # the name of the resource to match
481
+ #
482
+ # @return [ChefSpec::Matchers::ResourceMatcher]
483
+ #
484
+ def zip_windows_zipfile_to(resource_name)
485
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_zipfile, :zip, resource_name)
486
+ end
487
+
488
+ #
489
+ # Assert that a +windows_share+ resource exists in the Chef run with the
490
+ # action +:create+. Given a Chef Recipe that shares "c:/src"
491
+ # as Src
492
+ #
493
+ # windows_share "Src" do
494
+ # path "c:/src"
495
+ # action :create
496
+ # end
497
+ #
498
+ # The Examples section demonstrates the different ways to test a
499
+ # +windows_share+ resource with ChefSpec.
500
+ #
501
+ # @example Assert that a +windows_share+ was created
502
+ # expect(chef_run).to create_windows_share('Src')
503
+ #
504
+ #
505
+ # @param [String, Regex] resource_name
506
+ # the name of the resource to match
507
+ #
508
+ # @return [ChefSpec::Matchers::ResourceMatcher]
509
+ #
510
+ def create_windows_share(resource_name)
511
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_share, :create, resource_name)
512
+ end
513
+
514
+ #
515
+ # Assert that a +windows_share+ resource exists in the Chef run with the
516
+ # action +:delete+. Given a Chef Recipe that deletes share "c:/src"
517
+ #
518
+ # windows_share "Src" do
519
+ # action :delete
520
+ # end
521
+ #
522
+ # The Examples section demonstrates the different ways to test a
523
+ # +windows_share+ resource with ChefSpec.
524
+ #
525
+ # @example Assert that a +windows_share+ was created
526
+ # expect(chef_run).to delete_windows_share('Src')
527
+ #
528
+ #
529
+ # @param [String, Regex] resource_name
530
+ # the name of the resource to match
531
+ #
532
+ # @return [ChefSpec::Matchers::ResourceMatcher]
533
+ #
534
+ def delete_windows_share(resource_name)
535
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_share, :delete, resource_name)
536
+ end
537
+
538
+ # All the other less commonly used LWRPs
539
+ def create_windows_shortcut(resource_name)
540
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_shortcut, :create, resource_name)
541
+ end
542
+
543
+ def create_windows_auto_run(resource_name)
544
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_auto_run, :create, resource_name)
545
+ end
546
+
547
+ def remove_windows_auto_run(resource_name)
548
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_auto_run, :remove, resource_name)
549
+ end
550
+
551
+ def create_windows_printer(resource_name)
552
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_printer, :create, resource_name)
553
+ end
554
+
555
+ def delete_windows_printer(resource_name)
556
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_printer, :delete, resource_name)
557
+ end
558
+
559
+ def create_windows_printer_port(resource_name)
560
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_printer_port, :create, resource_name)
561
+ end
562
+
563
+ def delete_windows_printer_port(resource_name)
564
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_printer_port, :delete, resource_name)
565
+ end
566
+
567
+ def install_windows_font(resource_name)
568
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_font, :install, resource_name)
569
+ end
570
+
571
+ def create_windows_certificate_binding(resource_name)
572
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_certificate_binding, :create, resource_name)
573
+ end
574
+
575
+ def delete_windows_certificate_binding(resource_name)
576
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_certificate_binding, :delete, resource_name)
577
+ end
578
+
579
+ def create_windows_http_acl(resource_name)
580
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_http_acl, :create, resource_name)
581
+ end
582
+
583
+ def delete_windows_http_acl(resource_name)
584
+ ChefSpec::Matchers::ResourceMatcher.new(:windows_http_acl, :delete, resource_name)
585
+ end
586
+ end
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
+ # Cookbook:: windows
4
+ # Library:: helper
5
+ #
6
+ # Copyright:: 2011-2017, Chef Software, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ require 'chef/mixin/shell_out'
22
+
23
+ module Powershell
24
+ module Helper
25
+ include Chef::Mixin::ShellOut
26
+
27
+ def powershell_installed?
28
+ !powershell_version.nil?
29
+ end
30
+
31
+ def interpreter
32
+ # force 64-bit powershell from 32-bit ruby process
33
+ if ::File.exist?("#{ENV['WINDIR']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe")
34
+ "#{ENV['WINDIR']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
35
+ elsif ::File.exist?("#{ENV['WINDIR']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe")
36
+ "#{ENV['WINDIR']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe"
37
+ else
38
+ 'powershell.exe'
39
+ end
40
+ end
41
+
42
+ def powershell_version
43
+ cmd = shell_out("#{interpreter} -InputFormat none -Command \"& echo $PSVersionTable.psversion.major\"")
44
+ if cmd.stdout.empty? # PowerShell 1.0 doesn't have a $PSVersionTable
45
+ 1
46
+ else
47
+ Regexp.last_match(1).to_i if cmd.stdout =~ /^(\d+)/
48
+ end
49
+ rescue Errno::ENOENT
50
+ nil
51
+ end
52
+ end
53
+ end