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,29 @@
|
|
1
|
+
module ChefCompat
|
2
|
+
module CopiedFromChef
|
3
|
+
def self.extend_chef_module(chef_module, target)
|
4
|
+
target.instance_eval do
|
5
|
+
include chef_module
|
6
|
+
@chef_module = chef_module
|
7
|
+
def self.method_missing(name, *args, &block)
|
8
|
+
@chef_module.send(name, *args, &block)
|
9
|
+
end
|
10
|
+
def self.const_missing(name)
|
11
|
+
@chef_module.const_get(name)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# This patch to CopiedFromChef's ActionClass is necessary for the include to work
|
17
|
+
require 'chef/resource'
|
18
|
+
class Chef < ::Chef
|
19
|
+
class Resource < ::Chef::Resource
|
20
|
+
module ActionClass
|
21
|
+
def self.use_inline_resources
|
22
|
+
end
|
23
|
+
def self.include_resource_dsl(include_resource_dsl)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'chef/exceptions'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Exceptions
|
5
|
+
# Used in Resource::ActionClass#load_current_resource to denote that
|
6
|
+
# the resource doesn't actually exist (for example, the file does not exist)
|
7
|
+
class CurrentValueDoesNotExist < RuntimeError; end unless defined?(CurrentValueDoesNotExist)
|
8
|
+
class CannotValidateStaticallyError < RuntimeError; end unless defined?(CannotValidateStaticallyError)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'chef/log'
|
2
|
+
|
3
|
+
# for now we have to patch this in everything
|
4
|
+
class Chef
|
5
|
+
class Log
|
6
|
+
def self.caller_location
|
7
|
+
# Pick the first caller that is *not* part of the Chef gem, that's the
|
8
|
+
# thing the user wrote.
|
9
|
+
compat_resource_path = File.expand_path("../../../../..", __FILE__)
|
10
|
+
chef_gem_path = Gem.loaded_specs['chef'].full_gem_path
|
11
|
+
caller(0..20).find { |c| !c.start_with?(compat_resource_path) && !c.start_with?(chef_gem_path) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if Gem::Requirement.new('< 12.13.37').satisfied_by?(Gem::Version.new(Chef::VERSION))
|
17
|
+
|
18
|
+
# FIXME: why does this not match the implementation in Chef itself?
|
19
|
+
class Chef
|
20
|
+
class Log
|
21
|
+
module ChefCompatDeprecation
|
22
|
+
def deprecation(message, location=nil)
|
23
|
+
Chef.log_deprecation(message, location)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
extend ChefCompatDeprecation
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/mixin/params_validate.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
if Chef::VERSION.to_f >= 12.5 && Chef::VERSION.to_f <= 12.8
|
2
|
+
require 'chef/mixin/params_validate'
|
3
|
+
class Chef
|
4
|
+
module Mixin
|
5
|
+
module ParamsValidate
|
6
|
+
class SetOrReturnProperty < Chef::Property
|
7
|
+
# 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning.
|
8
|
+
# When their method gets called with 2 args, we need to ignore and call with 1.
|
9
|
+
alias_method :_original_get2, :get
|
10
|
+
def get(resource, *args)
|
11
|
+
_original_get2(resource)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning.
|
2
|
+
# We need to mimick it here.
|
3
|
+
if Chef::VERSION.to_f >= 12.5 && Chef::VERSION.to_f <= 12.8
|
4
|
+
require 'chef/property'
|
5
|
+
class Chef
|
6
|
+
class Property
|
7
|
+
# 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning.
|
8
|
+
# When their method gets called with 2 args, we need to ignore and call with 1.
|
9
|
+
alias_method :_original_get, :get
|
10
|
+
def get(resource, *args)
|
11
|
+
_original_get(resource)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'chef/provider'
|
2
|
+
require 'chef/provider/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Provider
|
5
|
+
if !defined?(InlineResources)
|
6
|
+
InlineResources = Chef::Provider::LWRPBase::InlineResources
|
7
|
+
end
|
8
|
+
module InlineResources
|
9
|
+
require 'chef/dsl/recipe'
|
10
|
+
require 'chef/dsl/platform_introspection'
|
11
|
+
require 'chef/dsl/data_query'
|
12
|
+
require 'chef/dsl/include_recipe'
|
13
|
+
include Chef::DSL::Recipe
|
14
|
+
include Chef::DSL::PlatformIntrospection
|
15
|
+
include Chef::DSL::DataQuery
|
16
|
+
include Chef::DSL::IncludeRecipe
|
17
|
+
|
18
|
+
unless Chef::Provider::InlineResources::ClassMethods.instance_method(:action).source_location[0] =~ /chefspec/
|
19
|
+
# Don't override action if chefspec is doing its thing
|
20
|
+
module ::ChefCompat
|
21
|
+
module Monkeypatches
|
22
|
+
module InlineResources
|
23
|
+
module ClassMethods
|
24
|
+
def action(name, &block)
|
25
|
+
super(name) { send("compile_action_#{name}") }
|
26
|
+
# We put the action in its own method so that super() works.
|
27
|
+
define_method("compile_action_#{name}", &block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
module ClassMethods
|
34
|
+
prepend ChefCompat::Monkeypatches::InlineResources::ClassMethods
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
class Chef
|
42
|
+
class Provider
|
43
|
+
class LWRPBase < Provider
|
44
|
+
if defined?(InlineResources)
|
45
|
+
module InlineResources
|
46
|
+
# since we upgrade the Chef::Runner and Chef::RunContext globally to >= 12.14 style classes, we need to also
|
47
|
+
# fix the use_inline_resources LWRPBase wrapper that creates a sub-resource collection with the ugpraded code
|
48
|
+
# from the Chef::Provider subclasses that do similar things in post-12.5 chef.
|
49
|
+
def recipe_eval_with_update_check(&block)
|
50
|
+
old_run_context = run_context
|
51
|
+
@run_context = run_context.create_child
|
52
|
+
return_value = instance_eval(&block)
|
53
|
+
Chef::Runner.new(run_context).converge
|
54
|
+
return_value
|
55
|
+
ensure
|
56
|
+
if run_context.resource_collection.any? { |r| r.updated? }
|
57
|
+
new_resource.updated_by_last_action(true)
|
58
|
+
end
|
59
|
+
@run_context = old_run_context
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
#
|
2
|
+
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
|
3
|
+
#
|
4
|
+
# THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!!
|
5
|
+
#
|
6
|
+
# NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
|
7
|
+
#
|
8
|
+
|
9
|
+
if Gem::Requirement.new('< 12.16.42').satisfied_by?(Gem::Version.new(Chef::VERSION))
|
10
|
+
#--
|
11
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
12
|
+
# Author:: Christopher Walters (<cw@chef.io>)
|
13
|
+
# Copyright:: Copyright 2008-2016, Chef Software Inc.
|
14
|
+
# License:: Apache License, Version 2.0
|
15
|
+
#
|
16
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
17
|
+
# you may not use this file except in compliance with the License.
|
18
|
+
# You may obtain a copy of the License at
|
19
|
+
#
|
20
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
21
|
+
#
|
22
|
+
# Unless required by applicable law or agreed to in writing, software
|
23
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
24
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
25
|
+
# See the License for the specific language governing permissions and
|
26
|
+
# limitations under the License.
|
27
|
+
#
|
28
|
+
|
29
|
+
require "chef/dsl/recipe"
|
30
|
+
require "chef/mixin/from_file"
|
31
|
+
require "chef/mixin/deprecation"
|
32
|
+
|
33
|
+
class Chef
|
34
|
+
# == Chef::Recipe
|
35
|
+
# A Recipe object is the context in which Chef recipes are evaluated.
|
36
|
+
class Recipe
|
37
|
+
attr_accessor :cookbook_name, :recipe_name, :recipe, :params, :run_context
|
38
|
+
|
39
|
+
include Chef::DSL::Recipe
|
40
|
+
|
41
|
+
include Chef::Mixin::FromFile
|
42
|
+
include Chef::Mixin::Deprecation
|
43
|
+
|
44
|
+
# Parses a potentially fully-qualified recipe name into its
|
45
|
+
# cookbook name and recipe short name.
|
46
|
+
#
|
47
|
+
# For example:
|
48
|
+
# "aws::elastic_ip" returns [:aws, "elastic_ip"]
|
49
|
+
# "aws" returns [:aws, "default"]
|
50
|
+
# "::elastic_ip" returns [ current_cookbook, "elastic_ip" ]
|
51
|
+
#--
|
52
|
+
# TODO: Duplicates functionality of RunListItem
|
53
|
+
def self.parse_recipe_name(recipe_name, current_cookbook: nil)
|
54
|
+
case recipe_name
|
55
|
+
when /(.+?)::(.+)/
|
56
|
+
[ $1.to_sym, $2 ]
|
57
|
+
when /^::(.+)/
|
58
|
+
raise "current_cookbook is nil, cannot resolve #{recipe_name}" if current_cookbook.nil?
|
59
|
+
[ current_cookbook.to_sym, $1 ]
|
60
|
+
else
|
61
|
+
[ recipe_name.to_sym, "default" ]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(cookbook_name, recipe_name, run_context)
|
66
|
+
@cookbook_name = cookbook_name
|
67
|
+
@recipe_name = recipe_name
|
68
|
+
@run_context = run_context
|
69
|
+
# TODO: 5/19/2010 cw/tim: determine whether this can be removed
|
70
|
+
@params = Hash.new
|
71
|
+
end
|
72
|
+
|
73
|
+
# Used in DSL mixins
|
74
|
+
def node
|
75
|
+
run_context.node
|
76
|
+
end
|
77
|
+
|
78
|
+
# Used by the DSL to look up resources when executing in the context of a
|
79
|
+
# recipe.
|
80
|
+
def resources(*args)
|
81
|
+
run_context.resource_collection.find(*args)
|
82
|
+
end
|
83
|
+
|
84
|
+
# This was moved to Chef::Node#tag, redirecting here for compatibility
|
85
|
+
def tag(*tags)
|
86
|
+
run_context.node.tag(*tags)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Returns true if the node is tagged with *all* of the supplied +tags+.
|
90
|
+
#
|
91
|
+
# === Parameters
|
92
|
+
# tags<Array>:: A list of tags
|
93
|
+
#
|
94
|
+
# === Returns
|
95
|
+
# true<TrueClass>:: If all the parameters are present
|
96
|
+
# false<FalseClass>:: If any of the parameters are missing
|
97
|
+
def tagged?(*tags)
|
98
|
+
tags.each do |tag|
|
99
|
+
return false unless run_context.node.tags.include?(tag)
|
100
|
+
end
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Removes the list of tags from the node.
|
105
|
+
#
|
106
|
+
# === Parameters
|
107
|
+
# tags<Array>:: A list of tags
|
108
|
+
#
|
109
|
+
# === Returns
|
110
|
+
# tags<Array>:: The current list of run_context.node.tags
|
111
|
+
def untag(*tags)
|
112
|
+
tags.each do |tag|
|
113
|
+
run_context.node.tags.delete(tag)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'chef/recipe'
|
2
|
+
require 'chef_compat/recipe'
|
3
|
+
|
4
|
+
class Chef::Recipe
|
5
|
+
# If the cookbook depends on compat_resource, create a ChefCompat::Recipe object
|
6
|
+
# instead of Chef::Recipe, for the extra goodies.
|
7
|
+
def self.new(cookbook_name, recipe_name, run_context)
|
8
|
+
if run_context &&
|
9
|
+
cookbook_name &&
|
10
|
+
recipe_name &&
|
11
|
+
run_context.cookbook_collection &&
|
12
|
+
run_context.cookbook_collection[cookbook_name] &&
|
13
|
+
run_context.cookbook_collection[cookbook_name].metadata.dependencies.has_key?('compat_resource') &&
|
14
|
+
self != ::ChefCompat::Recipe
|
15
|
+
::ChefCompat::Recipe.new(cookbook_name, recipe_name, run_context)
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'chef_compat/resource/lwrp_base'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
module ChefCompat
|
5
|
+
module Monkeypatches
|
6
|
+
#
|
7
|
+
# NOTE: LOTS OF METAPROGRAMMING HERE. NOT FOR FAINT OF HEART.
|
8
|
+
#
|
9
|
+
|
10
|
+
# Add an empty module to Class so we can temporarily override it in build_from_file
|
11
|
+
module Class
|
12
|
+
end
|
13
|
+
class<<::Class
|
14
|
+
prepend(ChefCompat::Monkeypatches::Class)
|
15
|
+
end
|
16
|
+
|
17
|
+
module Chef
|
18
|
+
module Resource
|
19
|
+
module LWRPBase
|
20
|
+
def build_from_file(cookbook_name, filename, run_context)
|
21
|
+
# If the cookbook this LWRP is from depends on compat_resource, fix its LWRPs up real good
|
22
|
+
if run_context.cookbook_collection[cookbook_name].metadata.dependencies.has_key?('compat_resource')
|
23
|
+
# All cookbooks do Class.new(Chef::Resource::LWRPBase). Change Class.new
|
24
|
+
# temporarily to translate Chef::Resource::LWRPBase to ChefCompat::Resource
|
25
|
+
ChefCompat::Monkeypatches::Class.module_eval do
|
26
|
+
def new(*args, &block)
|
27
|
+
# Trick it! Use ChefCompat::Resource instead of Chef::Resource::LWRPBase
|
28
|
+
if args == [ ::Chef::Resource::LWRPBase ]
|
29
|
+
ChefCompat::Monkeypatches::Class.module_eval do
|
30
|
+
remove_method(:new) if method_defined?(:new)
|
31
|
+
end
|
32
|
+
args = [ ChefCompat::Resource::LWRPBase ]
|
33
|
+
end
|
34
|
+
super(*args, &block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
begin
|
39
|
+
|
40
|
+
# Call the actual build_from_file
|
41
|
+
super
|
42
|
+
|
43
|
+
ensure
|
44
|
+
class<<ChefCompat::Monkeypatches::Class
|
45
|
+
remove_method(:new) if method_defined?(:new)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
# Call the actual build_from_file
|
50
|
+
super
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
class <<::Chef::Resource::LWRPBase
|
55
|
+
prepend(LWRPBase)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# this is NOT an AUTOGENERATED file
|
2
|
+
|
3
|
+
require 'chef/resource'
|
4
|
+
|
5
|
+
class Chef
|
6
|
+
class Resource
|
7
|
+
|
8
|
+
class UnresolvedSubscribes < self
|
9
|
+
# The full key ise given as the name in {Resource#subscribes}
|
10
|
+
alias_method :to_s, :name
|
11
|
+
alias_method :declared_key, :name
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# Force a delayed notification into this resource's run_context.
|
16
|
+
#
|
17
|
+
# This should most likely be paired with action :nothing
|
18
|
+
#
|
19
|
+
# @param arg [Array[Symbol], Symbol] A list of actions (e.g. `:create`)
|
20
|
+
#
|
21
|
+
def delayed_action(arg)
|
22
|
+
arg = Array(arg).map(&:to_sym)
|
23
|
+
arg.map do |action|
|
24
|
+
validate(
|
25
|
+
{ action: action },
|
26
|
+
{ action: { kind_of: Symbol, equal_to: allowed_actions } }
|
27
|
+
)
|
28
|
+
# the resource effectively sends a delayed notification to itself
|
29
|
+
run_context.add_delayed_action(Notification.new(self, action, self))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def subscribes(action, resources, timing = :delayed)
|
34
|
+
resources = [resources].flatten
|
35
|
+
resources.each do |resource|
|
36
|
+
if resource.is_a?(String)
|
37
|
+
resource = UnresolvedSubscribes.new(resource, run_context)
|
38
|
+
end
|
39
|
+
if resource.run_context.nil?
|
40
|
+
resource.run_context = run_context
|
41
|
+
end
|
42
|
+
resource.notifies(action, self, timing)
|
43
|
+
end
|
44
|
+
true
|
45
|
+
end
|
46
|
+
|
47
|
+
def notifies(action, resource_spec, timing = :delayed)
|
48
|
+
# when using old-style resources(:template => "/foo.txt") style, you
|
49
|
+
# could end up with multiple resources.
|
50
|
+
validate_resource_spec!(resource_spec)
|
51
|
+
|
52
|
+
resources = [ resource_spec ].flatten
|
53
|
+
resources.each do |resource|
|
54
|
+
|
55
|
+
case timing.to_s
|
56
|
+
when "delayed"
|
57
|
+
notifies_delayed(action, resource)
|
58
|
+
when "immediate", "immediately"
|
59
|
+
notifies_immediately(action, resource)
|
60
|
+
when "before"
|
61
|
+
notifies_before(action, resource)
|
62
|
+
else
|
63
|
+
raise ArgumentError, "invalid timing: #{timing} for notifies(#{action}, #{resources.inspect}, #{timing}) resource #{self} "\
|
64
|
+
"Valid timings are: :delayed, :immediate, :immediately, :before"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# Iterates over all immediate and delayed notifications, calling
|
73
|
+
# resolve_resource_reference on each in turn, causing them to
|
74
|
+
# resolve lazy/forward references.
|
75
|
+
def resolve_notification_references
|
76
|
+
run_context.before_notifications(self).each { |n|
|
77
|
+
n.resolve_resource_reference(run_context.resource_collection)
|
78
|
+
}
|
79
|
+
run_context.immediate_notifications(self).each { |n|
|
80
|
+
n.resolve_resource_reference(run_context.resource_collection)
|
81
|
+
}
|
82
|
+
run_context.delayed_notifications(self).each {|n|
|
83
|
+
n.resolve_resource_reference(run_context.resource_collection)
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# Helper for #notifies
|
88
|
+
def notifies_before(action, resource_spec)
|
89
|
+
run_context.notifies_before(Notification.new(resource_spec, action, self))
|
90
|
+
end
|
91
|
+
|
92
|
+
# Helper for #notifies
|
93
|
+
def notifies_immediately(action, resource_spec)
|
94
|
+
run_context.notifies_immediately(Notification.new(resource_spec, action, self))
|
95
|
+
end
|
96
|
+
|
97
|
+
# Helper for #notifies
|
98
|
+
def notifies_delayed(action, resource_spec)
|
99
|
+
run_context.notifies_delayed(Notification.new(resource_spec, action, self))
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# Get the current actual value of this resource.
|
104
|
+
#
|
105
|
+
# This does not cache--a new value will be returned each time.
|
106
|
+
#
|
107
|
+
# @return A new copy of the resource, with values filled in from the actual
|
108
|
+
# current value.
|
109
|
+
#
|
110
|
+
def current_value
|
111
|
+
provider = provider_for_action(Array(action).first)
|
112
|
+
if provider.whyrun_mode? && !provider.whyrun_supported?
|
113
|
+
raise "Cannot retrieve #{self.class.current_resource} in why-run mode: #{provider} does not support why-run"
|
114
|
+
end
|
115
|
+
provider.load_current_resource
|
116
|
+
provider.current_resource
|
117
|
+
end
|
118
|
+
|
119
|
+
# These methods are necessary for new resources to initialize old ones properly
|
120
|
+
attr_reader :resource_initializing
|
121
|
+
def resource_initializing=(value)
|
122
|
+
if value
|
123
|
+
@resource_initializing = value
|
124
|
+
else
|
125
|
+
remove_instance_variable(:@resource_initializing)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
if !respond_to?(:resource_name)
|
130
|
+
def self.resource_name(name=Chef::NOT_PASSED)
|
131
|
+
# Setter
|
132
|
+
if name != Chef::NOT_PASSED
|
133
|
+
# remove_canonical_dsl
|
134
|
+
|
135
|
+
# Set the resource_name and call provides
|
136
|
+
if name
|
137
|
+
name = name.to_sym
|
138
|
+
# If our class is not already providing this name, provide it.
|
139
|
+
# Commented out: use of resource_name and provides will need to be
|
140
|
+
# mutually exclusive in this world, generally.
|
141
|
+
# if !Chef::ResourceResolver.includes_handler?(name, self)
|
142
|
+
provides name#, canonical: true
|
143
|
+
# end
|
144
|
+
@resource_name = name
|
145
|
+
else
|
146
|
+
@resource_name = nil
|
147
|
+
end
|
148
|
+
end
|
149
|
+
@resource_name
|
150
|
+
end
|
151
|
+
def self.resource_name=(name)
|
152
|
+
resource_name(name)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|