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,65 @@
|
|
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/resource/apt_repository'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Author:: Thom May (<thom@chef.io>)
|
19
|
+
# Copyright:: Copyright (c) 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
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
36
|
+
|
37
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
38
|
+
class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
|
39
|
+
class AptRepository < (defined?(::Chef::Resource::AptRepository) ? ::Chef::Resource::AptRepository : Chef::Resource)
|
40
|
+
resource_name :apt_repository
|
41
|
+
provides :apt_repository
|
42
|
+
|
43
|
+
property :repo_name, String, name_property: true
|
44
|
+
property :uri, String
|
45
|
+
property :distribution, [ String, nil, false ], default: lazy { node["lsb"]["codename"] }, nillable: true, coerce: proc { |x| x ? x : nil }
|
46
|
+
property :components, Array, default: []
|
47
|
+
property :arch, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
|
48
|
+
property :trusted, [TrueClass, FalseClass], default: false
|
49
|
+
# whether or not to add the repository as a source repo, too
|
50
|
+
property :deb_src, [TrueClass, FalseClass], default: false
|
51
|
+
property :keyserver, [String, nil, false], default: "keyserver.ubuntu.com", nillable: true, coerce: proc { |x| x ? x : nil }
|
52
|
+
property :key, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
|
53
|
+
property :key_proxy, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
|
54
|
+
|
55
|
+
property :cookbook, [String, nil, false], default: nil, desired_state: false, nillable: true, coerce: proc { |x| x ? x : nil }
|
56
|
+
property :cache_rebuild, [TrueClass, FalseClass], default: true, desired_state: false
|
57
|
+
|
58
|
+
default_action :add
|
59
|
+
allowed_actions :add, :remove
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb
ADDED
@@ -0,0 +1,52 @@
|
|
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/resource/apt_update'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Author:: Thom May (<thom@chef.io>)
|
19
|
+
# Copyright:: Copyright (c) 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
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
36
|
+
|
37
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
38
|
+
class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
|
39
|
+
class AptUpdate < (defined?(::Chef::Resource::AptUpdate) ? ::Chef::Resource::AptUpdate : Chef::Resource)
|
40
|
+
resource_name :apt_update
|
41
|
+
provides :apt_update
|
42
|
+
|
43
|
+
property :frequency, Integer, default: 86_400
|
44
|
+
|
45
|
+
default_action :periodic
|
46
|
+
allowed_actions :update, :periodic
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb
ADDED
@@ -0,0 +1,81 @@
|
|
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/resource/systemd_unit'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Author:: Nathan Williams (<nath.e.will@gmail.com>)
|
19
|
+
# Copyright:: Copyright 2016, Nathan Williams
|
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
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
36
|
+
|
37
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
38
|
+
class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
|
39
|
+
class SystemdUnit < (defined?(::Chef::Resource::SystemdUnit) ? ::Chef::Resource::SystemdUnit : Chef::Resource)
|
40
|
+
resource_name :systemd_unit
|
41
|
+
|
42
|
+
default_action :nothing
|
43
|
+
allowed_actions :create, :delete,
|
44
|
+
:enable, :disable,
|
45
|
+
:mask, :unmask,
|
46
|
+
:start, :stop,
|
47
|
+
:restart, :reload,
|
48
|
+
:try_restart, :reload_or_restart,
|
49
|
+
:reload_or_try_restart
|
50
|
+
|
51
|
+
property :enabled, [TrueClass, FalseClass]
|
52
|
+
property :active, [TrueClass, FalseClass]
|
53
|
+
property :masked, [TrueClass, FalseClass]
|
54
|
+
property :static, [TrueClass, FalseClass]
|
55
|
+
property :user, String, desired_state: false
|
56
|
+
property :content, [String, Hash]
|
57
|
+
property :triggers_reload, [TrueClass, FalseClass],
|
58
|
+
default: true, desired_state: false
|
59
|
+
|
60
|
+
def to_ini
|
61
|
+
case content
|
62
|
+
when Hash
|
63
|
+
IniParse.gen do |doc|
|
64
|
+
content.each_pair do |sect, opts|
|
65
|
+
doc.section(sect) do |section|
|
66
|
+
opts.each_pair do |opt, val|
|
67
|
+
section.option(opt, val)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end.to_s
|
72
|
+
else
|
73
|
+
content.to_s
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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/resource/yum_repository'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
require 'chef_compat/copied_from_chef'
|
14
|
+
class Chef
|
15
|
+
module ::ChefCompat
|
16
|
+
module CopiedFromChef
|
17
|
+
#
|
18
|
+
# Author:: Thom May (<thom@chef.io>)
|
19
|
+
# Copyright:: Copyright (c) 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
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
36
|
+
|
37
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
38
|
+
class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
|
39
|
+
class YumRepository < (defined?(::Chef::Resource::YumRepository) ? ::Chef::Resource::YumRepository : Chef::Resource)
|
40
|
+
resource_name :yum_repository
|
41
|
+
provides :yum_repository
|
42
|
+
|
43
|
+
# http://linux.die.net/man/5/yum.conf
|
44
|
+
property :baseurl, [String, Array], regex: /.*/
|
45
|
+
property :cost, String, regex: /^\d+$/
|
46
|
+
property :clean_headers, [TrueClass, FalseClass], default: false # deprecated
|
47
|
+
property :clean_metadata, [TrueClass, FalseClass], default: true
|
48
|
+
property :description, String, regex: /.*/, default: "Yum Repository"
|
49
|
+
property :enabled, [TrueClass, FalseClass], default: true
|
50
|
+
property :enablegroups, [TrueClass, FalseClass]
|
51
|
+
property :exclude, String, regex: /.*/
|
52
|
+
property :failovermethod, String, equal_to: %w{priority roundrobin}
|
53
|
+
property :fastestmirror_enabled, [TrueClass, FalseClass]
|
54
|
+
property :gpgcheck, [TrueClass, FalseClass], default: true
|
55
|
+
property :gpgkey, [String, Array], regex: /.*/
|
56
|
+
property :http_caching, String, equal_to: %w{packages all none}
|
57
|
+
property :include_config, String, regex: /.*/
|
58
|
+
property :includepkgs, String, regex: /.*/
|
59
|
+
property :keepalive, [TrueClass, FalseClass]
|
60
|
+
property :make_cache, [TrueClass, FalseClass], default: true
|
61
|
+
property :max_retries, [String, Integer]
|
62
|
+
property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/]
|
63
|
+
property :mirrorexpire, String, regex: /.*/
|
64
|
+
property :mirrorlist, String, regex: /.*/
|
65
|
+
property :mirror_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
|
66
|
+
property :mirrorlist_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
|
67
|
+
property :mode, default: "0644"
|
68
|
+
property :priority, String, regex: /^(\d?[0-9]|[0-9][0-9])$/
|
69
|
+
property :proxy, String, regex: /.*/
|
70
|
+
property :proxy_username, String, regex: /.*/
|
71
|
+
property :proxy_password, String, regex: /.*/
|
72
|
+
property :username, String, regex: /.*/
|
73
|
+
property :password, String, regex: /.*/
|
74
|
+
property :repo_gpgcheck, [TrueClass, FalseClass]
|
75
|
+
property :report_instanceid, [TrueClass, FalseClass]
|
76
|
+
property :repositoryid, String, regex: /.*/, name_property: true
|
77
|
+
property :skip_if_unavailable, [TrueClass, FalseClass]
|
78
|
+
property :source, String, regex: /.*/
|
79
|
+
property :sslcacert, String, regex: /.*/
|
80
|
+
property :sslclientcert, String, regex: /.*/
|
81
|
+
property :sslclientkey, String, regex: /.*/
|
82
|
+
property :sslverify, [TrueClass, FalseClass]
|
83
|
+
property :timeout, String, regex: /^\d+$/
|
84
|
+
property :options, Hash
|
85
|
+
|
86
|
+
default_action :create
|
87
|
+
allowed_actions :create, :remove, :makecache, :add, :delete
|
88
|
+
|
89
|
+
# provide compatibility with the yum cookbook < 3.0 properties
|
90
|
+
alias_method :url, :baseurl
|
91
|
+
alias_method :keyurl, :gpgkey
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,214 @@
|
|
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/resource'
|
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/resource/action_class"
|
18
|
+
require "chef_compat/copied_from_chef/chef/provider"
|
19
|
+
require "chef_compat/copied_from_chef/chef/mixin/properties"
|
20
|
+
require "chef_compat/copied_from_chef/chef/dsl/universal"
|
21
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
22
|
+
class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
|
23
|
+
include Chef::Mixin::Properties
|
24
|
+
property :name, String, coerce: proc { |v| v.is_a?(Array) ? v.join(", ") : v.to_s }, desired_state: false
|
25
|
+
def initialize(name, run_context = nil)
|
26
|
+
super if defined?(::Chef::Resource)
|
27
|
+
name(name) unless name.nil?
|
28
|
+
@run_context = run_context
|
29
|
+
@noop = nil
|
30
|
+
@before = nil
|
31
|
+
@params = Hash.new
|
32
|
+
@provider = nil
|
33
|
+
@allowed_actions = self.class.allowed_actions.to_a
|
34
|
+
@action = self.class.default_action
|
35
|
+
@updated = false
|
36
|
+
@updated_by_last_action = false
|
37
|
+
@supports = {}
|
38
|
+
@ignore_failure = false
|
39
|
+
@retries = 0
|
40
|
+
@retry_delay = 2
|
41
|
+
@not_if = []
|
42
|
+
@only_if = []
|
43
|
+
@source_line = nil
|
44
|
+
# We would like to raise an error when the user gives us a guard
|
45
|
+
# interpreter and a ruby_block to the guard. In order to achieve this
|
46
|
+
# we need to understand when the user overrides the default guard
|
47
|
+
# interpreter. Therefore we store the default separately in a different
|
48
|
+
# attribute.
|
49
|
+
@guard_interpreter = nil
|
50
|
+
@default_guard_interpreter = :default
|
51
|
+
@elapsed_time = 0
|
52
|
+
@sensitive = false
|
53
|
+
end
|
54
|
+
def action(arg = nil)
|
55
|
+
if arg
|
56
|
+
arg = Array(arg).map(&:to_sym)
|
57
|
+
arg.each do |action|
|
58
|
+
validate(
|
59
|
+
{ action: action },
|
60
|
+
{ action: { kind_of: Symbol, equal_to: allowed_actions } }
|
61
|
+
)
|
62
|
+
end
|
63
|
+
@action = arg
|
64
|
+
else
|
65
|
+
@action
|
66
|
+
end
|
67
|
+
end
|
68
|
+
alias_method :action=, :action
|
69
|
+
class UnresolvedSubscribes < (defined?(::Chef::Resource::UnresolvedSubscribes) ? ::Chef::Resource::UnresolvedSubscribes : self)
|
70
|
+
alias_method :to_s, :name
|
71
|
+
alias_method :declared_key, :name
|
72
|
+
end
|
73
|
+
def state_for_resource_reporter
|
74
|
+
state = {}
|
75
|
+
state_properties = self.class.state_properties
|
76
|
+
state_properties.each do |property|
|
77
|
+
if property.identity? || property.is_set?(self)
|
78
|
+
state[property.name] = property.sensitive? ? "*sensitive value suppressed*" : send(property.name)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
state
|
82
|
+
end
|
83
|
+
alias_method :state, :state_for_resource_reporter
|
84
|
+
def identity
|
85
|
+
result = {}
|
86
|
+
identity_properties = self.class.identity_properties
|
87
|
+
identity_properties.each do |property|
|
88
|
+
result[property.name] = send(property.name)
|
89
|
+
end
|
90
|
+
return result.values.first if identity_properties.size == 1
|
91
|
+
result
|
92
|
+
end
|
93
|
+
attr_reader :resource_initializing
|
94
|
+
def resource_initializing=(value)
|
95
|
+
if value
|
96
|
+
@resource_initializing = true
|
97
|
+
else
|
98
|
+
remove_instance_variable(:@resource_initializing)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
def to_hash
|
102
|
+
# Grab all current state, then any other ivars (backcompat)
|
103
|
+
result = {}
|
104
|
+
self.class.state_properties.each do |p|
|
105
|
+
result[p.name] = p.get(self)
|
106
|
+
end
|
107
|
+
safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
|
108
|
+
safe_ivars.each do |iv|
|
109
|
+
key = iv.to_s.sub(/^@/, "").to_sym
|
110
|
+
next if result.has_key?(key)
|
111
|
+
result[key] = instance_variable_get(iv)
|
112
|
+
end
|
113
|
+
result
|
114
|
+
end
|
115
|
+
def self.identity_property(name = nil)
|
116
|
+
result = identity_properties(*Array(name))
|
117
|
+
if result.size > 1
|
118
|
+
raise Chef::Exceptions::MultipleIdentityError, "identity_property cannot be called on an object with more than one identity property (#{result.map { |r| r.name }.join(", ")})."
|
119
|
+
end
|
120
|
+
result.first
|
121
|
+
end
|
122
|
+
attr_accessor :allowed_actions
|
123
|
+
def allowed_actions(value = NOT_PASSED)
|
124
|
+
if value != NOT_PASSED
|
125
|
+
self.allowed_actions = value
|
126
|
+
end
|
127
|
+
@allowed_actions
|
128
|
+
end
|
129
|
+
def resource_name
|
130
|
+
@resource_name || self.class.resource_name
|
131
|
+
end
|
132
|
+
def self.use_automatic_resource_name
|
133
|
+
automatic_name = convert_to_snake_case(self.name.split("::")[-1])
|
134
|
+
resource_name automatic_name
|
135
|
+
end
|
136
|
+
def self.allowed_actions(*actions)
|
137
|
+
@allowed_actions ||=
|
138
|
+
if superclass.respond_to?(:allowed_actions)
|
139
|
+
superclass.allowed_actions.dup
|
140
|
+
else
|
141
|
+
[ :nothing ]
|
142
|
+
end
|
143
|
+
@allowed_actions |= actions.flatten
|
144
|
+
end
|
145
|
+
def self.allowed_actions=(value)
|
146
|
+
@allowed_actions = value.uniq
|
147
|
+
end
|
148
|
+
def self.default_action(action_name = NOT_PASSED)
|
149
|
+
unless action_name.equal?(NOT_PASSED)
|
150
|
+
@default_action = Array(action_name).map(&:to_sym)
|
151
|
+
self.allowed_actions |= @default_action
|
152
|
+
end
|
153
|
+
|
154
|
+
if @default_action
|
155
|
+
@default_action
|
156
|
+
elsif superclass.respond_to?(:default_action)
|
157
|
+
superclass.default_action
|
158
|
+
else
|
159
|
+
[:nothing]
|
160
|
+
end
|
161
|
+
end
|
162
|
+
def self.default_action=(action_name)
|
163
|
+
default_action action_name
|
164
|
+
end
|
165
|
+
def self.action(action, &recipe_block)
|
166
|
+
action = action.to_sym
|
167
|
+
declare_action_class
|
168
|
+
action_class.action(action, &recipe_block)
|
169
|
+
self.allowed_actions += [ action ]
|
170
|
+
default_action action if Array(default_action) == [:nothing]
|
171
|
+
end
|
172
|
+
def self.load_current_value(&load_block)
|
173
|
+
define_method(:load_current_value!, &load_block)
|
174
|
+
end
|
175
|
+
def current_value_does_not_exist!
|
176
|
+
raise Chef::Exceptions::CurrentValueDoesNotExist
|
177
|
+
end
|
178
|
+
def self.action_class(&block)
|
179
|
+
return @action_class if @action_class && !block
|
180
|
+
# If the superclass needed one, then we need one as well.
|
181
|
+
if block || (superclass.respond_to?(:action_class) && superclass.action_class)
|
182
|
+
@action_class = declare_action_class(&block)
|
183
|
+
end
|
184
|
+
@action_class
|
185
|
+
end
|
186
|
+
def self.declare_action_class(&block)
|
187
|
+
@action_class ||= begin
|
188
|
+
if superclass.respond_to?(:action_class)
|
189
|
+
base_provider = superclass.action_class
|
190
|
+
end
|
191
|
+
base_provider ||= Chef::Provider
|
192
|
+
|
193
|
+
resource_class = self
|
194
|
+
Class.new(base_provider) do
|
195
|
+
include ActionClass
|
196
|
+
self.resource_class = resource_class
|
197
|
+
end
|
198
|
+
end
|
199
|
+
@action_class.class_eval(&block) if block
|
200
|
+
@action_class
|
201
|
+
end
|
202
|
+
FORBIDDEN_IVARS = [:@run_context, :@not_if, :@only_if, :@enclosing_provider]
|
203
|
+
HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name, :@not_if, :@only_if, :@elapsed_time, :@enclosing_provider]
|
204
|
+
class << self
|
205
|
+
end
|
206
|
+
@@sorted_descendants = nil
|
207
|
+
module DeprecatedLWRPClass
|
208
|
+
CopiedFromChef.extend_chef_module(::Chef::Resource::DeprecatedLWRPClass, self) if defined?(::Chef::Resource::DeprecatedLWRPClass)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb
ADDED
@@ -0,0 +1,174 @@
|
|
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/resource_builder'
|
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 2015-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
|
+
# NOTE: this was extracted from the Recipe DSL mixin, relevant specs are in spec/unit/recipe_spec.rb
|
36
|
+
|
37
|
+
class Chef < (defined?(::Chef) ? ::Chef : Object)
|
38
|
+
class ResourceBuilder < (defined?(::Chef::ResourceBuilder) ? ::Chef::ResourceBuilder : Object)
|
39
|
+
attr_reader :type
|
40
|
+
attr_reader :name
|
41
|
+
attr_reader :created_at
|
42
|
+
attr_reader :params
|
43
|
+
attr_reader :run_context
|
44
|
+
attr_reader :cookbook_name
|
45
|
+
attr_reader :recipe_name
|
46
|
+
attr_reader :enclosing_provider
|
47
|
+
attr_reader :resource
|
48
|
+
|
49
|
+
# FIXME (ruby-2.1 syntax): most of these are mandatory
|
50
|
+
def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)
|
51
|
+
super if defined?(::Chef::ResourceBuilder)
|
52
|
+
@type = type
|
53
|
+
@name = name
|
54
|
+
@created_at = created_at
|
55
|
+
@params = params
|
56
|
+
@run_context = run_context
|
57
|
+
@cookbook_name = cookbook_name
|
58
|
+
@recipe_name = recipe_name
|
59
|
+
@enclosing_provider = enclosing_provider
|
60
|
+
end
|
61
|
+
|
62
|
+
def build(&block)
|
63
|
+
raise ArgumentError, "You must supply a name when declaring a #{type} resource" if name.nil?
|
64
|
+
|
65
|
+
@resource = resource_class.new(name, run_context)
|
66
|
+
if resource.resource_name.nil?
|
67
|
+
raise Chef::Exceptions::InvalidResourceSpecification, "#{resource}.resource_name is `nil`! Did you forget to put `provides :blah` or `resource_name :blah` in your resource class?"
|
68
|
+
end
|
69
|
+
resource.source_line = created_at
|
70
|
+
resource.declared_type = type
|
71
|
+
|
72
|
+
# If we have a resource like this one, we want to steal its state
|
73
|
+
# This behavior is very counter-intuitive and should be removed.
|
74
|
+
# See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694
|
75
|
+
# Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052
|
76
|
+
if prior_resource
|
77
|
+
resource.load_from(prior_resource)
|
78
|
+
end
|
79
|
+
|
80
|
+
resource.cookbook_name = cookbook_name
|
81
|
+
resource.recipe_name = recipe_name
|
82
|
+
# Determine whether this resource is being created in the context of an enclosing Provider
|
83
|
+
resource.enclosing_provider = enclosing_provider
|
84
|
+
|
85
|
+
# XXX: this is required for definition params inside of the scope of a
|
86
|
+
# subresource to work correctly.
|
87
|
+
resource.params = params
|
88
|
+
|
89
|
+
# Evaluate resource attribute DSL
|
90
|
+
if block_given?
|
91
|
+
resource.resource_initializing = true
|
92
|
+
begin
|
93
|
+
resource.instance_eval(&block)
|
94
|
+
ensure
|
95
|
+
resource.resource_initializing = false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# emit a cloned resource warning if it is warranted
|
100
|
+
if prior_resource
|
101
|
+
if is_trivial_resource?(prior_resource) && identicalish_resources?(prior_resource, resource)
|
102
|
+
emit_harmless_cloning_debug
|
103
|
+
else
|
104
|
+
emit_cloned_resource_warning
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Run optional resource hook
|
109
|
+
resource.after_created
|
110
|
+
|
111
|
+
resource
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def resource_class
|
117
|
+
# Checks the new platform => short_name => resource mapping initially
|
118
|
+
# then fall back to the older approach (Chef::Resource.const_get) for
|
119
|
+
# backward compatibility
|
120
|
+
@resource_class ||= Chef::Resource.resource_for_node(type, run_context.node)
|
121
|
+
end
|
122
|
+
|
123
|
+
def is_trivial_resource?(resource)
|
124
|
+
trivial_resource = resource_class.new(name, run_context)
|
125
|
+
# force un-lazy the name property on the created trivial resource
|
126
|
+
name_property = resource_class.properties.find { |sym, p| p.name_property? }
|
127
|
+
trivial_resource.send(name_property[0]) unless name_property.nil?
|
128
|
+
identicalish_resources?(trivial_resource, resource)
|
129
|
+
end
|
130
|
+
|
131
|
+
# this is an equality test specific to checking for 3694 cloning warnings
|
132
|
+
def identicalish_resources?(first, second)
|
133
|
+
skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]
|
134
|
+
checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars
|
135
|
+
non_matching_ivars = checked_ivars.reject do |iv|
|
136
|
+
if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )
|
137
|
+
# :nothing action on either side of the comparison always matches
|
138
|
+
true
|
139
|
+
else
|
140
|
+
first.instance_variable_get(iv) == second.instance_variable_get(iv)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
Chef::Log.debug("ivars which did not match with the prior resource: #{non_matching_ivars}")
|
144
|
+
non_matching_ivars.empty?
|
145
|
+
end
|
146
|
+
|
147
|
+
def emit_cloned_resource_warning
|
148
|
+
message = "Cloning resource attributes for #{resource} from prior resource (CHEF-3694)"
|
149
|
+
message << "\nPrevious #{prior_resource}: #{prior_resource.source_line}" if prior_resource.source_line
|
150
|
+
message << "\nCurrent #{resource}: #{resource.source_line}" if resource.source_line
|
151
|
+
Chef.log_deprecation(message)
|
152
|
+
end
|
153
|
+
|
154
|
+
def emit_harmless_cloning_debug
|
155
|
+
Chef::Log.debug("Harmless resource cloning from #{prior_resource}:#{prior_resource.source_line} to #{resource}:#{resource.source_line}")
|
156
|
+
end
|
157
|
+
|
158
|
+
def prior_resource
|
159
|
+
@prior_resource ||=
|
160
|
+
begin
|
161
|
+
key = "#{type}[#{name}]"
|
162
|
+
run_context.resource_collection.lookup_local(key)
|
163
|
+
rescue Chef::Exceptions::ResourceNotFound
|
164
|
+
nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
require "chef_compat/copied_from_chef/chef/resource"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|