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.
- checksums.yaml +4 -4
- data/.idea/.rakeTasks +7 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/runConfigurations/clone.xml +21 -0
- data/.idea/runConfigurations/libvirt.xml +21 -0
- data/.idea/vagrant-clone.iml +114 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +948 -0
- data/Gemfile +9 -3
- data/Gemfile.lock +123 -37
- data/Rakefile +2 -1
- data/Vagrantfile +9 -0
- data/cookbooks/apt/CHANGELOG.md +321 -0
- data/cookbooks/apt/CONTRIBUTING.md +2 -0
- data/cookbooks/apt/MAINTAINERS.md +15 -0
- data/cookbooks/apt/README.md +250 -0
- data/cookbooks/apt/attributes/default.rb +57 -0
- data/cookbooks/apt/files/15update-stamp +1 -0
- data/cookbooks/apt/files/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +49 -0
- data/cookbooks/apt/libraries/matchers.rb +16 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/recipes/cacher-client.rb +52 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +39 -0
- data/cookbooks/apt/recipes/default.rb +93 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +90 -0
- data/cookbooks/apt/templates/01proxy.erb +11 -0
- data/cookbooks/apt/templates/10dpkg-options.erb +8 -0
- data/cookbooks/apt/templates/10recommends.erb +3 -0
- data/cookbooks/apt/templates/20auto-upgrades.erb +5 -0
- data/cookbooks/apt/templates/50unattended-upgrades.erb +75 -0
- data/cookbooks/apt/templates/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/build-essential/.foodcritic +1 -0
- data/cookbooks/build-essential/CHANGELOG.md +257 -0
- data/cookbooks/build-essential/CONTRIBUTING.md +2 -0
- data/cookbooks/build-essential/MAINTAINERS.md +15 -0
- data/cookbooks/build-essential/README.md +134 -0
- data/cookbooks/build-essential/attributes/default.rb +21 -0
- data/cookbooks/build-essential/libraries/matchers.rb +9 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_windows.rb +53 -0
- data/cookbooks/build-essential/recipes/default.rb +24 -0
- data/cookbooks/build-essential/resources/build_essential.rb +106 -0
- data/cookbooks/build-essential/resources/xcode_command_line_tools.rb +61 -0
- data/cookbooks/compat_resource/CHANGELOG.md +53 -0
- data/cookbooks/compat_resource/CONTRIBUTING.md +2 -0
- data/cookbooks/compat_resource/MAINTAINERS.md +16 -0
- data/cookbooks/compat_resource/README.md +60 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb +47 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb +40 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/core.rb +73 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb +315 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/platform_introspection.rb +292 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb +37 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/universal.rb +70 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/lazy_module_include.rb +98 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb +74 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb +510 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/powershell_out.rb +117 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb +328 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb +713 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_repository.rb +269 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_update.rb +105 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/noop.rb +56 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/support/yum_repo.erb +132 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/systemd_unit.rb +253 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/yum_repository.rb +136 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb +164 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb +114 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb +65 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb +52 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb +81 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/yum_repository.rb +97 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource.rb +214 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb +174 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb +29 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb +8 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/exceptions.rb +10 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/log.rb +30 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/mixin/params_validate.rb +17 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/node.rb +9 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/property.rb +15 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb +65 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe.rb +118 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe_hook.rb +20 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb +60 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource.rb +156 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb +167 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_list.rb +49 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_set.rb +49 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection.rb +103 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb +691 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb +153 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb +33 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb +41 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/property.rb +6 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/recipe.rb +8 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb +44 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/resource.rb +56 -0
- data/cookbooks/compat_resource/files/lib/chef_upstream_version.rb +3 -0
- data/cookbooks/compat_resource/files/lib/compat_resource.rb +35 -0
- data/cookbooks/compat_resource/libraries/autoload.rb +31 -0
- data/cookbooks/compat_resource/metadata.json +1 -0
- data/cookbooks/inifile_chef_gem/CHANGELOG.md +11 -0
- data/cookbooks/inifile_chef_gem/README.md +46 -0
- data/cookbooks/inifile_chef_gem/metadata.json +51 -0
- data/cookbooks/inifile_chef_gem/metadata.rb +11 -0
- data/cookbooks/inifile_chef_gem/resources/default.rb +28 -0
- data/cookbooks/mariadb/CHANGELOG.md +332 -0
- data/cookbooks/mariadb/README.md +225 -0
- data/cookbooks/mariadb/attributes/default.rb +199 -0
- data/cookbooks/mariadb/libraries/mariadb_conn_helper.rb +53 -0
- data/cookbooks/mariadb/libraries/mariadb_helper.rb +216 -0
- data/cookbooks/mariadb/libraries/matchers.rb +21 -0
- data/cookbooks/mariadb/metadata.json +1 -0
- data/cookbooks/mariadb/providers/configuration.rb +39 -0
- data/cookbooks/mariadb/recipes/_audit_plugin.rb +63 -0
- data/cookbooks/mariadb/recipes/_debian_galera.rb +62 -0
- data/cookbooks/mariadb/recipes/_debian_server.rb +78 -0
- data/cookbooks/mariadb/recipes/_mariadb_repository.rb +29 -0
- data/cookbooks/mariadb/recipes/_redhat_client.rb +27 -0
- data/cookbooks/mariadb/recipes/_redhat_galera.rb +55 -0
- data/cookbooks/mariadb/recipes/_redhat_server.rb +58 -0
- data/cookbooks/mariadb/recipes/client.rb +47 -0
- data/cookbooks/mariadb/recipes/config.rb +115 -0
- data/cookbooks/mariadb/recipes/default.rb +46 -0
- data/cookbooks/mariadb/recipes/devel.rb +41 -0
- data/cookbooks/mariadb/recipes/galera.rb +324 -0
- data/cookbooks/mariadb/recipes/plugins.rb +3 -0
- data/cookbooks/mariadb/recipes/repository.rb +45 -0
- data/cookbooks/mariadb/recipes/server.rb +157 -0
- data/cookbooks/mariadb/resources/configuration.rb +13 -0
- data/cookbooks/mariadb/resources/mysql2_gem.rb +25 -0
- data/cookbooks/mariadb/resources/replication.rb +192 -0
- data/cookbooks/mariadb/templates/default/conf.d.generic.erb +19 -0
- data/cookbooks/mariadb/templates/default/debian.cnf.erb +12 -0
- data/cookbooks/mariadb/templates/default/mariadb-server.seed.erb +13 -0
- data/cookbooks/mariadb/templates/default/mariadb_grants.erb +42 -0
- data/cookbooks/mariadb/templates/default/my.cnf.erb +210 -0
- data/cookbooks/mariadb/templates/default/root.cnf.erb +5 -0
- data/cookbooks/mingw/.foodcritic +1 -0
- data/cookbooks/mingw/CHANGELOG.md +50 -0
- data/cookbooks/mingw/CONTRIBUTING.md +2 -0
- data/cookbooks/mingw/MAINTAINERS.md +14 -0
- data/cookbooks/mingw/README.md +133 -0
- data/cookbooks/mingw/files/default/bash.bat +17 -0
- data/cookbooks/mingw/files/default/custom-upgrade.sh +23 -0
- data/cookbooks/mingw/files/default/custom_prefix.sh +13 -0
- data/cookbooks/mingw/files/default/pthread.h +719 -0
- data/cookbooks/mingw/files/default/time.h +297 -0
- data/cookbooks/mingw/libraries/_helper.rb +38 -0
- data/cookbooks/mingw/metadata.json +1 -0
- data/cookbooks/mingw/recipes/default.rb +19 -0
- data/cookbooks/mingw/resources/get.rb +56 -0
- data/cookbooks/mingw/resources/msys2_package.rb +139 -0
- data/cookbooks/mingw/resources/tdm_gcc.rb +114 -0
- data/cookbooks/ohai/.foodcritic +2 -0
- data/cookbooks/ohai/CHANGELOG.md +166 -0
- data/cookbooks/ohai/CONTRIBUTING.md +2 -0
- data/cookbooks/ohai/MAINTAINERS.md +15 -0
- data/cookbooks/ohai/README.md +134 -0
- data/cookbooks/ohai/libraries/matchers.rb +41 -0
- data/cookbooks/ohai/metadata.json +1 -0
- data/cookbooks/ohai/recipes/default.rb +20 -0
- data/cookbooks/ohai/resources/hint.rb +55 -0
- data/cookbooks/ohai/resources/plugin.rb +117 -0
- data/cookbooks/selinux_policy/.gitignore +51 -0
- data/cookbooks/selinux_policy/.kitchen.yml +25 -0
- data/cookbooks/selinux_policy/.rubocop.yml +2 -0
- data/cookbooks/selinux_policy/.travis.yml +26 -0
- data/cookbooks/selinux_policy/Berksfile +8 -0
- data/cookbooks/selinux_policy/CHANGELOG.md +155 -0
- data/cookbooks/selinux_policy/LICENSE +13 -0
- data/cookbooks/selinux_policy/README.md +217 -0
- data/cookbooks/selinux_policy/Rakefile +68 -0
- data/cookbooks/selinux_policy/TESTING.md +2 -0
- data/cookbooks/selinux_policy/Thorfile +12 -0
- data/cookbooks/selinux_policy/attributes/default.rb +5 -0
- data/cookbooks/selinux_policy/chefignore +102 -0
- data/cookbooks/selinux_policy/libraries/helper-disabled.rb +29 -0
- data/cookbooks/selinux_policy/libraries/matchers.rb +57 -0
- data/cookbooks/selinux_policy/metadata.json +58 -0
- data/cookbooks/selinux_policy/metadata.rb +20 -0
- data/cookbooks/selinux_policy/providers/boolean.rb +28 -0
- data/cookbooks/selinux_policy/providers/fcontext.rb +78 -0
- data/cookbooks/selinux_policy/providers/module.rb +81 -0
- data/cookbooks/selinux_policy/providers/permissive.rb +26 -0
- data/cookbooks/selinux_policy/providers/port.rb +58 -0
- data/cookbooks/selinux_policy/recipes/default.rb +9 -0
- data/cookbooks/selinux_policy/recipes/install.rb +32 -0
- data/cookbooks/selinux_policy/resources/boolean.rb +8 -0
- data/cookbooks/selinux_policy/resources/fcontext.rb +8 -0
- data/cookbooks/selinux_policy/resources/module.rb +21 -0
- data/cookbooks/selinux_policy/resources/permissive.rb +6 -0
- data/cookbooks/selinux_policy/resources/port.rb +9 -0
- data/cookbooks/seven_zip/CHANGELOG.md +30 -0
- data/cookbooks/seven_zip/README.md +108 -0
- data/cookbooks/seven_zip/attributes/default.rb +31 -0
- data/cookbooks/seven_zip/libraries/matchers.rb +33 -0
- data/cookbooks/seven_zip/metadata.json +1 -0
- data/cookbooks/seven_zip/providers/archive.rb +68 -0
- data/cookbooks/seven_zip/recipes/default.rb +41 -0
- data/cookbooks/seven_zip/resources/archive.rb +29 -0
- data/cookbooks/windows/.foodcritic +2 -0
- data/cookbooks/windows/CHANGELOG.md +528 -0
- data/cookbooks/windows/CONTRIBUTING.md +2 -0
- data/cookbooks/windows/MAINTAINERS.md +21 -0
- data/cookbooks/windows/README.md +803 -0
- data/cookbooks/windows/attributes/default.rb +21 -0
- data/cookbooks/windows/files/dism_features.rb +45 -0
- data/cookbooks/windows/libraries/matchers.rb +586 -0
- data/cookbooks/windows/libraries/powershell_helper.rb +53 -0
- data/cookbooks/windows/libraries/registry_helper.rb +356 -0
- data/cookbooks/windows/libraries/version.rb +207 -0
- data/cookbooks/windows/libraries/version_helper.rb +79 -0
- data/cookbooks/windows/libraries/windows_helper.rb +174 -0
- data/cookbooks/windows/libraries/windows_privileged.rb +103 -0
- data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
- data/cookbooks/windows/metadata.json +1 -0
- data/cookbooks/windows/recipes/default.rb +21 -0
- data/cookbooks/windows/resources/auto_run.rb +46 -0
- data/cookbooks/windows/resources/certificate.rb +166 -0
- data/cookbooks/windows/resources/certificate_binding.rb +128 -0
- data/cookbooks/windows/resources/feature.rb +82 -0
- data/cookbooks/windows/resources/feature_dism.rb +108 -0
- data/cookbooks/windows/resources/feature_powershell.rb +70 -0
- data/cookbooks/windows/resources/feature_servermanagercmd.rb +76 -0
- data/cookbooks/windows/resources/font.rb +80 -0
- data/cookbooks/windows/resources/http_acl.rb +110 -0
- data/cookbooks/windows/resources/pagefile.rb +152 -0
- data/cookbooks/windows/resources/path.rb +54 -0
- data/cookbooks/windows/resources/printer.rb +103 -0
- data/cookbooks/windows/resources/printer_port.rb +101 -0
- data/cookbooks/windows/resources/share.rb +291 -0
- data/cookbooks/windows/resources/shortcut.rb +53 -0
- data/cookbooks/windows/resources/task.rb +384 -0
- data/cookbooks/windows/resources/zipfile.rb +125 -0
- data/cookbooks/yum/.foodcritic +1 -0
- data/cookbooks/yum/CHANGELOG.md +351 -0
- data/cookbooks/yum/CONTRIBUTING.md +2 -0
- data/cookbooks/yum/MAINTAINERS.md +16 -0
- data/cookbooks/yum/README.md +125 -0
- data/cookbooks/yum/attributes/main.rb +103 -0
- data/cookbooks/yum/libraries/matchers.rb +9 -0
- data/cookbooks/yum/metadata.json +1 -0
- data/cookbooks/yum/recipes/default.rb +26 -0
- data/cookbooks/yum/recipes/dnf_yum_compat.rb +29 -0
- data/cookbooks/yum/resources/globalconfig.rb +119 -0
- data/cookbooks/yum/templates/.DS_Store +0 -0
- data/cookbooks/yum/templates/main.erb +276 -0
- data/cookbooks/yum-epel/CHANGELOG.md +138 -0
- data/cookbooks/yum-epel/CONTRIBUTING.md +2 -0
- data/cookbooks/yum-epel/MAINTAINERS.md +19 -0
- data/cookbooks/yum-epel/README.md +172 -0
- data/cookbooks/yum-epel/attributes/default.rb +8 -0
- data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-source.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing-source.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel.rb +21 -0
- data/cookbooks/yum-epel/metadata.json +1 -0
- data/cookbooks/yum-epel/recipes/default.rb +27 -0
- data/cookbooks/yum-scl/.kitchen.dokken.yml +24 -0
- data/cookbooks/yum-scl/.kitchen.yml +24 -0
- data/cookbooks/yum-scl/.rubocop.yml +6 -0
- data/cookbooks/yum-scl/.travis.yml +28 -0
- data/cookbooks/yum-scl/Berksfile +3 -0
- data/cookbooks/yum-scl/Berksfile.lock +25 -0
- data/cookbooks/yum-scl/CHANGELOG.md +11 -0
- data/cookbooks/yum-scl/Gemfile +46 -0
- data/cookbooks/yum-scl/README.md +76 -0
- data/cookbooks/yum-scl/attributes/centos.rb +83 -0
- data/cookbooks/yum-scl/attributes/default.rb +15 -0
- data/cookbooks/yum-scl/attributes/scientific.rb +1 -0
- data/cookbooks/yum-scl/files/default/RPM-GPG-KEY-CentOS-SIG-SCLo +20 -0
- data/cookbooks/yum-scl/libraries/yum_scl_helper.rb +33 -0
- data/cookbooks/yum-scl/metadata.json +42 -0
- data/cookbooks/yum-scl/metadata.rb +12 -0
- data/cookbooks/yum-scl/recipes/chef_install.rb +52 -0
- data/cookbooks/yum-scl/recipes/default.rb +17 -0
- data/cookbooks/yum-scl/recipes/native_install.rb +35 -0
- data/lib/vagrant-clone/command/clone.rb +66 -61
- data/lib/vagrant-clone/errors.rb +61 -0
- data/lib/vagrant-clone/util/clone_manager_base.rb +69 -0
- data/lib/vagrant-clone/util/clone_managers/docker.rb +31 -0
- data/lib/vagrant-clone/util/clone_managers/libvirt.rb +254 -0
- data/lib/vagrant-clone/util/vagrantfile_managers/docker.rb +154 -0
- data/lib/vagrant-clone/util/vagrantfile_managers/libvirt.rb +159 -0
- data/lib/vagrant-clone/version.rb +2 -2
- data/lib/vagrant-clone.rb +6 -6
- data/libvirt.txt +7 -0
- data/performance_testing.rb +165 -0
- data/results.txt +45 -0
- data/scripts/create_box.sh +134 -0
- data/test.rb +92 -0
- data/tools/create_box.sh +130 -0
- data/vagrant-clone.gemspec +7 -7
- metadata +296 -5
- data/lib/vagrant-clone/command/errors.rb +0 -16
- data/lib/vagrant-clone/command/provider/docker.rb +0 -13
- 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
|