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,292 @@
|
|
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
|
+
begin
|
10
|
+
require 'chef/dsl/platform_introspection'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
19
|
+
# Copyright:: Copyright 2008-2016, Chef Software Inc.
|
20
|
+
# License:: Apache License, Version 2.0
|
21
|
+
#
|
22
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
23
|
+
# you may not use this file except in compliance with the License.
|
24
|
+
# You may obtain a copy of the License at
|
25
|
+
#
|
26
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
27
|
+
#
|
28
|
+
# Unless required by applicable law or agreed to in writing, software
|
29
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
30
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
31
|
+
# See the License for the specific language governing permissions and
|
32
|
+
# limitations under the License.
|
33
|
+
#
|
34
|
+
|
35
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
36
|
+
module DSL
|
37
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL)
|
38
|
+
|
39
|
+
# == Chef::DSL::PlatformIntrospection
|
40
|
+
# Provides the DSL for platform-dependent switch logic, such as
|
41
|
+
# #value_for_platform.
|
42
|
+
module PlatformIntrospection
|
43
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL::PlatformIntrospection, self) if defined?(::Chef::DSL::PlatformIntrospection)
|
44
|
+
|
45
|
+
# Implementation class for determining platform dependent values
|
46
|
+
class PlatformDependentValue < (defined?(::Chef::DSL::PlatformIntrospection::PlatformDependentValue) ? ::Chef::DSL::PlatformIntrospection::PlatformDependentValue : Object)
|
47
|
+
|
48
|
+
# Create a platform dependent value object.
|
49
|
+
# === Arguments
|
50
|
+
# platform_hash (Hash) a hash of the same structure as Chef::Platform,
|
51
|
+
# like this:
|
52
|
+
# {
|
53
|
+
# :debian => {:default => 'the value for all debian'}
|
54
|
+
# [:centos, :redhat, :fedora] => {:default => "value for all EL variants"}
|
55
|
+
# :ubuntu => { :default => "default for ubuntu", '10.04' => "value for 10.04 only"},
|
56
|
+
# :default => "the default when nothing else matches"
|
57
|
+
# }
|
58
|
+
# * platforms can be specified as Symbols or Strings
|
59
|
+
# * multiple platforms can be grouped by using an Array as the key
|
60
|
+
# * values for platforms need to be Hashes of the form:
|
61
|
+
# {platform_version => value_for_that_version}
|
62
|
+
# * the exception to the above is the default value, which is given as
|
63
|
+
# :default => default_value
|
64
|
+
def initialize(platform_hash)
|
65
|
+
super if defined?(::Chef::DSL::PlatformIntrospection::PlatformDependentValue)
|
66
|
+
@values = {}
|
67
|
+
platform_hash.each { |platforms, value| set(platforms, value) }
|
68
|
+
end
|
69
|
+
|
70
|
+
def value_for_node(node)
|
71
|
+
platform, version = node[:platform].to_s, node[:platform_version].to_s
|
72
|
+
# Check if we match a version constraint via Chef::VersionConstraint::Platform and Chef::Version::Platform
|
73
|
+
matched_value = match_versions(node)
|
74
|
+
if @values.key?(platform) && @values[platform].key?(version)
|
75
|
+
@values[platform][version]
|
76
|
+
elsif matched_value
|
77
|
+
matched_value
|
78
|
+
elsif @values.key?(platform) && @values[platform].key?("default")
|
79
|
+
@values[platform]["default"]
|
80
|
+
elsif @values.key?("default")
|
81
|
+
@values["default"]
|
82
|
+
else
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def match_versions(node)
|
90
|
+
begin
|
91
|
+
platform, version = node[:platform].to_s, node[:platform_version].to_s
|
92
|
+
return nil unless @values.key?(platform)
|
93
|
+
node_version = Chef::Version::Platform.new(version)
|
94
|
+
key_matches = []
|
95
|
+
keys = @values[platform].keys
|
96
|
+
keys.each do |k|
|
97
|
+
begin
|
98
|
+
if Chef::VersionConstraint::Platform.new(k).include?(node_version)
|
99
|
+
key_matches << k
|
100
|
+
end
|
101
|
+
rescue Chef::Exceptions::InvalidVersionConstraint => e
|
102
|
+
Chef::Log.debug "Caught InvalidVersionConstraint. This means that a key in value_for_platform cannot be interpreted as a Chef::VersionConstraint::Platform."
|
103
|
+
Chef::Log.debug(e)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
return @values[platform][version] if key_matches.include?(version)
|
107
|
+
case key_matches.length
|
108
|
+
when 0
|
109
|
+
return nil
|
110
|
+
when 1
|
111
|
+
return @values[platform][key_matches.first]
|
112
|
+
else
|
113
|
+
raise "Multiple matches detected for #{platform} with values #{@values}. The matches are: #{key_matches}"
|
114
|
+
end
|
115
|
+
rescue Chef::Exceptions::InvalidCookbookVersion => e
|
116
|
+
# Lets not break because someone passes a weird string like 'default' :)
|
117
|
+
Chef::Log.debug(e)
|
118
|
+
Chef::Log.debug "InvalidCookbookVersion exceptions are common and expected here: the generic constraint matcher attempted to match something which is not a constraint. Moving on to next version or constraint"
|
119
|
+
return nil
|
120
|
+
rescue Chef::Exceptions::InvalidPlatformVersion => e
|
121
|
+
Chef::Log.debug "Caught InvalidPlatformVersion, this means that Chef::Version::Platform does not know how to turn #{node_version} into an x.y.z format"
|
122
|
+
Chef::Log.debug(e)
|
123
|
+
return nil
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def set(platforms, value)
|
128
|
+
if platforms.to_s == "default"
|
129
|
+
@values["default"] = value
|
130
|
+
else
|
131
|
+
assert_valid_platform_values!(platforms, value)
|
132
|
+
Array(platforms).each { |platform| @values[platform.to_s] = normalize_keys(value) }
|
133
|
+
value
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def normalize_keys(hash)
|
138
|
+
hash.inject({}) do |h, key_value|
|
139
|
+
keys, value = *key_value
|
140
|
+
Array(keys).each do |key|
|
141
|
+
h[key.to_s] = value
|
142
|
+
end
|
143
|
+
h
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def assert_valid_platform_values!(platforms, value)
|
148
|
+
unless value.kind_of?(Hash)
|
149
|
+
msg = "platform dependent values must be specified in the format :platform => {:version => value} "
|
150
|
+
msg << "you gave a value #{value.inspect} for platform(s) #{platforms}"
|
151
|
+
raise ArgumentError, msg
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Given a hash similar to the one we use for Platforms, select a value from the hash. Supports
|
157
|
+
# per platform defaults, along with a single base default. Arrays may be passed as hash keys and
|
158
|
+
# will be expanded.
|
159
|
+
#
|
160
|
+
# === Parameters
|
161
|
+
# platform_hash:: A platform-style hash.
|
162
|
+
#
|
163
|
+
# === Returns
|
164
|
+
# value:: Whatever the most specific value of the hash is.
|
165
|
+
def value_for_platform(platform_hash)
|
166
|
+
PlatformDependentValue.new(platform_hash).value_for_node(node)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Given a list of platforms, returns true if the current recipe is being run on a node with
|
170
|
+
# that platform, false otherwise.
|
171
|
+
#
|
172
|
+
# === Parameters
|
173
|
+
# args:: A list of platforms. Each platform can be in string or symbol format.
|
174
|
+
#
|
175
|
+
# === Returns
|
176
|
+
# true:: If the current platform is in the list
|
177
|
+
# false:: If the current platform is not in the list
|
178
|
+
def platform?(*args)
|
179
|
+
has_platform = false
|
180
|
+
|
181
|
+
args.flatten.each do |platform|
|
182
|
+
has_platform = true if platform.to_s == node[:platform]
|
183
|
+
end
|
184
|
+
|
185
|
+
has_platform
|
186
|
+
end
|
187
|
+
|
188
|
+
# Implementation class for determining platform family dependent values
|
189
|
+
class PlatformFamilyDependentValue < (defined?(::Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue) ? ::Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue : Object)
|
190
|
+
|
191
|
+
# Create a platform family dependent value object.
|
192
|
+
# === Arguments
|
193
|
+
# platform_family_hash (Hash) a map of platform families to values.
|
194
|
+
# like this:
|
195
|
+
# {
|
196
|
+
# :rhel => "value for all EL variants"
|
197
|
+
# :fedora => "value for fedora variants fedora and amazon" ,
|
198
|
+
# [:fedora, :rhel] => "value for all known redhat variants"
|
199
|
+
# :debian => "value for debian variants including debian, ubuntu, mint" ,
|
200
|
+
# :default => "the default when nothing else matches"
|
201
|
+
# }
|
202
|
+
# * platform families can be specified as Symbols or Strings
|
203
|
+
# * multiple platform families can be grouped by using an Array as the key
|
204
|
+
# * values for platform families can be any object, with no restrictions. Some examples:
|
205
|
+
# - [:stop, :start]
|
206
|
+
# - "mysql-devel"
|
207
|
+
# - { :key => "value" }
|
208
|
+
def initialize(platform_family_hash)
|
209
|
+
super if defined?(::Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue)
|
210
|
+
@values = {}
|
211
|
+
@values["default"] = nil
|
212
|
+
platform_family_hash.each { |platform_families, value| set(platform_families, value) }
|
213
|
+
end
|
214
|
+
|
215
|
+
def value_for_node(node)
|
216
|
+
if node.key?(:platform_family)
|
217
|
+
platform_family = node[:platform_family].to_s
|
218
|
+
if @values.key?(platform_family)
|
219
|
+
@values[platform_family]
|
220
|
+
else
|
221
|
+
@values["default"]
|
222
|
+
end
|
223
|
+
else
|
224
|
+
@values["default"]
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
private
|
229
|
+
|
230
|
+
def set(platform_family, value)
|
231
|
+
if platform_family.to_s == "default"
|
232
|
+
@values["default"] = value
|
233
|
+
else
|
234
|
+
Array(platform_family).each { |family| @values[family.to_s] = value }
|
235
|
+
value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
# Given a hash mapping platform families to values, select a value from the hash. Supports a single
|
241
|
+
# base default if platform family is not in the map. Arrays may be passed as hash keys and will be
|
242
|
+
# expanded
|
243
|
+
#
|
244
|
+
# === Parameters
|
245
|
+
# platform_family_hash:: A hash in the form { platform_family_name => value }
|
246
|
+
#
|
247
|
+
# === Returns
|
248
|
+
# value:: Whatever the most specific value of the hash is.
|
249
|
+
def value_for_platform_family(platform_family_hash)
|
250
|
+
PlatformFamilyDependentValue.new(platform_family_hash).value_for_node(node)
|
251
|
+
end
|
252
|
+
|
253
|
+
# Given a list of platform families, returns true if the current recipe is being run on a
|
254
|
+
# node within that platform family, false otherwise.
|
255
|
+
#
|
256
|
+
# === Parameters
|
257
|
+
# args:: A list of platform families. Each platform family can be in string or symbol format.
|
258
|
+
#
|
259
|
+
# === Returns
|
260
|
+
# true:: if the current node platform family is in the list.
|
261
|
+
# false:: if the current node platform family is not in the list.
|
262
|
+
def platform_family?(*args)
|
263
|
+
args.flatten.any? do |platform_family|
|
264
|
+
platform_family.to_s == node[:platform_family]
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# Shamelessly stolen from https://github.com/sethvargo/chef-sugar/blob/master/lib/chef/sugar/docker.rb
|
269
|
+
# Given a node object, returns whether the node is a docker container.
|
270
|
+
#
|
271
|
+
# === Parameters
|
272
|
+
# node:: [Chef::Node] The node to check.
|
273
|
+
#
|
274
|
+
# === Returns
|
275
|
+
# true:: if the current node is a docker container
|
276
|
+
# false:: if the current node is not a docker container
|
277
|
+
def docker?(node = run_context.nil? ? nil : run_context.node)
|
278
|
+
# Using "File.exist?('/.dockerinit') || File.exist?('/.dockerenv')" makes Travis sad,
|
279
|
+
# and that makes us sad too.
|
280
|
+
node && node[:virtualization] && node[:virtualization][:systems] &&
|
281
|
+
node[:virtualization][:systems][:docker] && node[:virtualization][:systems][:docker] == "guest"
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# **DEPRECATED**
|
289
|
+
# This used to be part of chef/mixin/language. Load the file to activate the deprecation code.
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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
|
+
begin
|
10
|
+
require 'chef/dsl/recipe'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
require "chef_compat/copied_from_chef/chef/dsl/core"
|
18
|
+
require "chef_compat/copied_from_chef/chef/mixin/lazy_module_include"
|
19
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
20
|
+
module DSL
|
21
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL)
|
22
|
+
module Recipe
|
23
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe, self) if defined?(::Chef::DSL::Recipe)
|
24
|
+
include Chef::DSL::Core
|
25
|
+
extend Chef::Mixin::LazyModuleInclude
|
26
|
+
module FullDSL
|
27
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe::FullDSL, self) if defined?(::Chef::DSL::Recipe::FullDSL)
|
28
|
+
include Chef::DSL::Recipe
|
29
|
+
extend Chef::Mixin::LazyModuleInclude
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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
|
+
begin
|
10
|
+
require 'chef/dsl/universal'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#--
|
18
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
19
|
+
# Author:: Christopher Walters (<cw@chef.io>)
|
20
|
+
# Copyright:: Copyright 2008-2016 Chef Software, Inc.
|
21
|
+
# License:: Apache License, Version 2.0
|
22
|
+
#
|
23
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
24
|
+
# you may not use this file except in compliance with the License.
|
25
|
+
# You may obtain a copy of the License at
|
26
|
+
#
|
27
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
28
|
+
#
|
29
|
+
# Unless required by applicable law or agreed to in writing, software
|
30
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
31
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
32
|
+
# See the License for the specific language governing permissions and
|
33
|
+
# limitations under the License.
|
34
|
+
#
|
35
|
+
|
36
|
+
require "chef_compat/copied_from_chef/chef/dsl/platform_introspection"
|
37
|
+
require "chef_compat/copied_from_chef/chef/mixin/powershell_out"
|
38
|
+
|
39
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
40
|
+
module DSL
|
41
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL)
|
42
|
+
# Part of a family of DSL mixins.
|
43
|
+
#
|
44
|
+
# Chef::DSL::Recipe mixes into Recipes and LWRP Providers.
|
45
|
+
# - this does not target core chef resources and providers.
|
46
|
+
# - this is restricted to recipe/resource/provider context where a resource collection exists.
|
47
|
+
# - cookbook authors should typically include modules into here.
|
48
|
+
#
|
49
|
+
# Chef::DSL::Core mixes into Recipes, LWRP Providers and Core Providers
|
50
|
+
# - this adds cores providers on top of the Recipe DSL.
|
51
|
+
# - this is restricted to recipe/resource/provider context where a resource collection exists.
|
52
|
+
# - core chef authors should typically include modules into here.
|
53
|
+
#
|
54
|
+
# Chef::DSL::Universal mixes into Recipes, LWRP Resources+Providers, Core Resources+Providers, and Attributes files.
|
55
|
+
# - this adds resources and attributes files.
|
56
|
+
# - do not add helpers which manipulate the resource collection.
|
57
|
+
# - this is for general-purpose stuff that is useful nearly everywhere.
|
58
|
+
# - it also pollutes the namespace of nearly every context, watch out.
|
59
|
+
#
|
60
|
+
module Universal
|
61
|
+
CopiedFromChef.extend_chef_module(::Chef::DSL::Universal, self) if defined?(::Chef::DSL::Universal)
|
62
|
+
include Chef::DSL::PlatformIntrospection
|
63
|
+
include Chef::Mixin::PowershellOut
|
64
|
+
include Chef::Mixin::ShellOut
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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
|
+
begin
|
10
|
+
require 'chef/mixin/lazy_module_include'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Copyright:: Copyright 2011-2016, Chef Software Inc.
|
19
|
+
# License:: Apache License, Version 2.0
|
20
|
+
#
|
21
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
22
|
+
# you may not use this file except in compliance with the License.
|
23
|
+
# You may obtain a copy of the License at
|
24
|
+
#
|
25
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
26
|
+
#
|
27
|
+
# Unless required by applicable law or agreed to in writing, software
|
28
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
29
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
30
|
+
# See the License for the specific language governing permissions and
|
31
|
+
# limitations under the License.
|
32
|
+
#
|
33
|
+
|
34
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
35
|
+
module Mixin
|
36
|
+
CopiedFromChef.extend_chef_module(::Chef::Mixin, self) if defined?(::Chef::Mixin)
|
37
|
+
# If you have:
|
38
|
+
#
|
39
|
+
# module A
|
40
|
+
# extend LazyModuleInclude
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# module B
|
44
|
+
# include A
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# module C
|
48
|
+
# include B
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# module Monkeypatches
|
52
|
+
# def monkey
|
53
|
+
# puts "monkey!"
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# A.send(:include, Monkeypatches)
|
58
|
+
#
|
59
|
+
# Then B and C and any classes that they're included in will also get the #monkey method patched into them.
|
60
|
+
#
|
61
|
+
module LazyModuleInclude
|
62
|
+
CopiedFromChef.extend_chef_module(::Chef::Mixin::LazyModuleInclude, self) if defined?(::Chef::Mixin::LazyModuleInclude)
|
63
|
+
|
64
|
+
# Most of the magick is in this hook which creates a closure over the parent class and then builds an
|
65
|
+
# "infector" module which infects all descendants and which is responsible for updating the list of
|
66
|
+
# descendants in the parent class.
|
67
|
+
def included(klass)
|
68
|
+
super
|
69
|
+
parent_klass = self
|
70
|
+
infector = Module.new do
|
71
|
+
define_method(:included) do |subklass|
|
72
|
+
super(subklass)
|
73
|
+
subklass.extend(infector)
|
74
|
+
parent_klass.descendants.push(subklass)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
klass.extend(infector)
|
78
|
+
parent_klass.descendants.push(klass)
|
79
|
+
end
|
80
|
+
|
81
|
+
def descendants
|
82
|
+
@descendants ||= []
|
83
|
+
end
|
84
|
+
|
85
|
+
def include(*classes)
|
86
|
+
super
|
87
|
+
classes.each do |klass|
|
88
|
+
descendants.each do |descendant|
|
89
|
+
descendant.send(:include, klass)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb
ADDED
@@ -0,0 +1,74 @@
|
|
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
|
+
begin
|
10
|
+
require 'chef/mixin/notifying_block'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#--
|
18
|
+
# Author:: Lamont Granquist <lamont@chef.io>
|
19
|
+
# Copyright:: Copyright 2010-2016, Chef Software Inc.
|
20
|
+
# License:: Apache License, Version 2.0
|
21
|
+
#
|
22
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
23
|
+
# you may not use this file except in compliance with the License.
|
24
|
+
# You may obtain a copy of the License at
|
25
|
+
#
|
26
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
27
|
+
#
|
28
|
+
# Unless required by applicable law or agreed to in writing, software
|
29
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
30
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
31
|
+
# See the License for the specific language governing permissions and
|
32
|
+
# limitations under the License.
|
33
|
+
|
34
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
35
|
+
module Mixin
|
36
|
+
CopiedFromChef.extend_chef_module(::Chef::Mixin, self) if defined?(::Chef::Mixin)
|
37
|
+
module NotifyingBlock
|
38
|
+
CopiedFromChef.extend_chef_module(::Chef::Mixin::NotifyingBlock, self) if defined?(::Chef::Mixin::NotifyingBlock)
|
39
|
+
|
40
|
+
def notifying_block(&block)
|
41
|
+
begin
|
42
|
+
subcontext = subcontext_block(&block)
|
43
|
+
Chef::Runner.new(subcontext).converge
|
44
|
+
ensure
|
45
|
+
# recipes don't have a new_resource
|
46
|
+
if respond_to?(:new_resource)
|
47
|
+
if subcontext && subcontext.resource_collection.any?(&:updated?)
|
48
|
+
new_resource.updated_by_last_action(true)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def subcontext_block(parent_context = nil, &block)
|
55
|
+
parent_context ||= @run_context
|
56
|
+
sub_run_context = parent_context.create_child
|
57
|
+
|
58
|
+
begin
|
59
|
+
outer_run_context = @run_context
|
60
|
+
@run_context = sub_run_context
|
61
|
+
instance_eval(&block)
|
62
|
+
ensure
|
63
|
+
@run_context = outer_run_context
|
64
|
+
end
|
65
|
+
|
66
|
+
sub_run_context
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|