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,167 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Lamont Granquist (<lamont@chef.io>)
|
3
|
+
# Copyright:: Copyright 2015-2016, Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
# XXX: we now have two copies of this file in the compat_resource cookbook. I'm uncertain if this is a
|
20
|
+
# bug or a feature, and I suspect it is actually a feature. The point of this file is that for all
|
21
|
+
# resources and cookbooks the global Chef::ResourceBuilder class must be upgraded to at least the
|
22
|
+
# 12.10.24 version. The point of the other copy is that for compat_resource cookbooks all their
|
23
|
+
# resources should be using the lastest version that has been sync'd. So these two files should
|
24
|
+
# diverge as times goes on. I believe that is the correct behavior and that we want to have both
|
25
|
+
# files in this cookbook.
|
26
|
+
|
27
|
+
# NOTE: this was extracted from the Recipe DSL mixin, relevant specs are in spec/unit/recipe_spec.rb
|
28
|
+
|
29
|
+
if Gem::Requirement.new("< 12.10.24").satisfied_by?(Gem::Version.new(Chef::VERSION))
|
30
|
+
begin
|
31
|
+
require 'chef/resource_builder'
|
32
|
+
# we use the LoadError this creates on early 12.x to not monkeypatch chef client versions that don't have Chef::ResourceBuilder
|
33
|
+
# (it is lazily included and doesn't appear until compile time so we can't resolve the symbol during library loading)
|
34
|
+
|
35
|
+
class Chef
|
36
|
+
class ResourceBuilder
|
37
|
+
attr_reader :type
|
38
|
+
attr_reader :name
|
39
|
+
attr_reader :created_at
|
40
|
+
attr_reader :params
|
41
|
+
attr_reader :run_context
|
42
|
+
attr_reader :cookbook_name
|
43
|
+
attr_reader :recipe_name
|
44
|
+
attr_reader :enclosing_provider
|
45
|
+
attr_reader :resource
|
46
|
+
|
47
|
+
# FIXME (ruby-2.1 syntax): most of these are mandatory
|
48
|
+
def initialize(type:nil, name:nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)
|
49
|
+
@type = type
|
50
|
+
@name = name
|
51
|
+
@created_at = created_at
|
52
|
+
@params = params
|
53
|
+
@run_context = run_context
|
54
|
+
@cookbook_name = cookbook_name
|
55
|
+
@recipe_name = recipe_name
|
56
|
+
@enclosing_provider = enclosing_provider
|
57
|
+
end
|
58
|
+
|
59
|
+
def build(&block)
|
60
|
+
raise ArgumentError, "You must supply a name when declaring a #{type} resource" if name.nil?
|
61
|
+
|
62
|
+
@resource = resource_class.new(name, run_context)
|
63
|
+
if resource.resource_name.nil?
|
64
|
+
raise Chef::Exceptions::InvalidResourceSpecification, "#{resource}.resource_name is `nil`! Did you forget to put `provides :blah` or `resource_name :blah` in your resource class?"
|
65
|
+
end
|
66
|
+
resource.source_line = created_at
|
67
|
+
resource.declared_type = type
|
68
|
+
|
69
|
+
# If we have a resource like this one, we want to steal its state
|
70
|
+
# This behavior is very counter-intuitive and should be removed.
|
71
|
+
# See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694
|
72
|
+
# Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052
|
73
|
+
if prior_resource
|
74
|
+
resource.load_from(prior_resource)
|
75
|
+
end
|
76
|
+
|
77
|
+
resource.cookbook_name = cookbook_name
|
78
|
+
resource.recipe_name = recipe_name
|
79
|
+
# Determine whether this resource is being created in the context of an enclosing Provider
|
80
|
+
resource.enclosing_provider = enclosing_provider
|
81
|
+
|
82
|
+
# XXX: this is required for definition params inside of the scope of a
|
83
|
+
# subresource to work correctly.
|
84
|
+
resource.params = params
|
85
|
+
|
86
|
+
# Evaluate resource attribute DSL
|
87
|
+
if block_given?
|
88
|
+
resource.resource_initializing = true
|
89
|
+
begin
|
90
|
+
resource.instance_eval(&block)
|
91
|
+
ensure
|
92
|
+
resource.resource_initializing = false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# emit a cloned resource warning if it is warranted
|
97
|
+
if prior_resource
|
98
|
+
if is_trivial_resource?(prior_resource) && identicalish_resources?(prior_resource, resource)
|
99
|
+
emit_harmless_cloning_debug
|
100
|
+
else
|
101
|
+
emit_cloned_resource_warning
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Run optional resource hook
|
106
|
+
resource.after_created
|
107
|
+
|
108
|
+
resource
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def resource_class
|
114
|
+
# Checks the new platform => short_name => resource mapping initially
|
115
|
+
# then fall back to the older approach (Chef::Resource.const_get) for
|
116
|
+
# backward compatibility
|
117
|
+
@resource_class ||= Chef::Resource.resource_for_node(type, run_context.node)
|
118
|
+
end
|
119
|
+
|
120
|
+
def is_trivial_resource?(resource)
|
121
|
+
identicalish_resources?(resource_class.new(name, run_context), resource)
|
122
|
+
end
|
123
|
+
|
124
|
+
# this is an equality test specific to checking for 3694 cloning warnings
|
125
|
+
def identicalish_resources?(first, second)
|
126
|
+
skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]
|
127
|
+
checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars
|
128
|
+
non_matching_ivars = checked_ivars.reject do |iv|
|
129
|
+
if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )
|
130
|
+
# :nothing action on either side of the comparison always matches
|
131
|
+
true
|
132
|
+
else
|
133
|
+
first.instance_variable_get(iv) == second.instance_variable_get(iv)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
Chef::Log.debug("ivars which did not match with the prior resource: #{non_matching_ivars}")
|
137
|
+
non_matching_ivars.empty?
|
138
|
+
end
|
139
|
+
|
140
|
+
def emit_cloned_resource_warning
|
141
|
+
Chef::Log.warn("Cloning resource attributes for #{resource} from prior resource (CHEF-3694)")
|
142
|
+
Chef::Log.warn("Previous #{prior_resource}: #{prior_resource.source_line}") if prior_resource.source_line
|
143
|
+
Chef::Log.warn("Current #{resource}: #{resource.source_line}") if resource.source_line
|
144
|
+
end
|
145
|
+
|
146
|
+
def emit_harmless_cloning_debug
|
147
|
+
Chef::Log.debug("Harmless resource cloning from #{prior_resource}:#{prior_resource.source_line} to #{resource}:#{resource.source_line}")
|
148
|
+
end
|
149
|
+
|
150
|
+
def prior_resource
|
151
|
+
@prior_resource ||=
|
152
|
+
begin
|
153
|
+
key = "#{type}[#{name}]"
|
154
|
+
run_context.resource_collection.lookup_local(key)
|
155
|
+
rescue Chef::Exceptions::ResourceNotFound
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|
162
|
+
rescue LoadError
|
163
|
+
# cool we're just on early chef 12.x, nothing to do -- we don't have to worry because there's also not parent_run_context pointer, so we don't have to
|
164
|
+
# use lookup_local to avoid resource cloning shit out of the parent run_context. the resource collection's lookup() method will always use lookup_local
|
165
|
+
# over lookup_recursive.
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Tyler Ball (<tball@chef.io>)
|
3
|
+
# Copyright:: Copyright 2014-2016, Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/resource_collection/resource_list"
|
20
|
+
require "chef/exceptions"
|
21
|
+
|
22
|
+
module ChefCompat
|
23
|
+
module Monkeypatches
|
24
|
+
module Chef
|
25
|
+
module ResourceCollection
|
26
|
+
module ResourceList
|
27
|
+
module DeleteResource
|
28
|
+
# Copied verbatim from Chef 12.10.4
|
29
|
+
def delete(key)
|
30
|
+
raise ArgumentError, "Must pass a Chef::Resource or String to delete" unless key.is_a?(String) || key.is_a?(Chef::Resource)
|
31
|
+
key = key.to_s
|
32
|
+
ret = @resources.reject! { |r| r.to_s == key }
|
33
|
+
if ret.nil?
|
34
|
+
raise ::Chef::Exceptions::ResourceNotFound, "Cannot find a resource matching #{key} (did you define it first?)"
|
35
|
+
end
|
36
|
+
ret
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Chef::ResourceCollection::ResourceList
|
46
|
+
unless method_defined?(:delete)
|
47
|
+
prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::ResourceList::DeleteResource
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Tyler Ball (<tball@chef.io>)
|
3
|
+
# Copyright:: Copyright 2014-2016, Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/resource_collection/resource_list"
|
20
|
+
require "chef/exceptions"
|
21
|
+
|
22
|
+
module ChefCompat
|
23
|
+
module Monkeypatches
|
24
|
+
module Chef
|
25
|
+
module ResourceCollection
|
26
|
+
module ResourceSet
|
27
|
+
module DeleteResource
|
28
|
+
def delete(key)
|
29
|
+
raise ArgumentError, "Must pass a Chef::Resource or String to delete" unless key.is_a?(String) || key.is_a?(Chef::Resource)
|
30
|
+
key = key.to_s
|
31
|
+
res = @resources_by_key.delete(key)
|
32
|
+
|
33
|
+
if res == @resources_by_key.default
|
34
|
+
raise Chef::Exceptions::ResourceNotFound, "Cannot find a resource matching #{key} (did you define it first?)"
|
35
|
+
end
|
36
|
+
res
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Chef::ResourceCollection::ResourceSet
|
46
|
+
unless method_defined?(:delete)
|
47
|
+
prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::ResourceSet::DeleteResource
|
48
|
+
end
|
49
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Christopher Walters (<cw@chef.io>)
|
4
|
+
# Copyright:: Copyright 2008-2016, Chef Software Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require "chef/resource_collection/resource_set"
|
21
|
+
require "chef/resource_collection/resource_list"
|
22
|
+
require "chef/resource_collection"
|
23
|
+
require "chef/exceptions"
|
24
|
+
|
25
|
+
module ChefCompat
|
26
|
+
module Monkeypatches
|
27
|
+
module Chef
|
28
|
+
module ResourceCollection
|
29
|
+
module RecursiveNotificationLookup
|
30
|
+
#
|
31
|
+
# Copied verbatim from Chef 12.10.24
|
32
|
+
#
|
33
|
+
attr_accessor :run_context
|
34
|
+
|
35
|
+
def initialize(run_context = nil)
|
36
|
+
super()
|
37
|
+
@run_context = run_context
|
38
|
+
end
|
39
|
+
|
40
|
+
def lookup_local(key)
|
41
|
+
resource_set.lookup(key)
|
42
|
+
end
|
43
|
+
|
44
|
+
def find_local(*args)
|
45
|
+
resource_set.find(*args)
|
46
|
+
end
|
47
|
+
|
48
|
+
def lookup(key)
|
49
|
+
if run_context.nil?
|
50
|
+
lookup_local(key)
|
51
|
+
else
|
52
|
+
lookup_recursive(run_context, key)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def find(*args)
|
57
|
+
if run_context.nil?
|
58
|
+
find_local(*args)
|
59
|
+
else
|
60
|
+
find_recursive(run_context, *args)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def lookup_recursive(rc, key)
|
67
|
+
rc.resource_collection.send(:resource_set).lookup(key)
|
68
|
+
rescue ::Chef::Exceptions::ResourceNotFound
|
69
|
+
raise if !rc.respond_to?(:parent_run_context) || rc.parent_run_context.nil?
|
70
|
+
lookup_recursive(rc.parent_run_context, key)
|
71
|
+
end
|
72
|
+
|
73
|
+
def find_recursive(rc, *args)
|
74
|
+
rc.resource_collection.send(:resource_set).find(*args)
|
75
|
+
rescue ::Chef::Exceptions::ResourceNotFound
|
76
|
+
raise if !rc.respond_to?(:parent_run_context) || rc.parent_run_context.nil?
|
77
|
+
find_recursive(rc.parent_run_context, *args)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
module DeleteResources
|
82
|
+
#
|
83
|
+
# Copied verbatim from Chef 12.10.24
|
84
|
+
#
|
85
|
+
def delete(key)
|
86
|
+
resource_list.delete(key)
|
87
|
+
resource_set.delete(key)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
class Chef::ResourceCollection
|
97
|
+
unless method_defined?(:lookup_local)
|
98
|
+
prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::RecursiveNotificationLookup
|
99
|
+
end
|
100
|
+
unless method_defined?(:delete)
|
101
|
+
prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::DeleteResources
|
102
|
+
end
|
103
|
+
end
|