From a8948053d6849ec4d951fddd0a8e045f2db5160c Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Tue, 30 Nov 2021 09:53:33 -0600 Subject: [PATCH 1/2] Update LND to 0.14.1 closes #351 --- site-cookbooks/kosmos-bitcoin/attributes/default.rb | 2 +- site-cookbooks/kosmos-bitcoin/recipes/lnd.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/site-cookbooks/kosmos-bitcoin/attributes/default.rb b/site-cookbooks/kosmos-bitcoin/attributes/default.rb index b727aa9..5d73674 100644 --- a/site-cookbooks/kosmos-bitcoin/attributes/default.rb +++ b/site-cookbooks/kosmos-bitcoin/attributes/default.rb @@ -38,7 +38,7 @@ node.default['c-lightning']['log_level'] = 'info' node.default['c-lightning']['public_ip'] = '148.251.237.73' node.default['lnd']['repo'] = 'https://github.com/lightningnetwork/lnd' -node.default['lnd']['revision'] = 'v0.13.1-beta' +node.default['lnd']['revision'] = 'v0.14.1-beta' node.default['lnd']['source_dir'] = '/opt/lnd' node.default['lnd']['lnd_dir'] = "/home/#{node['bitcoin']['username']}/.lnd" node.default['lnd']['alias'] = 'ln2.kosmos.org' diff --git a/site-cookbooks/kosmos-bitcoin/recipes/lnd.rb b/site-cookbooks/kosmos-bitcoin/recipes/lnd.rb index 47bbe7e..e800b31 100644 --- a/site-cookbooks/kosmos-bitcoin/recipes/lnd.rb +++ b/site-cookbooks/kosmos-bitcoin/recipes/lnd.rb @@ -4,6 +4,8 @@ # include_recipe "git" + +node.override['golang']['version'] = "1.17.4" include_recipe "golang" git node['lnd']['source_dir'] do From bbef38b6d6ead1447e59cb087ee9f9b9169d53c6 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Sat, 4 Dec 2021 19:57:19 -0600 Subject: [PATCH 2/2] Update golang cookbook --- Berksfile | 2 +- Berksfile.lock | 27 +- cookbooks/ark/CHANGELOG.md | 37 ++- cookbooks/ark/CONTRIBUTING.md | 2 - cookbooks/ark/LICENSE | 202 ++++++++++++ cookbooks/ark/README.md | 52 +-- cookbooks/ark/attributes/default.rb | 2 +- cookbooks/ark/chefignore | 115 +++++++ cookbooks/ark/kitchen.dokken.yml | 65 ++++ cookbooks/ark/kitchen.exec.yml | 14 + cookbooks/ark/libraries/resource_defaults.rb | 2 +- .../ark/libraries/sevenzip_command_builder.rb | 2 +- .../ark/libraries/tar_command_builder.rb | 2 +- cookbooks/ark/metadata.json | 50 ++- cookbooks/ark/metadata.rb | 38 ++- cookbooks/ark/recipes/default.rb | 2 +- cookbooks/ark/resources/default.rb | 7 +- cookbooks/golang/CHANGELOG.md | 30 ++ cookbooks/golang/CONTRIBUTING.md | 4 - cookbooks/golang/LICENSE | 201 ++++++++++++ cookbooks/golang/chefignore | 115 +++++++ cookbooks/golang/kitchen.dokken.yml | 55 ++++ cookbooks/golang/metadata.json | 44 ++- cookbooks/golang/metadata.rb | 6 +- cookbooks/golang/recipes/default.rb | 4 +- cookbooks/golang/resources/default.rb | 6 +- cookbooks/golang/resources/package.rb | 16 + cookbooks/mingw/CHANGELOG.md | 13 + cookbooks/mingw/CONTRIBUTING.md | 2 - cookbooks/mingw/LICENSE | 202 ++++++++++++ cookbooks/mingw/README.md | 2 +- cookbooks/mingw/chefignore | 115 +++++++ cookbooks/mingw/libraries/_helper.rb | 4 +- cookbooks/mingw/metadata.json | 37 ++- cookbooks/mingw/metadata.rb | 14 + cookbooks/mingw/recipes/default.rb | 2 +- cookbooks/mingw/resources/get.rb | 4 +- cookbooks/mingw/resources/msys2_package.rb | 24 +- cookbooks/mingw/resources/tdm_gcc.rb | 4 +- cookbooks/mysql/CHANGELOG.md | 7 + cookbooks/mysql/libraries/helpers.rb | 96 +++--- .../mysql/libraries/mysql_service_base.rb | 2 +- cookbooks/mysql/metadata.json | 2 +- cookbooks/mysql/metadata.rb | 2 +- cookbooks/nodejs/CHANGELOG.md | 8 + cookbooks/nodejs/metadata.json | 2 +- cookbooks/nodejs/metadata.rb | 2 +- cookbooks/php/CHANGELOG.md | 4 + cookbooks/php/attributes/default.rb | 3 +- cookbooks/php/metadata.json | 2 +- cookbooks/php/metadata.rb | 18 +- cookbooks/seven_zip/CHANGELOG.md | 104 ++++++ cookbooks/seven_zip/Gemfile | 8 - cookbooks/seven_zip/Gemfile.lock | 79 ----- cookbooks/seven_zip/README.md | 124 +++----- cookbooks/seven_zip/appveyor.yml | 42 --- cookbooks/seven_zip/attributes/default.rb | 31 -- cookbooks/seven_zip/chefignore | 117 ++++--- cookbooks/seven_zip/kitchen.exec.yml | 15 + cookbooks/seven_zip/libraries/matchers.rb | 33 -- cookbooks/seven_zip/metadata.json | 22 +- cookbooks/seven_zip/metadata.rb | 15 +- cookbooks/seven_zip/providers/archive.rb | 64 ---- cookbooks/seven_zip/recipes/default.rb | 24 -- cookbooks/seven_zip/resources/archive.rb | 115 +++++-- cookbooks/seven_zip/resources/tool.rb | 49 +-- cookbooks/windows/CHANGELOG.md | 43 +++ cookbooks/windows/README.md | 129 ++------ .../windows/libraries/registry_helper.rb | 14 +- cookbooks/windows/libraries/windows_helper.rb | 2 +- cookbooks/windows/metadata.json | 2 +- cookbooks/windows/metadata.rb | 5 +- cookbooks/windows/providers/dns.rb | 5 - cookbooks/windows/resources/certificate.rb | 301 ------------------ .../windows/resources/certificate_binding.rb | 3 +- cookbooks/windows/resources/dns.rb | 5 +- cookbooks/windows/resources/http_acl.rb | 2 +- cookbooks/windows/resources/schannel.rb | 39 +++ cookbooks/windows/resources/share.rb | 288 ----------------- cookbooks/windows/resources/user_privilege.rb | 6 +- cookbooks/windows/resources/zipfile.rb | 1 + cookbooks/yum-epel/CHANGELOG.md | 55 ++++ cookbooks/yum-epel/CONTRIBUTING.md | 2 - cookbooks/yum-epel/LICENSE | 202 ++++++++++++ cookbooks/yum-epel/README.md | 170 ++++------ cookbooks/yum-epel/attributes/default.rb | 36 ++- .../yum-epel/attributes/epel-debuginfo.rb | 15 +- .../attributes/epel-modular-debuginfo.rb | 8 + .../attributes/epel-modular-source.rb | 8 + cookbooks/yum-epel/attributes/epel-modular.rb | 8 + .../attributes/epel-next-debuginfo.rb | 11 + .../yum-epel/attributes/epel-next-source.rb | 11 + .../attributes/epel-next-testing-debuginfo.rb | 11 + .../attributes/epel-next-testing-source.rb | 11 + .../yum-epel/attributes/epel-next-testing.rb | 11 + cookbooks/yum-epel/attributes/epel-next.rb | 10 + .../attributes/epel-playground-debuginfo.rb | 8 + .../attributes/epel-playground-source.rb | 8 + .../yum-epel/attributes/epel-playground.rb | 8 + cookbooks/yum-epel/attributes/epel-source.rb | 15 +- .../attributes/epel-testing-debuginfo.rb | 15 +- .../epel-testing-modular-debuginfo.rb | 8 + .../attributes/epel-testing-modular-source.rb | 8 + .../attributes/epel-testing-modular.rb | 8 + .../attributes/epel-testing-source.rb | 15 +- cookbooks/yum-epel/attributes/epel-testing.rb | 15 +- cookbooks/yum-epel/attributes/epel.rb | 15 +- cookbooks/yum-epel/chefignore | 115 +++++++ cookbooks/yum-epel/kitchen.dokken.yml | 46 +++ cookbooks/yum-epel/libraries/helpers.rb | 46 +++ cookbooks/yum-epel/metadata.json | 42 ++- cookbooks/yum-epel/metadata.rb | 16 + cookbooks/yum-epel/recipes/default.rb | 2 +- cookbooks/yum/.foodcritic | 1 - cookbooks/yum/CHANGELOG.md | 35 ++ cookbooks/yum/CONTRIBUTING.md | 2 - cookbooks/yum/LICENSE | 202 ++++++++++++ cookbooks/yum/README.md | 88 ++--- cookbooks/yum/attributes/main.rb | 102 +++--- cookbooks/yum/chefignore | 115 +++++++ cookbooks/yum/kitchen.dokken.yml | 48 +++ cookbooks/yum/libraries/matchers.rb | 9 - cookbooks/yum/metadata.json | 43 ++- cookbooks/yum/metadata.rb | 17 + cookbooks/yum/recipes/default.rb | 2 +- cookbooks/yum/recipes/dnf_yum_compat.rb | 29 -- cookbooks/yum/resources/dnf_module.rb | 104 ++++++ cookbooks/yum/resources/globalconfig.rb | 213 ++++++++----- cookbooks/yum/templates/main.erb | 12 +- nodes/bitcoin-2.json | 2 +- 130 files changed, 3548 insertions(+), 1795 deletions(-) delete mode 100644 cookbooks/ark/CONTRIBUTING.md create mode 100644 cookbooks/ark/LICENSE create mode 100644 cookbooks/ark/chefignore create mode 100644 cookbooks/ark/kitchen.dokken.yml create mode 100644 cookbooks/ark/kitchen.exec.yml delete mode 100644 cookbooks/golang/CONTRIBUTING.md create mode 100644 cookbooks/golang/LICENSE create mode 100644 cookbooks/golang/chefignore create mode 100644 cookbooks/golang/kitchen.dokken.yml delete mode 100644 cookbooks/mingw/CONTRIBUTING.md create mode 100644 cookbooks/mingw/LICENSE create mode 100644 cookbooks/mingw/chefignore create mode 100644 cookbooks/mingw/metadata.rb create mode 100644 cookbooks/seven_zip/CHANGELOG.md delete mode 100644 cookbooks/seven_zip/Gemfile delete mode 100644 cookbooks/seven_zip/Gemfile.lock delete mode 100644 cookbooks/seven_zip/appveyor.yml delete mode 100644 cookbooks/seven_zip/attributes/default.rb create mode 100644 cookbooks/seven_zip/kitchen.exec.yml delete mode 100644 cookbooks/seven_zip/libraries/matchers.rb delete mode 100644 cookbooks/seven_zip/providers/archive.rb delete mode 100644 cookbooks/seven_zip/recipes/default.rb delete mode 100644 cookbooks/windows/resources/certificate.rb create mode 100644 cookbooks/windows/resources/schannel.rb delete mode 100644 cookbooks/windows/resources/share.rb delete mode 100644 cookbooks/yum-epel/CONTRIBUTING.md create mode 100644 cookbooks/yum-epel/LICENSE create mode 100644 cookbooks/yum-epel/attributes/epel-modular-debuginfo.rb create mode 100644 cookbooks/yum-epel/attributes/epel-modular-source.rb create mode 100644 cookbooks/yum-epel/attributes/epel-modular.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next-debuginfo.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next-source.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next-testing-debuginfo.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next-testing-source.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next-testing.rb create mode 100644 cookbooks/yum-epel/attributes/epel-next.rb create mode 100644 cookbooks/yum-epel/attributes/epel-playground-debuginfo.rb create mode 100644 cookbooks/yum-epel/attributes/epel-playground-source.rb create mode 100644 cookbooks/yum-epel/attributes/epel-playground.rb create mode 100644 cookbooks/yum-epel/attributes/epel-testing-modular-debuginfo.rb create mode 100644 cookbooks/yum-epel/attributes/epel-testing-modular-source.rb create mode 100644 cookbooks/yum-epel/attributes/epel-testing-modular.rb create mode 100644 cookbooks/yum-epel/chefignore create mode 100644 cookbooks/yum-epel/kitchen.dokken.yml create mode 100644 cookbooks/yum-epel/libraries/helpers.rb create mode 100644 cookbooks/yum-epel/metadata.rb delete mode 100644 cookbooks/yum/.foodcritic delete mode 100644 cookbooks/yum/CONTRIBUTING.md create mode 100644 cookbooks/yum/LICENSE create mode 100644 cookbooks/yum/chefignore create mode 100644 cookbooks/yum/kitchen.dokken.yml delete mode 100644 cookbooks/yum/libraries/matchers.rb create mode 100644 cookbooks/yum/metadata.rb delete mode 100644 cookbooks/yum/recipes/dnf_yum_compat.rb create mode 100644 cookbooks/yum/resources/dnf_module.rb diff --git a/Berksfile b/Berksfile index 0faee3c..ff0f8be 100644 --- a/Berksfile +++ b/Berksfile @@ -52,5 +52,5 @@ cookbook 'ipfs', cookbook 'elasticsearch', '= 4.2.0' cookbook 'java', '~> 4.3.0' cookbook 'ulimit', '~> 1.0.0' -cookbook 'golang', '~> 4.1.0' +cookbook 'golang', '~> 5.3.1' cookbook 'zerotier', '~> 1.0.7' diff --git a/Berksfile.lock b/Berksfile.lock index 85f2083..9bf79bb 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -12,7 +12,7 @@ DEPENDENCIES elasticsearch (= 4.2.0) firewall (~> 2.6.3) git (~> 10.0.0) - golang (~> 4.1.0) + golang (~> 5.3.1) homebrew (= 3.0.0) hostname (= 0.4.2) hostsfile (~> 3.0.1) @@ -69,8 +69,8 @@ GRAPH poise-javascript (~> 1.0) poise-service (~> 1.0) apt (7.3.0) - ark (5.0.0) - seven_zip (>= 0.0.0) + ark (6.0.3) + seven_zip (>= 3.1) build-essential (8.2.1) mingw (>= 1.1) seven_zip (>= 0.0.0) @@ -89,8 +89,8 @@ GRAPH firewall (2.6.5) chef-sugar (>= 0.0.0) git (10.0.0) - golang (4.1.0) - ark (~> 5.0) + golang (5.3.1) + ark (>= 6.0) homebrew (3.0.0) hostname (0.4.2) hostsfile (>= 0.0.0) @@ -109,20 +109,20 @@ GRAPH apache2 (>= 0.0.0) nginx (>= 0.0.0) php (>= 0.0.0) - mingw (2.1.0) + mingw (2.1.3) seven_zip (>= 0.0.0) - mysql (8.7.3) + mysql (8.7.4) nginx (9.0.0) build-essential (>= 5.0) ohai (>= 4.1.0) yum-epel (>= 0.0.0) - nodejs (7.3.1) + nodejs (7.3.3) ark (>= 2.0.2) chocolatey (>= 3.0) ntp (3.4.0) ohai (5.2.5) openssl (8.5.5) - php (8.0.0) + php (8.0.1) yum-epel (>= 0.0.0) poise (2.8.2) poise-archive (1.5.0) @@ -155,13 +155,12 @@ GRAPH selinux_policy (>= 2.2.0) ulimit (>= 0.1.2) selinux_policy (2.4.3) - seven_zip (3.1.1) - windows (>= 0.0.0) + seven_zip (4.2.2) timezone_iii (1.0.4) ulimit (1.0.0) users (5.3.1) - windows (6.0.0) - yum (5.1.0) - yum-epel (3.3.0) + windows (7.0.2) + yum (7.2.0) + yum-epel (4.2.3) zerotier (1.0.7) ohai (>= 0.0.0) diff --git a/cookbooks/ark/CHANGELOG.md b/cookbooks/ark/CHANGELOG.md index 4e02c20..5513aa1 100644 --- a/cookbooks/ark/CHANGELOG.md +++ b/cookbooks/ark/CHANGELOG.md @@ -2,6 +2,40 @@ This file is used to list changes made in each version of the ark cookbook. +## 6.0.3 - *2021-08-30* + +- Standardise files with files in sous-chefs/repo-management + +## 6.0.2 - *2021-06-18* + +- Update location of test archive fixtures + +## 6.0.1 - *2021-06-01* + +- Standardise files with files in sous-chefs/repo-management + +## 6.0.0 - *2021-05-22* + +- Chef 17 updates: enable `unified_mode` on all resources +- Bump required Chef Infra Client to >= 15.3 +- Migrate to using `seven_zip_tool` resource directly and require `seven_zip` >= 3.1 +- Various ChefSpec fixes + +## 5.1.1 - *2021-04-29* + +- Added a version pin on seven_zip + +## 5.1.0 - *2021-01-24* + +- Sous Chefs Adoption +- Standardise files with files in sous-chefs/repo-management +- Cookstyle fixes +- Add integration testing for Windows and MacOS +- Remove testing for Amazon Linux 201x, CentOS 6 and Ubuntu 16.04 +- Fix ChefSpec tests +- Fix issues with `--strip-components` with the `:cherry_pick` action on MacOS +- Ensure `/etc/profile.d` exists on MacOS if `append_env_path` is used + ## 5.0.0 (2020-01-02) - Require Chef Infra Client 14+ and remove the need for the build_essential dependency - [@tas50](https://github.com/tas50) @@ -33,8 +67,9 @@ This file is used to list changes made in each version of the ark cookbook. - Rewrite of resource to custom resources. - Remove EOL platforms from testing. - Update zlib URL -- + ## 2.2.1 (2016-12-16) + - Use Ohai root_group attribute to avoid trying to set the group to root on BSD/macOS. - Add missing accessor for owner property diff --git a/cookbooks/ark/CONTRIBUTING.md b/cookbooks/ark/CONTRIBUTING.md deleted file mode 100644 index ef2f2b8..0000000 --- a/cookbooks/ark/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD diff --git a/cookbooks/ark/LICENSE b/cookbooks/ark/LICENSE new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/cookbooks/ark/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/cookbooks/ark/README.md b/cookbooks/ark/README.md index 35309a3..cda7620 100644 --- a/cookbooks/ark/README.md +++ b/cookbooks/ark/README.md @@ -1,6 +1,10 @@ # ark cookbook -[![Build Status](https://travis-ci.org/chef-cookbooks/ark.svg?branch=master)](https://travis-ci.org/chef-cookbooks/ark) [![Cookbook Version](https://img.shields.io/cookbook/v/ark.svg)](https://supermarket.chef.io/cookbooks/ark) +[![Cookbook Version](https://img.shields.io/cookbook/v/ark.svg)](https://supermarket.chef.io/cookbooks/ark) +[![CI State](https://github.com/sous-chefs/ark/workflows/ci/badge.svg)](https://github.com/sous-chefs/ark/actions?query=workflow%3Aci) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) ## Overview @@ -27,6 +31,10 @@ By default, the ark will not run again if the `:path` is not empty. Ark provides For remote files ark supports URLs using the [remote_file](http://docs.chef.io/resource_remote_file.html) resource. Local files are accessed with the `file://` syntax. +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). + ## Requirements ### Platforms @@ -269,29 +277,27 @@ You can also supply the file extension in case the file extension can not be det end ``` -## License & Authors +## Contributors -- Author: Philip (flip) Kromer - Infochimps, Inc([coders@infochimps.com](mailto:coders@infochimps.com)) -- Author: Bryan W. Berry ([bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)) -- Author: Denis Barishev ([denis.barishev@gmail.com](mailto:denis.barishev@gmail.com)) -- Author: Sean OMeara ([someara@chef.io](mailto:someara@chef.io)) -- Author: John Bellone ([jbellone@bloomberg.net](mailto:jbellone@bloomberg.net)) -- Copyright: 2011, Philip (flip) Kromer - Infochimps, Inc -- Copyright: 2012, Bryan W. Berry -- Copyright: 2012, Denis Barishev -- Copyright: 2013-2017, Chef Software, Inc -- Copyright: 2014, Bloomberg L.P. +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -``` -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +### Backers - http://www.apache.org/licenses/LICENSE-2.0 +Thank you to all our backers! -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) + +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/ark/attributes/default.rb b/cookbooks/ark/attributes/default.rb index 10b3e01..9804aa5 100644 --- a/cookbooks/ark/attributes/default.rb +++ b/cookbooks/ark/attributes/default.rb @@ -31,7 +31,7 @@ pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x') pkgs += %w(make) unless platform_family?('mac_os_x', 'freebsd') pkgs += %w(unzip rsync gcc) unless platform_family?('mac_os_x') pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse', 'amazon') -pkgs += %w(gtar) if platform?('freebsd') || platform?('smartos') +pkgs += %w(gtar) if platform?('freebsd', 'smartos') pkgs += %w(gmake) if platform?('freebsd') if platform_family?('rhel', 'suse', 'amazon') if node['platform_version'].to_i >= 7 diff --git a/cookbooks/ark/chefignore b/cookbooks/ark/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/cookbooks/ark/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/cookbooks/ark/kitchen.dokken.yml b/cookbooks/ark/kitchen.dokken.yml new file mode 100644 index 0000000..92656f1 --- /dev/null +++ b/cookbooks/ark/kitchen.dokken.yml @@ -0,0 +1,65 @@ +driver: + name: dokken + privileged: true # because Docker and SystemD + chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> + chef_license: accept-no-persist + +transport: + name: dokken + +provisioner: + name: dokken + +platforms: + - name: amazonlinux-2 + driver: + image: dokken/amazonlinux-2 + pid_one_command: /usr/lib/systemd/systemd + + - name: debian-9 + driver: + image: dokken/debian-9 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: debian-10 + driver: + image: dokken/debian-10 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: centos-7 + driver: + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-8 + driver: + image: dokken/centos-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: fedora-latest + driver: + image: dokken/fedora-latest + pid_one_command: /usr/lib/systemd/systemd + + - name: ubuntu-18.04 + driver: + image: dokken/ubuntu-18.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: ubuntu-20.04 + driver: + image: dokken/ubuntu-20.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: opensuse-leap-15 + driver: + image: dokken/opensuse-leap-15 + pid_one_command: /bin/systemd diff --git a/cookbooks/ark/kitchen.exec.yml b/cookbooks/ark/kitchen.exec.yml new file mode 100644 index 0000000..980f952 --- /dev/null +++ b/cookbooks/ark/kitchen.exec.yml @@ -0,0 +1,14 @@ +--- +driver: + name: exec + +transport: + name: exec + +provisioner: + name: chef_zero + deprecations_as_errors: true + +platforms: + - name: windows-latest + - name: macos-latest diff --git a/cookbooks/ark/libraries/resource_defaults.rb b/cookbooks/ark/libraries/resource_defaults.rb index 9b5ac76..a3ce9d9 100644 --- a/cookbooks/ark/libraries/resource_defaults.rb +++ b/cookbooks/ark/libraries/resource_defaults.rb @@ -104,7 +104,7 @@ module Ark def wmi_property_from_query(wmi_property, wmi_query) @wmi = ::WIN32OLE.connect('winmgmts://') result = @wmi.ExecQuery(wmi_query) - return nil unless result.each.count > 0 + return unless result.each.count > 0 result.each.next.send(wmi_property) end diff --git a/cookbooks/ark/libraries/sevenzip_command_builder.rb b/cookbooks/ark/libraries/sevenzip_command_builder.rb index 2482ac6..a1fe9da 100644 --- a/cookbooks/ark/libraries/sevenzip_command_builder.rb +++ b/cookbooks/ark/libraries/sevenzip_command_builder.rb @@ -42,7 +42,7 @@ module Ark end def sevenzip_binary - @tar_binary ||= "\"#{(node['ark']['sevenzip_binary'] || sevenzip_path_from_registry)}\"" + @tar_binary ||= "\"#{node['ark']['sevenzip_binary'] || sevenzip_path_from_registry}\"" end def sevenzip_path_from_registry diff --git a/cookbooks/ark/libraries/tar_command_builder.rb b/cookbooks/ark/libraries/tar_command_builder.rb index 291dbb9..19efa34 100644 --- a/cookbooks/ark/libraries/tar_command_builder.rb +++ b/cookbooks/ark/libraries/tar_command_builder.rb @@ -9,7 +9,7 @@ module Ark end def cherry_pick - "#{tar_binary} #{args} #{resource.release_file} -C #{resource.path} #{resource.creates}#{strip_args}" + "#{tar_binary} #{args} #{resource.release_file} -C #{resource.path}#{strip_args} #{resource.creates}" end def initialize(resource) diff --git a/cookbooks/ark/metadata.json b/cookbooks/ark/metadata.json index cdbcc1c..57b8645 100644 --- a/cookbooks/ark/metadata.json +++ b/cookbooks/ark/metadata.json @@ -1 +1,49 @@ -{"name":"ark","version":"5.0.0","description":"Provides a custom resource for installing runtime artifacts in a predictable fashion","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","windows":">= 0.0.0","mac_os_x":">= 0.0.0","smartos":">= 0.0.0","freebsd":">= 0.0.0"},"dependencies":{"seven_zip":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/ark","issues_url":"https://github.com/chef-cookbooks/ark/issues","chef_version":[[">= 14.0"]],"ohai_version":[]} \ No newline at end of file +{ + "name": "ark", + "description": "Provides a custom resource for installing runtime artifacts in a predictable fashion", + "long_description": "", + "maintainer": "Sous Chefs", + "maintainer_email": "help@sous-chefs.org", + "license": "Apache-2.0", + "platforms": { + "amazon": ">= 0.0.0", + "centos": ">= 0.0.0", + "debian": ">= 0.0.0", + "freebsd": ">= 0.0.0", + "mac_os_x": ">= 0.0.0", + "opensuse": ">= 0.0.0", + "opensuseleap": ">= 0.0.0", + "oracle": ">= 0.0.0", + "redhat": ">= 0.0.0", + "scientific": ">= 0.0.0", + "smartos": ">= 0.0.0", + "suse": ">= 0.0.0", + "ubuntu": ">= 0.0.0", + "windows": ">= 0.0.0" + }, + "dependencies": { + "seven_zip": ">= 3.1" + }, + "providing": { + + }, + "recipes": { + + }, + "version": "6.0.3", + "source_url": "https://github.com/sous-chefs/ark", + "issues_url": "https://github.com/sous-chefs/ark/issues", + "privacy": false, + "chef_versions": [ + [ + ">= 15.3" + ] + ], + "ohai_versions": [ + + ], + "gems": [ + + ], + "eager_load_libraries": true +} diff --git a/cookbooks/ark/metadata.rb b/cookbooks/ark/metadata.rb index 1f4bb50..3349b01 100644 --- a/cookbooks/ark/metadata.rb +++ b/cookbooks/ark/metadata.rb @@ -1,16 +1,26 @@ -name 'ark' -maintainer 'Chef Software, Inc.' -maintainer_email 'cookbooks@chef.io' -license 'Apache-2.0' -description 'Provides a custom resource for installing runtime artifacts in a predictable fashion' -version '5.0.0' +name 'ark' +maintainer 'Sous Chefs' +maintainer_email 'help@sous-chefs.org' +license 'Apache-2.0' +description 'Provides a custom resource for installing runtime artifacts in a predictable fashion' +version '6.0.3' +source_url 'https://github.com/sous-chefs/ark' +issues_url 'https://github.com/sous-chefs/ark/issues' +chef_version '>= 15.3' -%w(ubuntu debian redhat centos suse opensuse opensuseleap scientific oracle amazon windows mac_os_x smartos freebsd).each do |os| - supports os -end +supports 'amazon' +supports 'centos' +supports 'debian' +supports 'freebsd' +supports 'mac_os_x' +supports 'opensuse' +supports 'opensuseleap' +supports 'oracle' +supports 'redhat' +supports 'scientific' +supports 'smartos' +supports 'suse' +supports 'ubuntu' +supports 'windows' -depends 'seven_zip' # for windows os - -source_url 'https://github.com/chef-cookbooks/ark' -issues_url 'https://github.com/chef-cookbooks/ark/issues' -chef_version '>= 14.0' +depends 'seven_zip', '>= 3.1' # for windows os diff --git a/cookbooks/ark/recipes/default.rb b/cookbooks/ark/recipes/default.rb index cd3d43a..6a39413 100644 --- a/cookbooks/ark/recipes/default.rb +++ b/cookbooks/ark/recipes/default.rb @@ -20,4 +20,4 @@ package node['ark']['package_dependencies'] unless platform_family?('windows', 'mac_os_x') -include_recipe 'seven_zip' if platform_family?('windows') +seven_zip_tool 'ark' if platform_family?('windows') diff --git a/cookbooks/ark/resources/default.rb b/cookbooks/ark/resources/default.rb index 1551df2..262a535 100644 --- a/cookbooks/ark/resources/default.rb +++ b/cookbooks/ark/resources/default.rb @@ -25,7 +25,7 @@ property :url, String, required: true property :path, String property :full_path, String property :append_env_path, [true, false], default: false -property :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil +property :checksum, String, regex: /^[a-zA-Z0-9]{64}$/ property :has_binaries, Array, default: [] property :creates, String property :release_file, String, default: '' @@ -46,6 +46,8 @@ property :autoconf_opts, Array, default: [] property :extension, String property :backup, [FalseClass, Integer], default: 5 +unified_mode true + ################# # action :install ################# @@ -105,6 +107,9 @@ action :install do to new_resource.path end + # This directory doesn't exist by default on MacOS + directory '/etc/profile.d' if platform_family?('mac_os_x') + # Add to path for interactive bash sessions template "/etc/profile.d/#{new_resource.name}.sh" do cookbook 'ark' diff --git a/cookbooks/golang/CHANGELOG.md b/cookbooks/golang/CHANGELOG.md index 0313261..97d8220 100644 --- a/cookbooks/golang/CHANGELOG.md +++ b/cookbooks/golang/CHANGELOG.md @@ -2,6 +2,36 @@ This file is used to list changes made in each version of golang. +## 5.3.1 - *2021-08-30* + +- Standardise files with files in sous-chefs/repo-management + +## 5.3.0 - *2021-07-15* + +- Fix `unified_mode` declaration +- Bump `ark` dependency to one with `unified_mode` set + +## 5.2.0 - *2021-06-04* + +- Update example package to adhere with modern Go standards + +## 5.1.0 - *2021-06-03* + +- Fix resource to use the correct path in GOPATH profile.d template + +## 5.0.1 - *2021-06-01* + +- Standardise files with files in sous-chefs/repo-management + +## 5.0.0 - *2021-05-21* + +- Require chef 15.3 or greater +- Use unified_mode for chef 17 support + +## 4.1.1 - *2021-02-03* + +- Use `node['golang']['scm']` and `node['golang']['scm_packages']` attributes in default recipe. + ## 4.1.0 - Create a custom resource to install Go from source or by downloading a package diff --git a/cookbooks/golang/CONTRIBUTING.md b/cookbooks/golang/CONTRIBUTING.md deleted file mode 100644 index a946aea..0000000 --- a/cookbooks/golang/CONTRIBUTING.md +++ /dev/null @@ -1,4 +0,0 @@ -# Contributing - -Please refer to -[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) diff --git a/cookbooks/golang/LICENSE b/cookbooks/golang/LICENSE new file mode 100644 index 0000000..1b22bef --- /dev/null +++ b/cookbooks/golang/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/cookbooks/golang/chefignore b/cookbooks/golang/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/cookbooks/golang/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/cookbooks/golang/kitchen.dokken.yml b/cookbooks/golang/kitchen.dokken.yml new file mode 100644 index 0000000..0d0f144 --- /dev/null +++ b/cookbooks/golang/kitchen.dokken.yml @@ -0,0 +1,55 @@ +--- +driver: + name: dokken + privileged: true + +transport: + name: dokken + +provisioner: + name: dokken + product_name: chef + product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> + chef_license: accept-no-persist + install_strategy: once + +platforms: + - name: debian-9 + driver: + image: dokken/debian-9 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: debian-10 + driver: + image: dokken/debian-10 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: centos-7 + driver: + image: dokken/centos-7 + platform: rhel + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-8 + driver: + image: dokken/centos-8 + platform: rhel + pid_one_command: /usr/lib/systemd/systemd + + - name: ubuntu-18.04 + driver: + image: dokken/ubuntu-18.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + + - name: ubuntu-20.04 + driver: + image: dokken/ubuntu-18.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update diff --git a/cookbooks/golang/metadata.json b/cookbooks/golang/metadata.json index 2c1c376..81185e6 100644 --- a/cookbooks/golang/metadata.json +++ b/cookbooks/golang/metadata.json @@ -1 +1,43 @@ -{"name":"golang","version":"4.1.0","description":"Installs go programming language","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","fedora":">= 0.0.0","amazon":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0"},"dependencies":{"ark":"~> 5.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/golang","issues_url":"https://github.com/sous-chefs/golang/issues","chef_version":[[">= 14.0"]],"ohai_version":[]} \ No newline at end of file +{ + "name": "golang", + "description": "Installs go programming language", + "long_description": "", + "maintainer": "Sous Chefs", + "maintainer_email": "help@sous-chefs.org", + "license": "Apache-2.0", + "platforms": { + "debian": ">= 0.0.0", + "ubuntu": ">= 0.0.0", + "redhat": ">= 0.0.0", + "centos": ">= 0.0.0", + "fedora": ">= 0.0.0", + "amazon": ">= 0.0.0", + "scientific": ">= 0.0.0", + "oracle": ">= 0.0.0" + }, + "dependencies": { + "ark": ">= 6.0" + }, + "providing": { + + }, + "recipes": { + + }, + "version": "5.3.1", + "source_url": "https://github.com/sous-chefs/golang", + "issues_url": "https://github.com/sous-chefs/golang/issues", + "privacy": false, + "chef_versions": [ + [ + ">= 15.3" + ] + ], + "ohai_versions": [ + + ], + "gems": [ + + ], + "eager_load_libraries": true +} diff --git a/cookbooks/golang/metadata.rb b/cookbooks/golang/metadata.rb index 81e6bbb..5021107 100644 --- a/cookbooks/golang/metadata.rb +++ b/cookbooks/golang/metadata.rb @@ -5,8 +5,8 @@ license 'Apache-2.0' description 'Installs go programming language' source_url 'https://github.com/sous-chefs/golang' issues_url 'https://github.com/sous-chefs/golang/issues' -chef_version '>= 14.0' -version '4.1.0' +chef_version '>= 15.3' +version '5.3.1' supports 'debian' supports 'ubuntu' @@ -17,4 +17,4 @@ supports 'amazon' supports 'scientific' supports 'oracle' -depends 'ark', '~> 5.0' +depends 'ark', '>= 6.0' diff --git a/cookbooks/golang/recipes/default.rb b/cookbooks/golang/recipes/default.rb index 91cec2d..3fd64cc 100644 --- a/cookbooks/golang/recipes/default.rb +++ b/cookbooks/golang/recipes/default.rb @@ -2,7 +2,7 @@ # Cookbook:: golang # Recipe:: default # -# Copyright:: 2013, Alexander Rozhnov +# Copyright:: 2013-2021, Alexander Rozhnov # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -21,6 +21,8 @@ golang 'Install go' do from_source node['golang']['from_source'] version node['golang']['version'] if node['golang']['version'] # go version source_version node['golang']['source_version'] if node['golang']['source_version'] # go version from source + scm node['golang']['scm'] + scm_packages node['golang']['scm_packages'] owner node['golang']['owner'] if node['golang']['owner'] group node['golang']['group'] if node['golang']['group'] end diff --git a/cookbooks/golang/resources/default.rb b/cookbooks/golang/resources/default.rb index 64c4d77..f3ad66d 100644 --- a/cookbooks/golang/resources/default.rb +++ b/cookbooks/golang/resources/default.rb @@ -2,7 +2,7 @@ # Cookbook:: golang # Resource:: default # -# Copyright:: 2020, Sous-chefs +# Copyright:: 2020-2021, Sous-chefs # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -17,6 +17,8 @@ # under the License. # +unified_mode true + # Install golang by compiling from source property :from_source, [true, false], default: false @@ -99,7 +101,7 @@ action :install do source 'golang.sh.erb' mode new_resource.directory_mode variables gobin: new_resource.gobin, - gopath: new_resource.gobin, + gopath: new_resource.gopath, install_dir: new_resource.install_dir end diff --git a/cookbooks/golang/resources/package.rb b/cookbooks/golang/resources/package.rb index 4090444..8ef4e71 100644 --- a/cookbooks/golang/resources/package.rb +++ b/cookbooks/golang/resources/package.rb @@ -2,6 +2,22 @@ # Cookbook:: golang # Resource:: default # +# Copyright:: 2020-2021, Sous-chefs +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +unified_mode true default_action :install diff --git a/cookbooks/mingw/CHANGELOG.md b/cookbooks/mingw/CHANGELOG.md index a1671ec..7235bbc 100644 --- a/cookbooks/mingw/CHANGELOG.md +++ b/cookbooks/mingw/CHANGELOG.md @@ -2,6 +2,19 @@ This file is used to list changes made in each version of the mingw cookbook. +## 2.1.3 - *2021-08-31* + +- Standardise files with files in sous-chefs/repo-management + +## 2.1.1 (2020-06-02) + +- Resolve cookstyle 5.8 warnings - [@tas50](https://github.com/tas50) +- Require Chef 12.15+ - [@tas50](https://github.com/tas50) +- Fix compatibility with Chef Infra Client 16 - [@xorimabot](https://github.com/xorimabot) + - resolved cookstyle error: resources/get.rb:26:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/msys2_package.rb:31:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + - resolved cookstyle error: resources/tdm_gcc.rb:26:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName` + ## 2.1.0 (2018-07-24) - refactor msys2 package source and checksum to attributes diff --git a/cookbooks/mingw/CONTRIBUTING.md b/cookbooks/mingw/CONTRIBUTING.md deleted file mode 100644 index ef2f2b8..0000000 --- a/cookbooks/mingw/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD diff --git a/cookbooks/mingw/LICENSE b/cookbooks/mingw/LICENSE new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/cookbooks/mingw/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/cookbooks/mingw/README.md b/cookbooks/mingw/README.md index 16da102..477040c 100644 --- a/cookbooks/mingw/README.md +++ b/cookbooks/mingw/README.md @@ -12,7 +12,7 @@ Installs a mingw/msys based compiler tools chain on windows. This is required fo ### Chef -- Chef 12.5+ +- Chef 12.15+ ### Cookbooks diff --git a/cookbooks/mingw/chefignore b/cookbooks/mingw/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/cookbooks/mingw/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/cookbooks/mingw/libraries/_helper.rb b/cookbooks/mingw/libraries/_helper.rb index 4a90fa4..662faa2 100644 --- a/cookbooks/mingw/libraries/_helper.rb +++ b/cookbooks/mingw/libraries/_helper.rb @@ -2,7 +2,7 @@ # Cookbook:: mingw # Library:: _helper # -# Copyright:: 2016, Chef Software, Inc. +# Copyright:: 2016-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,4 +35,4 @@ module Mingw end end -Chef::Resource.send(:include, Mingw::Helper) +Chef::Resource.include Mingw::Helper diff --git a/cookbooks/mingw/metadata.json b/cookbooks/mingw/metadata.json index b2cccf0..0d39c3b 100644 --- a/cookbooks/mingw/metadata.json +++ b/cookbooks/mingw/metadata.json @@ -1 +1,36 @@ -{"name":"mingw","version":"2.1.0","description":"Installs a mingw/msys based toolchain on windows","long_description":"# mingw Cookbook\n\n[![Cookbook Version](http://img.shields.io/cookbook/v/mingw.svg)][cookbook] [![Build Status](http://img.shields.io/travis/chef-cookbooks/mingw.svg?branch=master)][travis]\n\nInstalls a mingw/msys based compiler tools chain on windows. This is required for compiling C software from source.\n\n## Requirements\n\n### Platforms\n\n- Windows\n\n### Chef\n\n- Chef 12.5+\n\n### Cookbooks\n\n- seven_zip\n\n## Usage\n\nAdd this cookbook as a dependency to your cookbook in its `metadata.rb` and include the default recipe in one of your recipes.\n\n```ruby\n# metadata.rb\ndepends 'mingw'\n```\n\n```ruby\n# your recipe.rb\ninclude_recipe 'mingw::default'\n```\n\nUse the `msys2_package` resource in any recipe to fetch msys2 based packages. Use the `mingw_get` resource in any recipe to fetch mingw packages. Use the `mingw_tdm_gcc` resource to fetch a version of the TDM GCC compiler.\n\nBy default, you should prefer the msys2 packages as they are newer and better supported. C/C++ compilers on windows use various different exception formats and you need to pick the right one for your task. In the 32-bit world, you have SJLJ (set-jump/long-jump) based exception handling and DWARF-2 (shortened to DW2) based exception handling. SJLJ produces code that can happily throw exceptions across stack frames of code compiled by MSVC. DW2 involves more extensive metadata but produces code that cannot unwind MSVC generated stack-frames - hence you need to ensure that you don't have any code that throws across a \"system call\". Certain languages and runtimes have specific requirements as to the exception format supported. As an example, if you are building code for Rust, you will probably need a modern gcc from msys2 with DW2 support as that's what the panic/exception formatter in Rust depends on. In a 64-bit world, you may still use SJLJ but compilers all commonly support SEH (structured exception handling).\n\nOf course, to further complicate matters, different versions of different compilers support different exception handling. The default compilers that come with mingw_get are 32-bit only compilers and support DW2\\. The TDM compilers come in 3 flavors: a 32-bit only version with SJLJ support, a 32-bit only version with DW2 support and a \"multilib\" compiler which supports only SJLJ in 32-bit mode but can produce 64-bit SEH code. The standard library support varies drastically between these various compiler flavors (even within the same version). In msys2, you can install a mingw-w64 based compilers for either 32-bit DW2 support or 64-bit SEH support. If all this hurts your brain, I can only apologize.\n\n## Resources\n\n### msys2_package\n\n- ':install' - Installs an msys2 package using pacman.\n- ':remove' - Uninstalls any existing msys2 package.\n- ':upgrade' - Upgrades the specified package using pacman.\n\nAll options also automatically attempt to install a 64-bit based msys2 base file system at the root path specified. Note that you probably won't need a \"32-bit\" msys2 unless you are actually on a 32-bit only platform. You can still install both 32 and 64-bit compilers and libraries in a 64-bit msys2 base file system.\n\n#### Attributes\n\n- `node['msys2']['url']` - overrides the url from which to download the package.\n- `node['msys2']['checksum']` - overrides the checksum used to verify the downloaded package.\n\n#### Parameters\n\n- `package` - An msys2 pacman package (or meta-package) to fetch and install. You may use a legal package wild-card pattern here if you are installing. This is the name attribute.\n- `root` - The root directory where msys2 tools will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.\n\n#### Examples\n\nTo get the core msys2 developer tools in `C:\\msys2`\n\n```ruby\nmsys2_package 'base-devel' do\n root 'C:\\msys2'\nend\n```\n\n### mingw_get\n\n#### Actions\n\n- `:install` - Installs a mingw package from sourceforge using mingw-get.exe.\n- `:remove` - Uninstalls a mingw package.\n- `:upgrade` - Upgrades a mingw package (even to a lower version).\n\n#### Parameters\n\n- `package` - A mingw-get package (or meta-package) to fetch and install. You may use a legal package wild-card pattern here if you are installing. This is the name attribute.\n- `root` - The root directory where msys and mingw tools will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.\n\n#### Examples\n\nTo get the core msys developer tools in `C:\\mingw32`\n\n```ruby\nmingw_get 'msys-base=2013072300-msys-bin.meta' do\n root 'C:\\mingw32'\nend\n```\n\n### mingw_tdm_gcc\n\n#### Actions\n\n- `:install` - Installs the TDM compiler toolchain at the given path. This only gives you a compiler. If you need any support tooling such as make/grep/awk/bash etc., see `mingw_get`.\n\n#### Parameters\n\n- `flavor` - Either `:sjlj_32` or `:seh_sjlj_64`. TDM-64 is a 32/64-bit multi-lib \"cross-compiler\" toolchain that builds 64-bit by default. It uses structured exception handling (SEH) in 64-bit code and setjump-longjump exception handling (SJLJ) in 32-bit code. TDM-32 only builds 32-bit binaries and uses SJLJ.\n- `root` - The root directory where compiler tools and runtime will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.\n- `version` - The version of the compiler to fetch and install. This is the name attribute. Currently, '5.1.0' is supported.\n\n#### Examples\n\nTo get the 32-bit TDM GCC compiler in `C:\\mingw32`\n\n```ruby\nmingw_tdm_gcc '5.1.0' do\n flavor :sjlj_32\n root 'C:\\mingw32'\nend\n```\n\n## License & Authors\n\n**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))\n\n**Copyright:** 2009-2016, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[cookbook]: https://supermarket.chef.io/cookbooks/mingw\n[travis]: http://travis-ci.org/chef-cookbooks/mingw\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"windows":">= 0.0.0"},"dependencies":{"seven_zip":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/mingw","issues_url":"https://github.com/chef-cookbooks/mingw/issues","chef_version":[[">= 12.5"]],"ohai_version":[]} \ No newline at end of file +{ + "name": "mingw", + "description": "Installs a mingw/msys based toolchain on windows", + "long_description": "", + "maintainer": "Chef Software, Inc.", + "maintainer_email": "cookbooks@chef.io", + "license": "Apache-2.0", + "platforms": { + "windows": ">= 0.0.0" + }, + "dependencies": { + "seven_zip": ">= 0.0.0" + }, + "providing": { + + }, + "recipes": { + + }, + "version": "2.1.3", + "source_url": "https://github.com/chef-cookbooks/mingw", + "issues_url": "https://github.com/chef-cookbooks/mingw/issues", + "privacy": false, + "chef_versions": [ + [ + ">= 12.15" + ] + ], + "ohai_versions": [ + + ], + "gems": [ + + ], + "eager_load_libraries": true +} diff --git a/cookbooks/mingw/metadata.rb b/cookbooks/mingw/metadata.rb new file mode 100644 index 0000000..4df13cd --- /dev/null +++ b/cookbooks/mingw/metadata.rb @@ -0,0 +1,14 @@ +name 'mingw' +maintainer 'Chef Software, Inc.' +maintainer_email 'cookbooks@chef.io' +license 'Apache-2.0' +description 'Installs a mingw/msys based toolchain on windows' +version '2.1.3' + +supports 'windows' + +depends 'seven_zip' + +source_url 'https://github.com/chef-cookbooks/mingw' +issues_url 'https://github.com/chef-cookbooks/mingw/issues' +chef_version '>= 12.15' diff --git a/cookbooks/mingw/recipes/default.rb b/cookbooks/mingw/recipes/default.rb index 33426f0..a766653 100644 --- a/cookbooks/mingw/recipes/default.rb +++ b/cookbooks/mingw/recipes/default.rb @@ -2,7 +2,7 @@ # Cookbook:: mingw # Recipe:: default # -# Copyright:: 2016, Chef Software, Inc. +# Copyright:: 2016-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/mingw/resources/get.rb b/cookbooks/mingw/resources/get.rb index bd77efe..a102b0e 100644 --- a/cookbooks/mingw/resources/get.rb +++ b/cookbooks/mingw/resources/get.rb @@ -2,7 +2,7 @@ # Cookbook:: mingw # Resource:: get # -# Copyright:: 2016, Chef Software, Inc. +# Copyright:: 2016-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ property :package, String, name_property: true property :root, String, required: true -resource_name :mingw_get - action_class do def mingw_do_action(action_cmd) seven_zip_archive "fetching mingw-get to #{win_friendly_path(root)}" do diff --git a/cookbooks/mingw/resources/msys2_package.rb b/cookbooks/mingw/resources/msys2_package.rb index ddad055..f4a5c0b 100644 --- a/cookbooks/mingw/resources/msys2_package.rb +++ b/cookbooks/mingw/resources/msys2_package.rb @@ -2,7 +2,7 @@ # Cookbook:: mingw # Resource:: msys2_package # -# Copyright:: 2016, Chef Software, Inc. +# Copyright:: 2016-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,16 +19,16 @@ # Installs msys2 base system and installs/upgrades packages within in. # -# Where's the version flag? Where's idempotence you say? Well f*** you -# for trying to version your product. This is arch. They live on the edge. -# You never get anything but the latest version. And if that's broken... -# well that's your problem isn't it? And they don't believe in preserving -# older versions. Good luck! +# Where's the version flag? Where's idempotence you say? Well f*** you +# for trying to version your product. This is arch. They live on the edge. +# You never get anything but the latest version. And if that's broken... +# well that's your problem isn't it? And they don't believe in preserving +# older versions. Good luck! property :package, String, name_property: true property :root, String, required: true -resource_name :msys2_package +provides :msys2_package action_class do # @@ -97,7 +97,7 @@ action_class do cookbook 'mingw' end - # $HOME is using files from /etc/skel. The home-directory creation step + # $HOME is using files from /etc/skel. The home-directory creation step # will automatically be performed if other users log in - so if you wish # to globally modify user first time setup, edit /etc/skel or add # "post-setup" steps to /etc/post-install/ @@ -125,10 +125,10 @@ action :install do msys2_do_action("installing #{package}", "pacman -S --needed --noconfirm #{package}") end -# Package name is ignored. This is arch. Why would you ever upgrade a single -# package and its deps? That'll just break everything else that ever depended -# on a different version of that dep. Because arch is wonderful like that. -# So you only get the choice to move everything to latest or not... it's the +# Package name is ignored. This is arch. Why would you ever upgrade a single +# package and its deps? That'll just break everything else that ever depended +# on a different version of that dep. Because arch is wonderful like that. +# So you only get the choice to move everything to latest or not... it's the # most agile development possible! action :upgrade do msys2_do_action("upgrading #{package}", "pacman -Syu --noconfirm #{package}") diff --git a/cookbooks/mingw/resources/tdm_gcc.rb b/cookbooks/mingw/resources/tdm_gcc.rb index 085eee3..c30a70c 100644 --- a/cookbooks/mingw/resources/tdm_gcc.rb +++ b/cookbooks/mingw/resources/tdm_gcc.rb @@ -2,7 +2,7 @@ # Cookbook:: mingw # Resource:: tdm_gcc # -# Copyright:: 2016, Chef Software, Inc. +# Copyright:: 2016-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ property :flavor, Symbol, is: [:sjlj_32, :seh_sjlj_64], default: :seh_sjlj_64 property :root, String, required: true property :version, String, is: ['5.1.0'], name_property: true -resource_name :mingw_tdm_gcc - tdm_gcc_64 = { 'http://iweb.dl.sourceforge.net/project/tdm-gcc/TDM-GCC%205%20series/5.1.0-tdm64-1/gcc-5.1.0-tdm64-1-core.tar.lzma' => '29393aac890847089ad1e93f81a28f6744b1609c00b25afca818f3903e42e4bd', diff --git a/cookbooks/mysql/CHANGELOG.md b/cookbooks/mysql/CHANGELOG.md index 2296313..8c7c3b6 100644 --- a/cookbooks/mysql/CHANGELOG.md +++ b/cookbooks/mysql/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## 8.7.4 - 2020-09-16 + +- resolved cookstyle error: spec/mysql_client_installation_package_spec.rb:4:48 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` +- resolved cookstyle error: spec/mysql_server_installation_package_spec.rb:4:48 warning: `ChefDeprecations/DeprecatedChefSpecPlatform` +- Use mysql_test cookbook attributes for testing +- Cookstyle Bot Auto Corrections with Cookstyle 6.17.6 + ## 8.7.3 - 2020-07-22 - restore resource_name in mysql_service for Chef Infra Client < 16 diff --git a/cookbooks/mysql/libraries/helpers.rb b/cookbooks/mysql/libraries/helpers.rb index ac2340b..61435fc 100644 --- a/cookbooks/mysql/libraries/helpers.rb +++ b/cookbooks/mysql/libraries/helpers.rb @@ -3,48 +3,48 @@ module MysqlCookbook require 'shellwords' def el6? - return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 6 + return true if platform_family?('rhel') && node['platform_version'].to_i == 6 false end def el7? - return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7 + return true if platform_family?('rhel') && node['platform_version'].to_i == 7 false end def fedora? - return true if node['platform_family'] == 'fedora' + return true if platform_family?('fedora') false end def suse? - return true if node['platform_family'] == 'suse' + return true if platform_family?('suse') false end def jessie? - return true if node['platform'] == 'debian' && node['platform_version'].to_i == 8 + return true if platform?('debian') && node['platform_version'].to_i == 8 false end def stretch? - return true if node['platform'] == 'debian' && node['platform_version'].to_i == 9 + return true if platform?('debian') && node['platform_version'].to_i == 9 false end def trusty? - return true if node['platform'] == 'ubuntu' && node['platform_version'] == '14.04' - return true if node['platform'] == 'linuxmint' && node['platform_version'] =~ /^17\.[0-9]$/ + return true if platform?('ubuntu') && node['platform_version'] == '14.04' + return true if platform?('linuxmint') && node['platform_version'] =~ /^17\.[0-9]$/ false end def xenial? - return true if node['platform'] == 'ubuntu' && node['platform_version'] == '16.04' + return true if platform?('ubuntu') && node['platform_version'] == '16.04' false end def bionic? - return true if node['platform'] == 'ubuntu' && node['platform_version'] == '18.04' + return true if platform?('ubuntu') && node['platform_version'] == '18.04' false end @@ -70,7 +70,7 @@ module MysqlCookbook # rhelish return '5.6' if el6? return '5.6' if el7? - return '5.6' if node['platform'] == 'amazon' + return '5.6' if platform?('amazon') # debian return '5.5' if jessie? @@ -81,7 +81,7 @@ module MysqlCookbook return '5.7' if bionic? # misc - return '5.6' if node['platform'] == 'freebsd' + return '5.6' if platform?('freebsd') return '5.7' if fedora? return '5.6' if suse? end @@ -105,25 +105,25 @@ module MysqlCookbook def default_client_package_name return %w(mysql mysql-devel) if major_version == '5.1' && el6? return %w(mysql mysql-devel) if el7? - return ['mysql55', 'mysql55-devel.x86_64'] if major_version == '5.5' && node['platform'] == 'amazon' - return ['mysql56', 'mysql56-devel.x86_64'] if major_version == '5.6' && node['platform'] == 'amazon' - return ['mysql57', 'mysql57-devel.x86_64'] if major_version == '5.7' && node['platform'] == 'amazon' - return ['mysql-client-5.5', 'libmysqlclient-dev'] if major_version == '5.5' && node['platform_family'] == 'debian' - return ['mysql-client-5.6', 'libmysqlclient-dev'] if major_version == '5.6' && node['platform_family'] == 'debian' - return ['mysql-client-5.7', 'libmysqlclient-dev'] if major_version == '5.7' && node['platform_family'] == 'debian' - return 'mysql-community-server-client' if major_version == '5.6' && node['platform_family'] == 'suse' + return ['mysql55', 'mysql55-devel.x86_64'] if major_version == '5.5' && platform?('amazon') + return ['mysql56', 'mysql56-devel.x86_64'] if major_version == '5.6' && platform?('amazon') + return ['mysql57', 'mysql57-devel.x86_64'] if major_version == '5.7' && platform?('amazon') + return ['mysql-client-5.5', 'libmysqlclient-dev'] if major_version == '5.5' && platform_family?('debian') + return ['mysql-client-5.6', 'libmysqlclient-dev'] if major_version == '5.6' && platform_family?('debian') + return ['mysql-client-5.7', 'libmysqlclient-dev'] if major_version == '5.7' && platform_family?('debian') + return 'mysql-community-server-client' if major_version == '5.6' && platform_family?('suse') %w(mysql-community-client mysql-community-devel) end def default_server_package_name return 'mysql-server' if major_version == '5.1' && el6? - return 'mysql55-server' if major_version == '5.5' && node['platform'] == 'amazon' - return 'mysql56-server' if major_version == '5.6' && node['platform'] == 'amazon' - return 'mysql57-server' if major_version == '5.7' && node['platform'] == 'amazon' - return 'mysql-server-5.5' if major_version == '5.5' && node['platform_family'] == 'debian' - return 'mysql-server-5.6' if major_version == '5.6' && node['platform_family'] == 'debian' - return 'mysql-server-5.7' if major_version == '5.7' && node['platform_family'] == 'debian' - return 'mysql-community-server' if major_version == '5.6' && node['platform_family'] == 'suse' + return 'mysql55-server' if major_version == '5.5' && platform?('amazon') + return 'mysql56-server' if major_version == '5.6' && platform?('amazon') + return 'mysql57-server' if major_version == '5.7' && platform?('amazon') + return 'mysql-server-5.5' if major_version == '5.5' && platform_family?('debian') + return 'mysql-server-5.6' if major_version == '5.6' && platform_family?('debian') + return 'mysql-server-5.7' if major_version == '5.7' && platform_family?('debian') + return 'mysql-community-server' if major_version == '5.6' && platform_family?('suse') 'mysql-community-server' end @@ -132,33 +132,33 @@ module MysqlCookbook end def run_dir - return "#{prefix_dir}/var/run/#{mysql_name}" if node['platform_family'] == 'rhel' - return "/run/#{mysql_name}" if node['platform_family'] == 'debian' + return "#{prefix_dir}/var/run/#{mysql_name}" if platform_family?('rhel') + return "/run/#{mysql_name}" if platform_family?('debian') "/var/run/#{mysql_name}" end def prefix_dir - return "/opt/mysql#{pkg_ver_string}" if node['platform_family'] == 'omnios' - return '/opt/local' if node['platform_family'] == 'smartos' + return "/opt/mysql#{pkg_ver_string}" if platform_family?('omnios') + return '/opt/local' if platform_family?('smartos') return "/opt/rh/#{scl_name}/root" if scl_package? end def scl_name - return unless node['platform_family'] == 'rhel' + return unless platform_family?('rhel') return 'mysql51' if version == '5.1' && node['platform_version'].to_i == 5 return 'mysql55' if version == '5.5' && node['platform_version'].to_i == 5 end def scl_package? - return unless node['platform_family'] == 'rhel' + return unless platform_family?('rhel') return true if version == '5.1' && node['platform_version'].to_i == 5 return true if version == '5.5' && node['platform_version'].to_i == 5 false end def etc_dir - return "/opt/mysql#{pkg_ver_string}/etc/#{mysql_name}" if node['platform_family'] == 'omnios' - return "#{prefix_dir}/etc/#{mysql_name}" if node['platform_family'] == 'smartos' + return "/opt/mysql#{pkg_ver_string}/etc/#{mysql_name}" if platform_family?('omnios') + return "#{prefix_dir}/etc/#{mysql_name}" if platform_family?('smartos') "#{prefix_dir}/etc/#{mysql_name}" end @@ -167,10 +167,10 @@ module MysqlCookbook end def system_service_name - return 'mysql51-mysqld' if node['platform_family'] == 'rhel' && scl_name == 'mysql51' - return 'mysql55-mysqld' if node['platform_family'] == 'rhel' && scl_name == 'mysql55' - return 'mysqld' if node['platform_family'] == 'rhel' - return 'mysqld' if node['platform_family'] == 'fedora' + return 'mysql51-mysqld' if platform_family?('rhel') && scl_name == 'mysql51' + return 'mysql55-mysqld' if platform_family?('rhel') && scl_name == 'mysql55' + return 'mysqld' if platform_family?('rhel') + return 'mysqld' if platform_family?('fedora') 'mysql' # not one of the above end @@ -191,7 +191,7 @@ module MysqlCookbook end def log_dir - return "/var/adm/log/#{mysql_name}" if node['platform_family'] == 'omnios' + return "/var/adm/log/#{mysql_name}" if platform_family?('omnios') "#{prefix_dir}/var/log/#{mysql_name}" end @@ -258,8 +258,8 @@ EOSQL end def mysql_install_db_bin - return "#{base_dir}/scripts/mysql_install_db" if node['platform_family'] == 'omnios' - return "#{prefix_dir}/bin/mysql_install_db" if node['platform_family'] == 'smartos' + return "#{base_dir}/scripts/mysql_install_db" if platform_family?('omnios') + return "#{prefix_dir}/bin/mysql_install_db" if platform_family?('smartos') 'mysql_install_db' end @@ -273,14 +273,14 @@ EOSQL end def mysqladmin_bin - return "#{prefix_dir}/bin/mysqladmin" if node['platform_family'] == 'smartos' + return "#{prefix_dir}/bin/mysqladmin" if platform_family?('smartos') return 'mysqladmin' if scl_package? "#{prefix_dir}/usr/bin/mysqladmin" end def mysqld_bin - return "#{prefix_dir}/libexec/mysqld" if node['platform_family'] == 'smartos' - return "#{base_dir}/bin/mysqld" if node['platform_family'] == 'omnios' + return "#{prefix_dir}/libexec/mysqld" if platform_family?('smartos') + return "#{base_dir}/bin/mysqld" if platform_family?('omnios') return '/usr/sbin/mysqld' if fedora? && v56plus return '/usr/libexec/mysqld' if fedora? return 'mysqld' if scl_package? @@ -289,14 +289,14 @@ EOSQL def mysql_systemd_start_pre return '/usr/bin/mysqld_pre_systemd' if v57plus && (el7? || fedora?) - return '/usr/bin/mysql-systemd-start pre' if node['platform_family'] == 'rhel' + return '/usr/bin/mysql-systemd-start pre' if platform_family?('rhel') return '/usr/lib/mysql/mysql-systemd-helper install' if suse? '/usr/share/mysql/mysql-systemd-start pre' end def mysql_systemd return "/usr/libexec/#{mysql_name}-wait-ready $MAINPID" if v57plus && (el7? || fedora?) - return '/usr/bin/mysql-systemd-start' if node['platform_family'] == 'rhel' + return '/usr/bin/mysql-systemd-start' if platform_family?('rhel') return '/usr/share/mysql/mysql-systemd-start' if v57plus "/usr/libexec/#{mysql_name}-wait-ready $MAINPID" end @@ -311,8 +311,8 @@ EOSQL end def mysqld_safe_bin - return "#{prefix_dir}/bin/mysqld_safe" if node['platform_family'] == 'smartos' - return "#{base_dir}/bin/mysqld_safe" if node['platform_family'] == 'omnios' + return "#{prefix_dir}/bin/mysqld_safe" if platform_family?('smartos') + return "#{base_dir}/bin/mysqld_safe" if platform_family?('omnios') return 'mysqld_safe' if scl_package? "#{prefix_dir}/usr/bin/mysqld_safe" end diff --git a/cookbooks/mysql/libraries/mysql_service_base.rb b/cookbooks/mysql/libraries/mysql_service_base.rb index 1e22d7e..883e8ef 100644 --- a/cookbooks/mysql/libraries/mysql_service_base.rb +++ b/cookbooks/mysql/libraries/mysql_service_base.rb @@ -123,7 +123,7 @@ module MysqlCookbook def configure_apparmor # Do not add these resource if inside a container # Only valid on Ubuntu - return if ::File.exist?('/.dockerenv') || ::File.exist?('/.dockerinit') || node['platform'] != 'ubuntu' + return if ::File.exist?('/.dockerenv') || ::File.exist?('/.dockerinit') || !platform?('ubuntu') # Apparmor package 'apparmor' do diff --git a/cookbooks/mysql/metadata.json b/cookbooks/mysql/metadata.json index e78d557..8409113 100644 --- a/cookbooks/mysql/metadata.json +++ b/cookbooks/mysql/metadata.json @@ -1 +1 @@ -{"name":"mysql","version":"8.7.3","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 14.04","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/mysql","issues_url":"https://github.com/sous-chefs/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file +{"name":"mysql","version":"8.7.4","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 14.04","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/mysql","issues_url":"https://github.com/sous-chefs/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/mysql/metadata.rb b/cookbooks/mysql/metadata.rb index 78a50fc..621d75f 100644 --- a/cookbooks/mysql/metadata.rb +++ b/cookbooks/mysql/metadata.rb @@ -6,7 +6,7 @@ description 'Provides mysql_service, mysql_config, and mysql_client resour source_url 'https://github.com/sous-chefs/mysql' issues_url 'https://github.com/sous-chefs/mysql/issues' chef_version '>= 12.7' -version '8.7.3' +version '8.7.4' %w(redhat centos scientific oracle).each do |el| supports el, '>= 6.0' diff --git a/cookbooks/nodejs/CHANGELOG.md b/cookbooks/nodejs/CHANGELOG.md index fb7fd29..e12da9f 100644 --- a/cookbooks/nodejs/CHANGELOG.md +++ b/cookbooks/nodejs/CHANGELOG.md @@ -1,5 +1,13 @@ # NodeJS Cookbook Changelog +## 7.3.3 - *2021-08-30* + +- Standardise files with files in sous-chefs/repo-management + +## 7.3.2 - *2021-06-01* + +- Standardise files with files in sous-chefs/repo-management + ## 7.3.1 - *2020-12-31* - resolved cookstyle error: attributes/packages.rb:15:55 convention: `Layout/TrailingEmptyLines` diff --git a/cookbooks/nodejs/metadata.json b/cookbooks/nodejs/metadata.json index 44a8dc0..e6c24a9 100644 --- a/cookbooks/nodejs/metadata.json +++ b/cookbooks/nodejs/metadata.json @@ -29,7 +29,7 @@ "recipes": { }, - "version": "7.3.1", + "version": "7.3.3", "source_url": "https://github.com/redguide/nodejs", "issues_url": "https://github.com/redguide/nodejs/issues", "privacy": false, diff --git a/cookbooks/nodejs/metadata.rb b/cookbooks/nodejs/metadata.rb index 17dd723..f22b592 100644 --- a/cookbooks/nodejs/metadata.rb +++ b/cookbooks/nodejs/metadata.rb @@ -6,7 +6,7 @@ description 'Installs/Configures node.js' source_url 'https://github.com/redguide/nodejs' issues_url 'https://github.com/redguide/nodejs/issues' chef_version '>= 14' -version '7.3.1' +version '7.3.3' depends 'ark', '>= 2.0.2' depends 'chocolatey', '>= 3.0' diff --git a/cookbooks/php/CHANGELOG.md b/cookbooks/php/CHANGELOG.md index ddc51ab..5b737fb 100644 --- a/cookbooks/php/CHANGELOG.md +++ b/cookbooks/php/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of the PHP cookbook. +## 8.0.1 (2020-11-12) + +- Prevent Apache from being pulled in as a dependency on Ubuntu 20.04 (#311) + ## 8.0.0 (2020-07-09) - Drop support for: diff --git a/cookbooks/php/attributes/default.rb b/cookbooks/php/attributes/default.rb index 3528620..d44617f 100644 --- a/cookbooks/php/attributes/default.rb +++ b/cookbooks/php/attributes/default.rb @@ -127,8 +127,7 @@ when 'debian' default['php']['checksum'] = 'a554a510190e726ebe7157fb00b4aceabdb50c679430510a3b93cbf5d7546e44' default['php']['conf_dir'] = '/etc/php/7.4/cli' default['php']['src_deps'] = %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng-dev libssl-dev pkg-config libxml2-dev libsqlite3-dev libonig-dev) - # Ubuntu >= 20.04 drops versions from the package names - default['php']['packages'] = %w(php-cgi php php-dev php-cli php-pear) + default['php']['packages'] = %w(php7.4-cgi php7.4 php7.4-dev php7.4-cli php-pear) default['php']['fpm_package'] = 'php7.4-fpm' default['php']['fpm_pooldir'] = '/etc/php/7.4/fpm/pool.d' default['php']['fpm_service'] = 'php7.4-fpm' diff --git a/cookbooks/php/metadata.json b/cookbooks/php/metadata.json index 5fa1158..be1a60d 100644 --- a/cookbooks/php/metadata.json +++ b/cookbooks/php/metadata.json @@ -1 +1 @@ -{"name":"php","version":"8.0.0","description":"Installs and maintains php and php modules","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"amazon":">= 2.0","centos":">= 7.0","debian":">= 9.0","oracle":">= 7.0","redhat":">= 7.0","scientific":">= 7.0","ubuntu":">= 16.04"},"dependencies":{"yum-epel":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/php","issues_url":"https://github.com/sous-chefs/php/issues","chef_version":[[">= 14.0"]],"ohai_version":[]} \ No newline at end of file +{"name":"php","version":"8.0.1","description":"Installs and maintains php and php modules","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"amazon":">= 2.0","centos":">= 7.0","debian":">= 9.0","oracle":">= 7.0","redhat":">= 7.0","scientific":">= 7.0","ubuntu":">= 16.04"},"dependencies":{"yum-epel":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/php","issues_url":"https://github.com/sous-chefs/php/issues","chef_version":[[">= 14.0"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/php/metadata.rb b/cookbooks/php/metadata.rb index 112a8c9..e52e18d 100644 --- a/cookbooks/php/metadata.rb +++ b/cookbooks/php/metadata.rb @@ -1,12 +1,12 @@ -name 'php' -maintainer 'Sous Chefs' -maintainer_email 'help@sous-chefs.org' -license 'Apache-2.0' -description 'Installs and maintains php and php modules' -source_url 'https://github.com/sous-chefs/php' -issues_url 'https://github.com/sous-chefs/php/issues' -chef_version '>= 14.0' -version '8.0.0' +name 'php' +maintainer 'Sous Chefs' +maintainer_email 'help@sous-chefs.org' +license 'Apache-2.0' +description 'Installs and maintains php and php modules' +source_url 'https://github.com/sous-chefs/php' +issues_url 'https://github.com/sous-chefs/php/issues' +chef_version '>= 14.0' +version '8.0.1' depends 'yum-epel' diff --git a/cookbooks/seven_zip/CHANGELOG.md b/cookbooks/seven_zip/CHANGELOG.md new file mode 100644 index 0000000..c510f71 --- /dev/null +++ b/cookbooks/seven_zip/CHANGELOG.md @@ -0,0 +1,104 @@ +# CHANGELOG for seven_zip + +This file is used to list changes made in each version of seven_zip. + +## 4.2.2 - *2021-08-31* + +- Standardise files with files in sous-chefs/repo-management + +## 4.2.1 - *2021-06-07* + +- [CI] Change ActionsHub actions to main +- [CI] Change checkout action to v2 +- [CI] Change final step to an echo for faster final step + +## 4.2.0 - *2021-06-07* + +- Add remove action to seven_zip_tool + +## 4.1.1 - *2021-06-01* + +- Update delivery configuration + +## 4.1.0 - *2021-05-20* + +- Reduce Chef requirement to >= 15.3 + +## 4.0.0 - *2021-04-29* + +- Increase the supported version of Chef to Chef 16 + + This is inline with our support policies, allowing us to use the newest Chef features + +- Remove dependency on the deprecated Windows cookbook +- Convert to modern custom resources +- Remove the default recipe +- Remove default_spec as we no longer have a default recipe +- Use the Chef `execute` and `directory` resources rather than Ruby methods +- Pull Windows helpers from the Windows cookbook and fix them to work in this cookbook + + As the Windows cookbook is no longer maintained many of the methods we used were deprecated + in Ruby 2.7 but were never fixed. These methods have now been removed in Ruby 3.0 + +- Move resource documentation to the documentation/resource directory. +- Update README to reflect new usage + +## 3.2.0 - *2021-01-24* + +- Sous Chefs Adoption +- Standardise files with files in sous-chefs/repo-management +- Various Cookstyle fixes +- Migrate from ServerSpec to InSpec for integration testing +- Update to 7-Zip 19.00 + +## 3.1.2 + +- Update nokogiri from [1.8.2 to 1.8.5](https://snyk.io/vuln/SNYK-RUBY-NOKOGIRI-72433) + +## 3.1.1 + +- Fix deprecation warning regarding the use of `win_friendly_path` helper. + +## 3.1.0 + +- Having a simple resource to setup 7-zip allows other resources (since including a recipe inside a resource is not a good pattern) to use it to ensure that their prerequisites are installed before-hand. +- This resource leverage existing attributes as default values to keep backward compatibility. +- The `seven_zip::default` recipe's code has been refactored to just use this resource. + +## 3.0.0 + +- Support Chef 13, drop support for Chef 12. +- Upgrade to 7-Zip 18.05. +- Standardize testing environment across repos. (AppVeyor, Kitchen, Rake, etc.) +- Upgrade development dependencies. + +## 2.0.2 + +- Add timeout to extract action on `seven_zip` resource and configurable `default_extract_timeout` attribute. + +## 2.0.1 + +- [GH Issue 21 - NoMethodError: Undefined method or attribute kernel on node](https://github.com/daptiv/seven_zip/issues/21). + +## 2.0.0 + +- [Upgrade to 7-Zip 15.14](https://github.com/daptiv/seven_zip/pull/9). +- [7-Zip now installed to the default MSI location by default](https://github.com/daptiv/seven_zip/pull/11). +- [7z.exe is located using the Windows registry unless the home attribute is explicitly set](https://github.com/daptiv/seven_zip/pull/10). +- [7-Zip is only added to the Windows PATH if the syspath attribute is set](https://github.com/daptiv/seven_zip/pull/11). +- [Installation idempotence check was fixed](https://github.com/daptiv/seven_zip/pull/14), package name was corrected. +- [TravisCI build added](https://github.com/daptiv/seven_zip/pull/12). +- [ServerSpec tests added](https://github.com/daptiv/seven_zip/pull/9) +- [Document Archive LRWP](https://github.com/daptiv/seven_zip/pull/6) + +## 1.0.2 + +- [COOK-3476 - Upgrade to 7-zip 9.22](https://tickets.opscode.com/browse/COOK-3476) + +## 1.0.0 + +- initial release + +--- + +Refer to the [Markdown Syntax Guide](https://daringfireball.net/projects/markdown/syntax) for help with standard Markdown, and [Writing on GitHub](https://help.github.com/categories/writing-on-github/) for help with the GitHub dialect of Markdown. diff --git a/cookbooks/seven_zip/Gemfile b/cookbooks/seven_zip/Gemfile deleted file mode 100644 index b6ba658..0000000 --- a/cookbooks/seven_zip/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'http://rubygems.org' - -gem 'cookstyle' -gem 'foodcritic' -gem 'rspec-expectations' -gem 'rspec-mocks' -gem 'rubocop' -gem 'stove' diff --git a/cookbooks/seven_zip/Gemfile.lock b/cookbooks/seven_zip/Gemfile.lock deleted file mode 100644 index 9a5c87f..0000000 --- a/cookbooks/seven_zip/Gemfile.lock +++ /dev/null @@ -1,79 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - ast (2.4.0) - backports (3.11.3) - chef-api (0.8.0) - logify (~> 0.1) - mime-types - cookstyle (3.0.0) - rubocop (= 0.55.0) - cucumber-core (3.1.0) - backports (>= 3.8.0) - cucumber-tag_expressions (~> 1.1.0) - gherkin (>= 5.0.0) - cucumber-tag_expressions (1.1.1) - diff-lcs (1.3) - erubis (2.7.0) - ffi-yajl (2.3.1) - libyajl2 (~> 1.2) - foodcritic (13.1.1) - cucumber-core (>= 1.3) - erubis - ffi-yajl (~> 2.0) - nokogiri (>= 1.5, < 2.0) - rake - rufus-lru (~> 1.0) - treetop (~> 1.4) - gherkin (5.0.0) - libyajl2 (1.2.0) - logify (0.2.0) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.3.0) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) - parallel (1.12.1) - parser (2.5.1.0) - ast (~> 2.4.0) - polyglot (0.3.5) - powerpack (0.1.1) - rainbow (3.0.0) - rake (12.3.1) - rspec-expectations (3.7.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.1) - rubocop (0.55.0) - parallel (~> 1.10) - parser (>= 2.5) - powerpack (~> 0.1) - rainbow (>= 2.2.2, < 4.0) - ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.9.0) - rufus-lru (1.1.0) - stove (6.0.0) - chef-api (~> 0.5) - logify (~> 0.2) - treetop (1.6.10) - polyglot (~> 0.3) - unicode-display_width (1.3.2) - -PLATFORMS - ruby - -DEPENDENCIES - cookstyle - foodcritic - rspec-expectations - rspec-mocks - rubocop - stove - -BUNDLED WITH - 1.16.1 diff --git a/cookbooks/seven_zip/README.md b/cookbooks/seven_zip/README.md index 7e04831..f95a526 100644 --- a/cookbooks/seven_zip/README.md +++ b/cookbooks/seven_zip/README.md @@ -1,11 +1,21 @@ -[![Cookbook Version](http://img.shields.io/cookbook/v/seven_zip.svg)](https://supermarket.chef.io/cookbooks/seven_zip) -[![Build status](https://ci.appveyor.com/api/projects/status/y1lsnlkd2b3q6gfd/branch/master?svg=true)](https://ci.appveyor.com/project/ChefWindowsCookbooks65871/seven-zip/branch/master) - # seven_zip Cookbook + +[![Cookbook Version](https://img.shields.io/cookbook/v/seven_zip.svg)](https://supermarket.chef.io/cookbooks/seven_zip) +[![CI State](https://github.com/sous-chefs/seven_zip/workflows/ci/badge.svg)](https://github.com/sous-chefs/seven_zip/actions?query=workflow%3Aci) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) + [7-Zip](http://www.7-zip.org/) is a file archiver with a high compression ratio. This cookbook installs the full 7-Zip suite of tools (GUI and CLI). This cookbook replaces the older [7-Zip cookbook](https://github.com/sneal/7-zip). -# Requirements +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). + +## Requirements + ## Platforms + - Windows XP - Windows Vista - Windows 7 @@ -16,99 +26,37 @@ - Windows Server 2012 (R1, R2) ## Chef -- Chef >= 13.0 -## Cookbooks -- windows +- Chef >= 16.0 -# Attributes -## Optional +## Usage -| Key | Type | Description | Default | -|-----|------|-------------|---------| -| `['seven_zip']['home']` | String | 7-Zip installation directory. | | -| `['seven_zip']['syspath']` | Boolean | If true, adds 7-Zip directory to system PATH environment variable. | | -| `['seven_zip']['default_extract_timeout']` | Integer | The default timeout for an extract operation in seconds. This can be overridden by a resource attribute. | `600` | +## Resources -# Usage -## default +- [seven_zip_tool](https://github.com/sous-chefs/seven_zip/blob/master/documentation/resources/seven_zip_tool.md) +- [seven_zip_archive](https://github.com/sous-chefs/seven_zip/blob/master/documentation/resources/seven_zip_archive.md) -Add `seven_zip::default` to your run\_list which will download and install 7-Zip for the current Windows platform. +## Contributors -# Resource/Provider -## seven_zip_archive -Extracts a 7-Zip compatible archive (iso, zip, 7z, etc.) to the specified destination directory. +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -#### Actions -- `:extract` - Extract a 7-Zip compatible archive. +### Backers -#### Attribute Parameters -- `path` - Name attribute. The destination to extract to. -- `source` - The file path to the archive to extract. -- `overwrite` - Defaults to false. If true, the destination files will be overwritten. -- `checksum` - The archive file checksum. -- `timeout` - The extract action timeout in seconds, defaults to `node['seven_zip']['default_extract_timeout']`. +Thank you to all our backers! -#### Examples -Extract 7-Zip source files to `C:\seven_zip_source`. +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) -```ruby -seven_zip_archive 'seven_zip_source' do - path 'C:\seven_zip_source' - source 'https://www.7-zip.org/a/7z1805-src.7z' - overwrite true - checksum 'd9acfcbbdcad078435586e00f73909358ed8d714d106e064dcba52fa73e75d83' - timeout 30 -end -``` +### Sponsors -## seven_zip_tool -Download and install 7-zip for the current Windows platform. +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. -#### Actions -- `:install` - Installs 7-zip -- `:add_to_path` - Add 7-zip to the PATH - -#### Attribute Parameters -- `package` - The name of the package. -- `path` - The install directory of 7-zip. -- `source` - The source URL of the 7-zip package. -- `checksum` - The 7-zip package checksum. - -#### Examples -Install 7-zip in `C:\7z` and add it to the path. - -```ruby -seven_zip_tool '7z 15.14 install' do - action [:install, :add_to_path] - package '7-Zip 15.14' - path 'C:\7z' - source 'http://www.7-zip.org/a/7z1514.msi' - checksum 'eaf58e29941d8ca95045946949d75d9b5455fac167df979a7f8e4a6bf2d39680' -end -``` - -# Recipes -## default - -Installs 7-Zip and adds it to your system PATH. - -# License & Authors -- Author:: Seth Chisamore () -- Author:: Shawn Neal () - -```text -Copyright:: 2011-2016, Chef Software, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/seven_zip/appveyor.yml b/cookbooks/seven_zip/appveyor.yml deleted file mode 100644 index 321b270..0000000 --- a/cookbooks/seven_zip/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: "3.1.1.{build}-{branch}" - -image: Visual Studio 2013 -platform: x64 - -environment: - machine_user: vagrant - machine_pass: vagrant - KITCHEN_YAML: .kitchen.appveyor.yml - -branches: - only: - - master - -# Do not build on tags (GitHub only) -skip_tags: true - -#faster cloning -clone_depth: 1 - -install: - - ps: (& cmd /c); iex (irm https://omnitruck.chef.io/install.ps1); Install-Project -Project chefdk -channel stable -version 3.10.1 - - ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version' - - ps: $PSVersionTable - - c:\opscode\chefdk\bin\chef.bat exec ruby --version - - ps: secedit /export /cfg $env:temp/export.cfg - - ps: ((get-content $env:temp/export.cfg) -replace ('PasswordComplexity = 1', 'PasswordComplexity = 0')) | Out-File $env:temp/export.cfg - - ps: ((get-content $env:temp/export.cfg) -replace ('MinimumPasswordLength = 8', 'MinimumPasswordLength = 0')) | Out-File $env:temp/export.cfg - - ps: secedit /configure /db $env:windir/security/new.sdb /cfg $env:temp/export.cfg /areas SECURITYPOLICY - - ps: net user /add $env:machine_user $env:machine_pass - - ps: net localgroup administrators $env:machine_user /add - -build_script: - - ps: c:\opscode\chefdk\bin\chef.bat shell-init powershell | iex; cmd /c c:\opscode\chefdk\bin\chef.bat --version - -test_script: - - c:\opscode\chefdk\bin\cookstyle --version - - c:\opscode\chefdk\bin\chef.bat exec foodcritic --version - - c:\opscode\chefdk\bin\chef.bat exec rake - - c:\opscode\chefdk\bin\chef.bat exec kitchen verify - -deploy: off diff --git a/cookbooks/seven_zip/attributes/default.rb b/cookbooks/seven_zip/attributes/default.rb deleted file mode 100644 index 443a28b..0000000 --- a/cookbooks/seven_zip/attributes/default.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook:: seven_zip -# Attribute:: default -# -# Copyright:: 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -if node['kernel']['machine'] == 'x86_64' - default['seven_zip']['url'] = 'https://www.7-zip.org/a/7z1805-x64.msi' - default['seven_zip']['checksum'] = '898c1ca0015183fe2ba7d55cacf0a1dea35e873bf3f8090f362a6288c6ef08d7' - default['seven_zip']['package_name'] = '7-Zip 18.05 (x64 edition)' -else - default['seven_zip']['url'] = 'https://www.7-zip.org/a/7z1805.msi' - default['seven_zip']['checksum'] = 'c554238bee18a03d736525e06d9258c9ecf7f64ead7c6b0d1eb04db2c0de30d0' - default['seven_zip']['package_name'] = '7-Zip 18.05' -end - -default['seven_zip']['default_extract_timeout'] = 600 diff --git a/cookbooks/seven_zip/chefignore b/cookbooks/seven_zip/chefignore index 9c2bd55..cc170ea 100644 --- a/cookbooks/seven_zip/chefignore +++ b/cookbooks/seven_zip/chefignore @@ -1,73 +1,85 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + # OS generated files # ###################### .DS_Store +ehthumbs.db Icon? nohup.out -ehthumbs.db Thumbs.db - -# SASS # -######## -.sass-cache +.envrc # EDITORS # ########### -\#* .#* -*~ -*.sw[a-z] +.project +.settings +*_flymake +*_flymake.* *.bak +*.sw[a-z] +*.tmproj +*~ +\#* REVISION TAGS* tmtags -*_flymake.* -*_flymake -*.tmproj -.project -.settings -mkmf.log +.vscode +.editorconfig ## COMPILED ## ############## -a.out +*.class +*.com +*.dll +*.exe *.o *.pyc *.so -*.com -*.class -*.dll -*.exe */rdoc/ +a.out +mkmf.log # Testing # ########### -.watchr -.rspec -spec/* -spec/fixtures/* -test/* -features/* -examples/* -Guardfile -Procfile -.kitchen* -.rubocop.yml -spec/* -Rakefile -.travis.yml -.foodcritic +.circleci/* .codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* # SCM # ####### .git -*/.git -.gitignore -.gitmodules -.gitconfig .gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules .svn */.bzr/* +*/.git */.hg/* */.svn/* @@ -78,19 +90,24 @@ Berksfile.lock cookbooks/* tmp -# Cookbooks # -############# -CONTRIBUTING* -CHANGELOG* -TESTING* -MAINTAINERS.toml +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock -# Strainer # -############ -Colanderfile -Strainerfile -.colander -.strainer +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* # Vagrant # ########### diff --git a/cookbooks/seven_zip/kitchen.exec.yml b/cookbooks/seven_zip/kitchen.exec.yml new file mode 100644 index 0000000..3ac4b93 --- /dev/null +++ b/cookbooks/seven_zip/kitchen.exec.yml @@ -0,0 +1,15 @@ +--- +driver: + name: exec + +transport: + name: exec + +provisioner: + name: chef_zero + enforce_idempotency: true + multiple_converge: 2 + deprecations_as_errors: true + +platforms: + - name: windows-latest diff --git a/cookbooks/seven_zip/libraries/matchers.rb b/cookbooks/seven_zip/libraries/matchers.rb deleted file mode 100644 index 6dd4dca..0000000 --- a/cookbooks/seven_zip/libraries/matchers.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Author:: Shawn Neal () -# Cookbook:: visualstudio -# -# Copyright:: 2015-2017, Shawn Neal -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -if defined?(ChefSpec) - chefspec_version = Gem.loaded_specs['chefspec'].version - define_method = if chefspec_version < Gem::Version.new('4.1.0') - ChefSpec::Runner.method(:define_runner_method) - else - ChefSpec.method(:define_matcher) - end - - define_method.call :seven_zip_archive - - def extract_seven_zip_archive(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:seven_zip_archive, :extract, resource_name) - end -end diff --git a/cookbooks/seven_zip/metadata.json b/cookbooks/seven_zip/metadata.json index cf13785..24db485 100644 --- a/cookbooks/seven_zip/metadata.json +++ b/cookbooks/seven_zip/metadata.json @@ -1,32 +1,29 @@ { "name": "seven_zip", "description": "Installs/Configures 7-Zip", - "long_description": "[![Cookbook Version](http://img.shields.io/cookbook/v/seven_zip.svg)](https://supermarket.chef.io/cookbooks/seven_zip)\n[![Build status](https://ci.appveyor.com/api/projects/status/y1lsnlkd2b3q6gfd/branch/master?svg=true)](https://ci.appveyor.com/project/ChefWindowsCookbooks65871/seven-zip/branch/master)\n\n# seven_zip Cookbook\n[7-Zip](http://www.7-zip.org/) is a file archiver with a high compression ratio. This cookbook installs the full 7-Zip suite of tools (GUI and CLI). This cookbook replaces the older [7-Zip cookbook](https://github.com/sneal/7-zip).\n\n# Requirements\n## Platforms\n- Windows XP\n- Windows Vista\n- Windows 7\n- Windows 8, 8.1\n- Windows 10\n- Windows Server 2003 R2\n- Windows Server 2008 (R1, R2)\n- Windows Server 2012 (R1, R2)\n\n## Chef\n- Chef >= 13.0\n\n## Cookbooks\n- windows\n\n# Attributes\n## Optional\n\n| Key | Type | Description | Default |\n|-----|------|-------------|---------|\n| `['seven_zip']['home']` | String | 7-Zip installation directory. | |\n| `['seven_zip']['syspath']` | Boolean | If true, adds 7-Zip directory to system PATH environment variable. | |\n| `['seven_zip']['default_extract_timeout']` | Integer | The default timeout for an extract operation in seconds. This can be overridden by a resource attribute. | `600` |\n\n# Usage\n## default\n\nAdd `seven_zip::default` to your run\\_list which will download and install 7-Zip for the current Windows platform.\n\n# Resource/Provider\n## seven_zip_archive\nExtracts a 7-Zip compatible archive (iso, zip, 7z, etc.) to the specified destination directory.\n\n#### Actions\n- `:extract` - Extract a 7-Zip compatible archive.\n\n#### Attribute Parameters\n- `path` - Name attribute. The destination to extract to.\n- `source` - The file path to the archive to extract.\n- `overwrite` - Defaults to false. If true, the destination files will be overwritten.\n- `checksum` - The archive file checksum.\n- `timeout` - The extract action timeout in seconds, defaults to `node['seven_zip']['default_extract_timeout']`.\n\n#### Examples\nExtract 7-Zip source files to `C:\\seven_zip_source`.\n\n```ruby\nseven_zip_archive 'seven_zip_source' do\n path 'C:\\seven_zip_source'\n source 'https://www.7-zip.org/a/7z1805-src.7z'\n overwrite true\n checksum 'd9acfcbbdcad078435586e00f73909358ed8d714d106e064dcba52fa73e75d83'\n timeout 30\nend\n```\n\n## seven_zip_tool\nDownload and install 7-zip for the current Windows platform.\n\n#### Actions\n- `:install` - Installs 7-zip\n- `:add_to_path` - Add 7-zip to the PATH\n\n#### Attribute Parameters\n- `package` - The name of the package.\n- `path` - The install directory of 7-zip.\n- `source` - The source URL of the 7-zip package.\n- `checksum` - The 7-zip package checksum.\n\n#### Examples\nInstall 7-zip in `C:\\7z` and add it to the path.\n\n```ruby\nseven_zip_tool '7z 15.14 install' do\n action [:install, :add_to_path]\n package '7-Zip 15.14'\n path 'C:\\7z'\n source 'http://www.7-zip.org/a/7z1514.msi'\n checksum 'eaf58e29941d8ca95045946949d75d9b5455fac167df979a7f8e4a6bf2d39680'\nend\n```\n\n# Recipes\n## default\n\nInstalls 7-Zip and adds it to your system PATH.\n\n# License & Authors\n- Author:: Seth Chisamore ()\n- Author:: Shawn Neal ()\n\n```text\nCopyright:: 2011-2016, Chef Software, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n", - "maintainer": "Shawn Neal", - "maintainer_email": "sneal@sneal.net", + "long_description": "", + "maintainer": "Sous Chefs", + "maintainer_email": "help@sous-chefs.org", "license": "Apache-2.0", "platforms": { "windows": ">= 0.0.0" }, "dependencies": { - "windows": ">= 0.0.0" - }, - "providing": { }, - "attributes": { + "providing": { }, "recipes": { }, - "version": "3.1.1", - "source_url": "https://github.com/windowschefcookbooks/seven_zip", - "issues_url": "https://github.com/windowschefcookbooks/seven_zip/issues", + "version": "4.2.2", + "source_url": "https://github.com/sous-chefs/seven_zip", + "issues_url": "https://github.com/sous-chefs/seven_zip/issues", "privacy": false, "chef_versions": [ [ - ">= 13.0" + ">= 15.3" ] ], "ohai_versions": [ @@ -34,5 +31,6 @@ ], "gems": [ - ] + ], + "eager_load_libraries": true } diff --git a/cookbooks/seven_zip/metadata.rb b/cookbooks/seven_zip/metadata.rb index d840292..419af07 100644 --- a/cookbooks/seven_zip/metadata.rb +++ b/cookbooks/seven_zip/metadata.rb @@ -1,12 +1,11 @@ name 'seven_zip' -maintainer 'Shawn Neal' -maintainer_email 'sneal@sneal.net' -source_url 'https://github.com/windowschefcookbooks/seven_zip' -issues_url 'https://github.com/windowschefcookbooks/seven_zip/issues' -chef_version '>= 13.0' if respond_to?(:chef_version) +maintainer 'Sous Chefs' +maintainer_email 'help@sous-chefs.org' license 'Apache-2.0' description 'Installs/Configures 7-Zip' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '3.1.1' +version '4.2.2' +source_url 'https://github.com/sous-chefs/seven_zip' +issues_url 'https://github.com/sous-chefs/seven_zip/issues' +chef_version '>= 15.3' + supports 'windows' -depends 'windows' diff --git a/cookbooks/seven_zip/providers/archive.rb b/cookbooks/seven_zip/providers/archive.rb deleted file mode 100644 index c935569..0000000 --- a/cookbooks/seven_zip/providers/archive.rb +++ /dev/null @@ -1,64 +0,0 @@ -# -# Author:: Shawn Neal () -# Cookbook:: seven_zip -# Provider:: archive -# -# Copyright:: 2013-2017, Daptiv Solutions LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'fileutils' -require 'chef/mixin/shell_out' -require 'chef/util/path_helper' - -include Chef::Mixin::ShellOut -include Windows::Helper - -def whyrun_supported? - true -end - -action :extract do - converge_by("Extract #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})") do - FileUtils.mkdir_p(@new_resource.path) unless Dir.exist?(@new_resource.path) - local_source = cached_file(@new_resource.source, @new_resource.checksum) - overwrite_file = @new_resource.overwrite ? ' -y' : ' -aos' - cmd = "\"#{seven_zip_exe}\" x" - cmd << overwrite_file - cmd << " -o\"#{Chef::Util::PathHelper.cleanpath(@new_resource.path)}\"" - cmd << " \"#{local_source}\"" - Chef::Log.debug(cmd) - shell_out!(cmd, timeout: extract_timeout) - end -end - -def seven_zip_exe - path = node['seven_zip']['home'] || seven_zip_exe_from_registry - Chef::Log.debug("Using 7-zip home: #{path}") - Chef::Util::PathHelper.cleanpath(::File.join(path, '7z.exe')) -end - -def seven_zip_exe_from_registry - require 'win32/registry' - # Read path from recommended Windows App Paths registry location - # docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 - ::Win32::Registry::HKEY_LOCAL_MACHINE.open( - 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe', - ::Win32::Registry::KEY_READ - ).read_s('Path') -end - -def extract_timeout - @new_resource.timeout || node['seven_zip']['default_extract_timeout'] -end diff --git a/cookbooks/seven_zip/recipes/default.rb b/cookbooks/seven_zip/recipes/default.rb deleted file mode 100644 index b013889..0000000 --- a/cookbooks/seven_zip/recipes/default.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Author:: Seth Chisamore () -# Cookbook:: seven_zip -# Recipe:: default -# -# Copyright:: 2011-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Install 7z and optionally add it to path -seven_zip_tool 'install seven_zip' do - action [:install, :add_to_path] if node['seven_zip']['syspath'] -end diff --git a/cookbooks/seven_zip/resources/archive.rb b/cookbooks/seven_zip/resources/archive.rb index 5558f14..25b5e94 100644 --- a/cookbooks/seven_zip/resources/archive.rb +++ b/cookbooks/seven_zip/resources/archive.rb @@ -1,29 +1,92 @@ -# -# Author:: Shawn Neal () -# Cookbook:: seven_zip -# Resource:: archive -# -# Copyright:: 2013-2017, Daptiv Solutions LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +unified_mode true -default_action :extract +property :path, + String, + name_property: true, + description: 'Path to extract the archive.' -actions :extract +property :source, + String, + description: 'Source archive location.' -attribute :path, kind_of: String, name_attribute: true -attribute :source, kind_of: String -attribute :overwrite, kind_of: [TrueClass, FalseClass], default: false -attribute :checksum, kind_of: String -attribute :timeout, kind_of: Integer +property :overwrite, + [true, false], + default: false, + description: 'Whether to overwrite the destination files.' + +property :checksum, + String, + description: 'The checksum for the downloaded file.' + +property :timeout, + Integer, + default: 600, + description: 'Extract timeout in seconds.' + +action :extract do + directory new_resource.path + + local_source = cached_file(new_resource.source, new_resource.checksum) + + overwrite_file = new_resource.overwrite ? ' -y' : ' -aos' + + cmd = "\"#{seven_zip_exe}\" x" + cmd << overwrite_file + cmd << " -o\"#{Chef::Util::PathHelper.cleanpath(new_resource.path)}\"" + cmd << " \"#{local_source}\"" + + Chef::Log.debug(cmd) + + execute "extracting #{new_resource.source}" do + command cmd + timeout new_resource.timeout + end +end + +action_class do + # require 'chef/mixin/shell_out' + # include Chef::Mixin::ShellOut + + def seven_zip_exe + path = seven_zip_exe_from_registry + Chef::Log.debug("Using 7-zip home: #{path}") + Chef::Util::PathHelper.cleanpath(::File.join(path, '7z.exe')) + end + + def seven_zip_exe_from_registry + require 'win32/registry' + # Read path from recommended Windows App Paths registry location + # docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 + ::Win32::Registry::HKEY_LOCAL_MACHINE.open( + 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe', + ::Win32::Registry::KEY_READ + ).read_s('Path') + end + + # if a file is local it returns a windows friendly path version + # if a file is remote it caches it locally + def cached_file(source, checksum = nil) + if source =~ %r{^(file|ftp|http|https):\/\/} + uri = as_uri(source) + cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}" + Chef::Log.debug("Caching a copy of file #{source} at #{cache_file_path}") + + remote_file cache_file_path do + source source + backup false + checksum checksum unless checksum.nil? + end + else + cache_file_path = source + end + + Chef::Util::PathHelper.cleanpath(cache_file_path) + end + + def as_uri(source) + URI.parse(source) + rescue URI::InvalidURIError + Chef::Log.warn("#{source} was an invalid URI. Trying to escape invalid characters") + URI.parse(URI.escape(source)) + end +end diff --git a/cookbooks/seven_zip/resources/tool.rb b/cookbooks/seven_zip/resources/tool.rb index 4e27965..58217aa 100644 --- a/cookbooks/seven_zip/resources/tool.rb +++ b/cookbooks/seven_zip/resources/tool.rb @@ -1,26 +1,23 @@ -# -# Author:: Annih () -# Cookbook:: seven_zip -# Resource:: tool -# -# Copyright:: 2018, Baptiste Courtois -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -property :package, ::String, default: lazy { node['seven_zip']['package_name'] } -property :source, ::String, default: lazy { node['seven_zip']['url'] } -property :checksum, [::NilClass, ::String], default: lazy { node['seven_zip']['checksum'] } -property :path, [::NilClass, ::String], default: lazy { node['seven_zip']['home'] } +unified_mode true + +property :package, + String, + description: 'Name of the package to install.', + default: node['kernel']['machine'] == 'x86_64' ? '7-Zip 19.00 (x64 edition)' : '7-Zip 19.00' + +property :source, + String, + description: 'Source URL of the package to install.', + default: node['kernel']['machine'] == 'x86_64' ? 'https://www.7-zip.org/a/7z1900-x64.msi' : 'https://www.7-zip.org/a/7z1900.msi' + +property :checksum, + String, + description: 'Checksum for the downloaded pacakge.', + default: node['kernel']['machine'] == 'x86_64' ? 'a7803233eedb6a4b59b3024ccf9292a6fffb94507dc998aa67c5b745d197a5dc' : 'b49d55a52bc0eab14947c8982c413d9be141c337da1368a24aa0484cbb5e89cd' + +property :path, + String, + description: 'Optional: path to install 7zip to.' action :install do windows_package new_resource.package do @@ -38,6 +35,12 @@ action :add_to_path do end end +action :remove do + windows_package new_resource.package do + action :remove + end +end + action_class do REG_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe'.freeze diff --git a/cookbooks/windows/CHANGELOG.md b/cookbooks/windows/CHANGELOG.md index d88694c..87793e7 100644 --- a/cookbooks/windows/CHANGELOG.md +++ b/cookbooks/windows/CHANGELOG.md @@ -2,6 +2,49 @@ This file is used to list changes made in each version of the windows cookbook. +## 7.0.2 (2020-09-10) + +- Resolve a typo in the user_privilege resource - [@tas50](https://github.com/tas50) +- Don't run delivery in Appveyor - [@tas50](https://github.com/tas50) + +## 7.0.1 (2020-09-10) + +- Remove testing of Windows 2008 R2 - [@tas50](https://github.com/tas50) +- Cookstyle 6.2.9 Fixes - [@xorimabot](https://github.com/xorimabot) +- Avoid deprcation warnings when using user_privilege resource on Chef >= - [@tas50](https://github.com/tas50) + +## Unreleased + +- resolved cookstyle error: libraries/registry_helper.rb:69:9 refactor: `ChefCorrectness/ChefApplicationFatal` +- resolved cookstyle error: libraries/registry_helper.rb:232:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/registry_helper.rb:234:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/registry_helper.rb:244:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/registry_helper.rb:245:7 convention: `Style/EmptyElse` +- resolved cookstyle error: libraries/registry_helper.rb:246:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/registry_helper.rb:272:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/registry_helper.rb:274:9 convention: `Style/RedundantReturn` +- resolved cookstyle error: libraries/windows_helper.rb:165:14 warning: `Lint/SendWithMixinArgument` + +## 7.0.0 (2020-03-26) + +### Breaking Changes + +- This cookbook now requires Chef Infra Client 14.7 and later as it no longer includes the `windows_share` and `windows_certificate` resources that are now built into Chef Infra Client. + +### Other Changes + +- Remove list of actions in the dns resource - [@tas50](https://github.com/tas50) +- Don't set the guard_interpreter in powershell_script - [@tas50](https://github.com/tas50) +- Add windows_schannel resource (#619) - [@Xorima](https://github.com/Xorima) +- Remove desired_state: true from resources - [@tas50](https://github.com/tas50) +- The host_name property in the dns resource doesn't need to be a name property - [@tas50](https://github.com/tas50) +- Remove unnecessary include of the powershell mixin - [@tas50](https://github.com/tas50) + +## 6.0.1 (2019-10-01) + +- Update README.md for Windows cookbook suggesting core dns resources (#616) - [@NAshwini](https://github.com/NAshwini) +- Add a warning when using windows_zipfile resource as users should migrate to archive_file (#617) - [@NAshwini](https://github.com/NAshwini) + ## 6.0.0 (2019-04-25) ### Breaking Changes diff --git a/cookbooks/windows/README.md b/cookbooks/windows/README.md index b849fbf..637328d 100644 --- a/cookbooks/windows/README.md +++ b/cookbooks/windows/README.md @@ -8,83 +8,21 @@ Provides a set of Windows-specific resources to aid in the creation of cookbooks ### Platforms -- Windows 7 -- Windows Server 2008 R2 +- Windows 7 (EOL) +- Windows Server 2008 R2 (EOL) - Windows 8, 8.1 - Windows Server 2012 (R1, R2) - Windows Server 2016 ### Chef -- Chef 14+ +- Chef 14.7+ ## Resources -### Deprecated Resources Note - -As of Chef 14.7+ the windows_share and windows_certificate resources are now included in the Chef Client. If you are running Chef 14.7+ the resources in Chef client will take precedence over the resources in this cookbook. In November 2019 we will release a new major version of this cookbook that removes these resources. - -### windows_certificate - -`Note`: This resource is now included in Chef 14.7 and later. There is no need to depend on the Windows cookbook for this resource. - -Installs a certificate into the Windows certificate store from a file, and grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificated remotely may not work if the operation requires a user profile. Operations on the local machine store should still work. - -#### Actions - -- `:create` - creates or updates a certificate. -- `:delete` - deletes a certificate. -- `:acl_add` - adds read-only entries to a certificate's private key ACL. -- `:verify` - logs whether or not a certificate is valid - -#### Properties - -- `source` - name attribute. The source file (for create and acl_add), thumbprint (for delete and acl_add) or subject (for delete). -- `pfx_password` - the password to access the source if it is a pfx file. -- `private_key_acl` - array of 'domain\account' entries to be granted read-only access to the certificate's private key. This is not idempotent. -- `store_name` - the certificate store to manipulate. One of: - - MY (Personal) - - CA (Intermediate Certification Authorities) - - ROOT (Trusted Root Certification Authorities) - - TRUSTEDPUBLISHER (Trusted Publishers) - - CLIENTAUTHISSUER (Client Authentication Issuers) - - REMOTE DESKTOP (Remote Desktop) - - TRUSTEDDEVICES (Trusted Devices) - - WEBHOSTING (Web Hosting) - - AUTHROOT (Third-Party Root Certification Authorities) - - TRUSTEDPEOPLE (Trusted People) - - SMARTCARDROOT (Smart Card Trusted Roots) - - TRUST (Enterprise Trust) - - DISALLOWED (Untrusted Certificates) -- `user_store` - if false (default) then use the local machine store; if true then use the current user's store. - -#### Examples - -```ruby -# Add PFX cert to local machine personal store and grant accounts read-only access to private key -windows_certificate "c:/test/mycert.pfx" do - pfx_password "password" - private_key_acl ["acme\fred", "pc\jane"] -end -``` - -```ruby -# Add cert to trusted intermediate store -windows_certificate "c:/test/mycert.cer" do - store_name "CA" -end -``` - -```ruby -# Remove all certificates matching the subject -windows_certificate "me.acme.com" do - action :delete -end -``` - ### windows_certificate_binding -Binds a certificate to an HTTP port in order to enable TLS communication. +Binds a certificate to an HTTP port to enable TLS communication. #### Actions @@ -135,6 +73,8 @@ end ### windows_dns +`Note`: This resource is now included in Chef 15 and later. If you are using newer versions of [windows](https://devblogs.microsoft.com/powershell/configuration-in-a-devops-world-windows-powershell-desired-state-configuration/) then should use the core [resource](https://github.com/chef/chef/blob/master/RELEASE_NOTES.md#windows_dns_record-resource) instead of windows_dns. + Configures A and CNAME records in Windows DNS. This requires the DNSCMD to be installed, which is done by adding the DNS role to the server or installing the Remote Server Admin Tools. #### Actions @@ -213,52 +153,19 @@ windows_http_acl 'http://+:50051/' do end ``` -### windows_share +### windows_schannel -`Note`: This resource is now included in Chef 14.7 and later. There is no need to depend on the Windows cookbook for this resource. - -Creates, modifies and removes Windows shares. All properties are idempotent. - -`Note`: This resource uses PowerShell cmdlets introduced in Windows 2012/8. +Used to configure the schannel security settings in windows, this is used by dotnet apps and PowerShell to be able to speak to tls 1.2 endpoints #### Actions -- `:create`: creates/modifies a share -- `:delete`: deletes a share +- `configure`: Configures the setting #### Properties property | type | default | description ------------------------ | ---------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- -`share_name` | String | resource name | the share to assign to the share -`path` | String | | The path of the location of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created. -`description` | String | | description to be applied to the share -`full_users` | Array | [] | users which should have "Full control" permissions -`change_users` | Array | [] | Users are granted modify permission to access the share. -`read_users` | Array | [] | users which should have "Read" permissions -`temporary` | True/False | false | The lifetime of the new SMB share. A temporary share does not persist beyond the next restart of the computer -`scope_name` | String | '*' | The scope name of the share. -`ca_timeout` | Integer | 0 | The continuous availability time-out for the share. -`continuously_available` | True/False | false | Indicates that the share is continuously available. -`concurrent_user_limit` | Integer | 0 (unlimited) | The maximum number of concurrently connected users the share can accommodate -`encrypt_data` | True/False | false | Indicates that the share is encrypted. - -#### Examples - -```ruby -windows_share "foo" do - action :create - path "C:\\foo" - full_users ["DOMAIN_A\\some_user", "DOMAIN_B\\some_other_user"] - read_users ["DOMAIN_C\\Domain users"] -end -``` - -```ruby -windows_share "foo" do - action :delete -end -``` +`use_strong_crypto` | True, False | true | Enables or disables the setting ### windows_user_privilege @@ -345,7 +252,9 @@ SeTakeOwnershipPrivilege Take ownership of files or other objects ### windows_zipfile -Most version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken every Chef run. +`Note`: This resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use the `archive_file` resource: https://docs.chef.io/resource_archive_file.html + +Most versions of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken every Chef run. #### Actions @@ -401,7 +310,7 @@ Returns a hash of all DisplayNames installed ```ruby # usage in a recipe -::Chef::Recipe.send(:include, Windows::Helper) +::Chef::DSL::Recipe.send(:include, Windows::Helper) hash_of_installed_packages = installed_packages ``` @@ -414,7 +323,7 @@ Download a file if a package isn't installed ```ruby # usage in a recipe to not download a file if package is already installed -::Chef::Recipe.send(:include, Windows::Helper) +::Chef::DSL::Recipe.send(:include, Windows::Helper) is_win_sdk_installed = is_package_installed?('Windows Software Development Kit') remote_file 'C:\windows\temp\windows_sdk.zip' do @@ -436,11 +345,11 @@ end ### Windows::VersionHelper -Helper that allows you to get information of the windows version running on your node. It leverages windows ohai from kernel.os_info, easy to mock and to use even on linux. +Helper that allows you to get information on the windows version running on your node. It leverages windows ohai from kernel.os_info, easy to mock and to use even on Linux. #### core_version? -Determines whether given node is running on a windows Core. +Determines whether the given node is running on a Windows Core. ```ruby if ::Windows::VersionHelper.core_version? node @@ -450,7 +359,7 @@ end #### workstation_version? -Determines whether given node is a windows workstation version (XP, Vista, 7, 8, 8.1, 10) +Determines whether the given node is a windows workstation version (XP, Vista, 7, 8, 8.1, 10) ```ruby if ::Windows::VersionHelper.workstation_version? node @@ -460,7 +369,7 @@ end #### server_version? -Determines whether given node is a windows server version (Server 2003, Server 2008, Server 2012, Server 2016) +Determines whether the given node is a windows server version (Server 2003, Server 2008, Server 2012, Server 2016) ```ruby if ::Windows::VersionHelper.server_version? node diff --git a/cookbooks/windows/libraries/registry_helper.rb b/cookbooks/windows/libraries/registry_helper.rb index 3ca2254..172061d 100644 --- a/cookbooks/windows/libraries/registry_helper.rb +++ b/cookbooks/windows/libraries/registry_helper.rb @@ -66,7 +66,7 @@ module Windows }[hkey] unless hive - Chef::Application.fatal!("Unsupported registry hive '#{hive_name}'") + raise("Unsupported registry hive '#{hive_name}'") end Chef::Log.debug("Registry hive resolved to #{hkey}") @@ -229,9 +229,9 @@ module Windows begin hive.open(key, ::Win32::Registry::Constants::KEY_READ | @@native_registry_constant) - return true + true rescue - return false + false ensure ensure_hive_unloaded(hive_loaded) end @@ -241,9 +241,7 @@ module Windows reg_key = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\#{sid}" Chef::Log.debug("Looking for profile at #{reg_key}") if key_exists?(reg_key) - return get_value(reg_key, 'ProfileImagePath') - else - return nil + get_value(reg_key, 'ProfileImagePath') end end @@ -269,9 +267,9 @@ module Windows user_hive = path[0] if user_hive?(hive) - return key_exists?("#{hive_name}\\#{user_hive}") + key_exists?("#{hive_name}\\#{user_hive}") else - return true + true end end diff --git a/cookbooks/windows/libraries/windows_helper.rb b/cookbooks/windows/libraries/windows_helper.rb index 97ec431..5331576 100644 --- a/cookbooks/windows/libraries/windows_helper.rb +++ b/cookbooks/windows/libraries/windows_helper.rb @@ -162,4 +162,4 @@ module Windows end end -Chef::Recipe.send(:include, Windows::Helper) +Chef::Recipe.include Windows::Helper diff --git a/cookbooks/windows/metadata.json b/cookbooks/windows/metadata.json index 33a7cfd..4e7f067 100644 --- a/cookbooks/windows/metadata.json +++ b/cookbooks/windows/metadata.json @@ -1 +1 @@ -{"name":"windows","version":"6.0.0","description":"Provides a set of useful Windows-specific primitives.","long_description":"# Windows Cookbook\n\n[![Build status](https://ci.appveyor.com/api/projects/status/9x4uepmm1g4rktie/branch/master?svg=true)](https://ci.appveyor.com/project/ChefWindowsCookbooks/windows/branch/master) [![Cookbook Version](https://img.shields.io/cookbook/v/windows.svg)](https://supermarket.chef.io/cookbooks/windows)\n\nProvides a set of Windows-specific resources to aid in the creation of cookbooks/recipes targeting the Windows platform.\n\n## Requirements\n\n### Platforms\n\n- Windows 7\n- Windows Server 2008 R2\n- Windows 8, 8.1\n- Windows Server 2012 (R1, R2)\n- Windows Server 2016\n\n### Chef\n\n- Chef 14+\n\n## Resources\n\n### Deprecated Resources Note\n\nAs of Chef 14.7+ the windows_share and windows_certificate resources are now included in the Chef Client. If you are running Chef 14.7+ the resources in Chef client will take precedence over the resources in this cookbook. In November 2019 we will release a new major version of this cookbook that removes these resources.\n\n### windows_certificate\n\n`Note`: This resource is now included in Chef 14.7 and later. There is no need to depend on the Windows cookbook for this resource.\n\nInstalls a certificate into the Windows certificate store from a file, and grants read-only access to the private key for designated accounts. Due to current limitations in WinRM, installing certificated remotely may not work if the operation requires a user profile. Operations on the local machine store should still work.\n\n#### Actions\n\n- `:create` - creates or updates a certificate.\n- `:delete` - deletes a certificate.\n- `:acl_add` - adds read-only entries to a certificate's private key ACL.\n- `:verify` - logs whether or not a certificate is valid\n\n#### Properties\n\n- `source` - name attribute. The source file (for create and acl_add), thumbprint (for delete and acl_add) or subject (for delete).\n- `pfx_password` - the password to access the source if it is a pfx file.\n- `private_key_acl` - array of 'domain\\account' entries to be granted read-only access to the certificate's private key. This is not idempotent.\n- `store_name` - the certificate store to manipulate. One of:\n - MY (Personal)\n - CA (Intermediate Certification Authorities)\n - ROOT (Trusted Root Certification Authorities)\n - TRUSTEDPUBLISHER (Trusted Publishers)\n - CLIENTAUTHISSUER (Client Authentication Issuers)\n - REMOTE DESKTOP (Remote Desktop)\n - TRUSTEDDEVICES (Trusted Devices)\n - WEBHOSTING (Web Hosting)\n - AUTHROOT (Third-Party Root Certification Authorities)\n - TRUSTEDPEOPLE (Trusted People)\n - SMARTCARDROOT (Smart Card Trusted Roots)\n - TRUST (Enterprise Trust)\n - DISALLOWED (Untrusted Certificates)\n- `user_store` - if false (default) then use the local machine store; if true then use the current user's store.\n\n#### Examples\n\n```ruby\n# Add PFX cert to local machine personal store and grant accounts read-only access to private key\nwindows_certificate \"c:/test/mycert.pfx\" do\n pfx_password \"password\"\n private_key_acl [\"acme\\fred\", \"pc\\jane\"]\nend\n```\n\n```ruby\n# Add cert to trusted intermediate store\nwindows_certificate \"c:/test/mycert.cer\" do\n store_name \"CA\"\nend\n```\n\n```ruby\n# Remove all certificates matching the subject\nwindows_certificate \"me.acme.com\" do\n action :delete\nend\n```\n\n### windows_certificate_binding\n\nBinds a certificate to an HTTP port in order to enable TLS communication.\n\n#### Actions\n\n- `:create` - creates or updates a binding.\n- `:delete` - deletes a binding.\n\n#### Properties\n\n- `cert_name` - name attribute. The thumbprint(hash) or subject that identifies the certificate to be bound.\n- `name_kind` - indicates the type of cert_name. One of :subject (default) or :hash.\n- `address` - the address to bind against. Default is 0.0.0.0 (all IP addresses). One of:\n - IP v4 address `1.2.3.4`\n - IP v6 address `[::1]`\n - Host name `www.foo.com`\n- `port` - the port to bind against. Default is 443.\n- `app_id` - the GUID that defines the application that owns the binding. Default is the values used by IIS.\n- `store_name` - the store to locate the certificate in. One of:\n - MY (Personal)\n - CA (Intermediate Certification Authorities)\n - ROOT (Trusted Root Certification Authorities)\n - TRUSTEDPUBLISHER (Trusted Publishers)\n - CLIENTAUTHISSUER (Client Authentication Issuers)\n - REMOTE DESKTOP (Remote Desktop)\n - TRUSTEDDEVICES (Trusted Devices)\n - WEBHOSTING (Web Hosting)\n - AUTHROOT (Third-Party Root Certification Authorities)\n - TRUSTEDPEOPLE (Trusted People)\n - SMARTCARDROOT (Smart Card Trusted Roots)\n - TRUST (Enterprise Trust)\n\n#### Examples\n\n```ruby\n# Bind the first certificate matching the subject to the default TLS port\nwindows_certificate_binding \"me.acme.com\" do\nend\n```\n\n```ruby\n# Bind a cert from the CA store with the given hash to port 4334\nwindows_certificate_binding \"me.acme.com\" do\n cert_name \"d234567890a23f567c901e345bc8901d34567890\"\n name_kind :hash\n store_name \"CA\"\n port 4334\nend\n```\n\n### windows_dns\n\nConfigures A and CNAME records in Windows DNS. This requires the DNSCMD to be installed, which is done by adding the DNS role to the server or installing the Remote Server Admin Tools.\n\n#### Actions\n\n- :create: creates/updates the DNS entry\n- :delete: deletes the DNS entry\n\n#### Properties\n\n- host_name: name attribute. FQDN of the entry to act on.\n- dns_server: the DNS server to update. Default is local machine (.)\n- record_type: the type of record to create. One of A (default) or CNAME\n- target: for A records an array of IP addresses to associate with the host; for CNAME records the FQDN of the host to alias\n- ttl: if > 0 then set the time to live of the record\n\n#### Examples\n\n```ruby\n# Create A record linked to 2 addresses with a 10 minute ttl\nwindows_dns \"m1.chef.test\" do\n target ['10.9.8.7', '1.2.3.4']\n ttl 600\nend\n```\n\n```ruby\n# Delete records. target is mandatory although not used\nwindows_dns \"m1.chef.test\" do\n action :delete\n target []\nend\n```\n\n```ruby\n# Set an alias against the node in a role\nnodes = search( :node, \"role:my_service\" )\nwindows_dns \"myservice.chef.test\" do\n record_type 'CNAME'\n target nodes[0]['fqdn']\nend\n```\n\n### windows_http_acl\n\nSets the Access Control List for an http URL to grant non-admin accounts permission to open HTTP endpoints.\n\n#### Actions\n\n- `:create` - creates or updates the ACL for a URL.\n- `:delete` - deletes the ACL from a URL.\n\n#### Properties\n\n- `url` - the name of the url to be created/deleted.\n- `sddl` - the DACL string configuring all permissions to URL. Mandatory for create if user is not provided. Can't be use with `user`.\n- `user` - the name (domain\\user) of the user or group to be granted permission to the URL. Mandatory for create if sddl is not provided. Can't be use with `sddl`. Only one user or group can be granted permission so this replaces any previously defined entry. If you receive a parameter error your user may not exist.\n\n#### Examples\n\n```ruby\nwindows_http_acl 'http://+:50051/' do\n user 'pc\\\\fred'\nend\n```\n\n```ruby\n# Grant access to users \"NT SERVICE\\WinRM\" and \"NT SERVICE\\Wecsvc\" via sddl\nwindows_http_acl 'http://+:5985/' do\n sddl 'D:(A;;GX;;;S-1-5-80-569256582-2953403351-2909559716-1301513147-412116970)(A;;GX;;;S-1-5-80-4059739203-877974739-1245631912-527174227-2996563517)'\nend\n```\n\n```ruby\nwindows_http_acl 'http://+:50051/' do\n action :delete\nend\n```\n\n### windows_share\n\n`Note`: This resource is now included in Chef 14.7 and later. There is no need to depend on the Windows cookbook for this resource.\n\nCreates, modifies and removes Windows shares. All properties are idempotent.\n\n`Note`: This resource uses PowerShell cmdlets introduced in Windows 2012/8.\n\n#### Actions\n\n- `:create`: creates/modifies a share\n- `:delete`: deletes a share\n\n#### Properties\n\nproperty | type | default | description\n------------------------ | ---------- | ------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------\n`share_name` | String | resource name | the share to assign to the share\n`path` | String | | The path of the location of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created.\n`description` | String | | description to be applied to the share\n`full_users` | Array | [] | users which should have \"Full control\" permissions\n`change_users` | Array | [] | Users are granted modify permission to access the share.\n`read_users` | Array | [] | users which should have \"Read\" permissions\n`temporary` | True/False | false | The lifetime of the new SMB share. A temporary share does not persist beyond the next restart of the computer\n`scope_name` | String | '*' | The scope name of the share.\n`ca_timeout` | Integer | 0 | The continuous availability time-out for the share.\n`continuously_available` | True/False | false | Indicates that the share is continuously available.\n`concurrent_user_limit` | Integer | 0 (unlimited) | The maximum number of concurrently connected users the share can accommodate\n`encrypt_data` | True/False | false | Indicates that the share is encrypted.\n\n#### Examples\n\n```ruby\nwindows_share \"foo\" do\n action :create\n path \"C:\\\\foo\"\n full_users [\"DOMAIN_A\\\\some_user\", \"DOMAIN_B\\\\some_other_user\"]\n read_users [\"DOMAIN_C\\\\Domain users\"]\nend\n```\n\n```ruby\nwindows_share \"foo\" do\n action :delete\nend\n```\n\n### windows_user_privilege\n\nAdds the `principal` (User/Group) to the specified privileges (such as `Logon as a batch job` or `Logon as a Service`).\n\n#### Actions\n\n- `:add` - add the specified privileges to the `principal`\n- `:remove` - remove the specified privilege of the `principal`\n\n#### Properties\n\n- `principal` - Name attribute, Required, String. The user or group to be granted privileges.\n- `privilege` - Required, String/Array. The privilege(s) to be granted.\n\n#### Examples\n\nGrant the Administrator user the `Logon as a batch job` and `Logon as a service` privilege.\n\n```ruby\nwindows_user_privilege 'Administrator' do\n privilege %w(SeBatchLogonRight SeServiceLogonRight)\nend\n```\n\nRemove `Logon as a batch job` privilege of Administrator.\n\n```ruby\nwindows_user_privilege 'Administrator' do\n privilege %w(SeBatchLogonRight)\n action :remove\nend\n```\n\n#### Available Privileges\n\n```\nSeTrustedCredManAccessPrivilege Access Credential Manager as a trusted caller\nSeNetworkLogonRight Access this computer from the network\nSeTcbPrivilege Act as part of the operating system\nSeMachineAccountPrivilege Add workstations to domain\nSeIncreaseQuotaPrivilege Adjust memory quotas for a process\nSeInteractiveLogonRight Allow log on locally\nSeRemoteInteractiveLogonRight Allow log on through Remote Desktop Services\nSeBackupPrivilege Back up files and directories\nSeChangeNotifyPrivilege Bypass traverse checking\nSeSystemtimePrivilege Change the system time\nSeTimeZonePrivilege Change the time zone\nSeCreatePagefilePrivilege Create a pagefile\nSeCreateTokenPrivilege Create a token object\nSeCreateGlobalPrivilege Create global objects\nSeCreatePermanentPrivilege Create permanent shared objects\nSeCreateSymbolicLinkPrivilege Create symbolic links\nSeDebugPrivilege Debug programs\nSeDenyNetworkLogonRight Deny access this computer from the network\nSeDenyBatchLogonRight Deny log on as a batch job\nSeDenyServiceLogonRight Deny log on as a service\nSeDenyInteractiveLogonRight Deny log on locally\nSeDenyRemoteInteractiveLogonRight Deny log on through Remote Desktop Services\nSeEnableDelegationPrivilege Enable computer and user accounts to be trusted for delegation\nSeRemoteShutdownPrivilege Force shutdown from a remote system\nSeAuditPrivilege Generate security audits\nSeImpersonatePrivilege Impersonate a client after authentication\nSeIncreaseWorkingSetPrivilege Increase a process working set\nSeIncreaseBasePriorityPrivilege Increase scheduling priority\nSeLoadDriverPrivilege Load and unload device drivers\nSeLockMemoryPrivilege Lock pages in memory\nSeBatchLogonRight Log on as a batch job\nSeServiceLogonRight Log on as a service\nSeSecurityPrivilege Manage auditing and security log\nSeRelabelPrivilege Modify an object label\nSeSystemEnvironmentPrivilege Modify firmware environment values\nSeManageVolumePrivilege Perform volume maintenance tasks\nSeProfileSingleProcessPrivilege Profile single process\nSeSystemProfilePrivilege Profile system performance\nSeUnsolicitedInputPrivilege \"Read unsolicited input from a terminal device\"\nSeUndockPrivilege Remove computer from docking station\nSeAssignPrimaryTokenPrivilege Replace a process level token\nSeRestorePrivilege Restore files and directories\nSeShutdownPrivilege Shut down the system\nSeSyncAgentPrivilege Synchronize directory service data\nSeTakeOwnershipPrivilege Take ownership of files or other objects\n```\n\n### windows_zipfile\n\nMost version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken every Chef run.\n\n#### Actions\n\n- `:unzip` - unzip a compressed file\n- `:zip` - zip a directory (recursively)\n\n#### Properties\n\n- `path` - name attribute. The path where files will be (un)zipped to.\n- `source` - source of the zip file (either a URI or local path) for :unzip, or directory to be zipped for :zip.\n- `overwrite` - force an overwrite of the files if they already exist.\n- `checksum` - for :unzip, useful if source is remote, if the local file matches the SHA-256 checksum, Chef will not download it.\n\n#### Examples\n\nUnzip a remote zip file locally\n\n```ruby\nwindows_zipfile 'c:/bin' do\n source 'http://download.sysinternals.com/Files/SysinternalsSuite.zip'\n action :unzip\n not_if {::File.exists?('c:/bin/PsExec.exe')}\nend\n```\n\nUnzip a local zipfile\n\n```ruby\nwindows_zipfile 'c:/the_codez' do\n source 'c:/foo/baz/the_codez.zip'\n action :unzip\nend\n```\n\nCreate a local zipfile\n\n```ruby\nwindows_zipfile 'c:/foo/baz/the_codez.zip' do\n source 'c:/the_codez'\n action :zip\nend\n```\n\n## Libraries\n\n### WindowsHelper\n\nHelper that allows you to use helpful functions in windows\n\n#### installed_packages\n\nReturns a hash of all DisplayNames installed\n\n```ruby\n# usage in a recipe\n::Chef::Recipe.send(:include, Windows::Helper)\nhash_of_installed_packages = installed_packages\n```\n\n#### is_package_installed?\n\n- `package_name` - The name of the package you want to query to see if it is installed\n- `returns` - true if the package is installed, false if it the package is not installed\n\nDownload a file if a package isn't installed\n\n```ruby\n# usage in a recipe to not download a file if package is already installed\n::Chef::Recipe.send(:include, Windows::Helper)\nis_win_sdk_installed = is_package_installed?('Windows Software Development Kit')\n\nremote_file 'C:\\windows\\temp\\windows_sdk.zip' do\n source 'http://url_to_download/windows_sdk.zip'\n action :create_if_missing\n not_if {is_win_sdk_installed}\nend\n```\n\nDo something if a package is installed\n\n```ruby\n# usage in a provider\ninclude Windows::Helper\nif is_package_installed?('Windows Software Development Kit')\n # do something if package is installed\nend\n```\n\n### Windows::VersionHelper\n\nHelper that allows you to get information of the windows version running on your node. It leverages windows ohai from kernel.os_info, easy to mock and to use even on linux.\n\n#### core_version?\n\nDetermines whether given node is running on a windows Core.\n\n```ruby\nif ::Windows::VersionHelper.core_version? node\n fail 'Windows Core is not supported'\nend\n```\n\n#### workstation_version?\n\nDetermines whether given node is a windows workstation version (XP, Vista, 7, 8, 8.1, 10)\n\n```ruby\nif ::Windows::VersionHelper.workstation_version? node\n fail 'Only server version of windows are supported'\nend\n```\n\n#### server_version?\n\nDetermines whether given node is a windows server version (Server 2003, Server 2008, Server 2012, Server 2016)\n\n```ruby\nif ::Windows::VersionHelper.server_version? node\n puts 'Server version of windows are cool'\nend\n```\n\n#### nt_version\n\nDetermines NT version of the given node\n\n```ruby\ncase ::Windows::VersionHelper.nt_version node\n when '6.0' then 'Windows vista or Server 2008'\n when '6.1' then 'Windows 7 or Server 2008R2'\n when '6.2' then 'Windows 8 or Server 2012'\n when '6.3' then 'Windows 8.1 or Server 2012R2'\n when '10.0' then 'Windows 10'\nend\n```\n\n## Usage\n\nPlace an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook.\n\n```ruby\ndepends 'windows'\n```\n\n## License & Authors\n\n- Author:: Seth Chisamore ([schisamo@chef.io](mailto:schisamo@chef.io))\n- Author:: Doug MacEachern ([dougm@vmware.com](mailto:dougm@vmware.com))\n- Author:: Paul Morton ([pmorton@biaprotect.com](mailto:pmorton@biaprotect.com))\n- Author:: Doug Ireton ([doug.ireton@nordstrom.com](mailto:doug.ireton@nordstrom.com))\n\n```text\nCopyright 2011-2018, Chef Software, Inc.\nCopyright 2010, VMware, Inc.\nCopyright 2011, Business Intelligence Associates, Inc\nCopyright 2012, Nordstrom, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"windows":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/windows","issues_url":"https://github.com/chef-cookbooks/windows/issues","chef_version":[[">= 14"]],"ohai_version":[]} \ No newline at end of file +{"name":"windows","version":"7.0.2","description":"Provides a set of useful Windows-specific primitives.","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"windows":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/windows","issues_url":"https://github.com/chef-cookbooks/windows/issues","chef_version":[[">= 14.7"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/windows/metadata.rb b/cookbooks/windows/metadata.rb index f65f147..a29d628 100644 --- a/cookbooks/windows/metadata.rb +++ b/cookbooks/windows/metadata.rb @@ -3,9 +3,8 @@ maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' license 'Apache-2.0' description 'Provides a set of useful Windows-specific primitives.' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '6.0.0' +version '7.0.2' supports 'windows' source_url 'https://github.com/chef-cookbooks/windows' issues_url 'https://github.com/chef-cookbooks/windows/issues' -chef_version '>= 14' +chef_version '>= 14.7' diff --git a/cookbooks/windows/providers/dns.rb b/cookbooks/windows/providers/dns.rb index f6a8b31..fae9858 100644 --- a/cookbooks/windows/providers/dns.rb +++ b/cookbooks/windows/providers/dns.rb @@ -23,11 +23,6 @@ include Windows::Helper -# Support whyrun -def whyrun_supported? - true -end - action :create do if @current_resource.exists needs_change = (@new_resource.record_type != @current_resource.record_type) || diff --git a/cookbooks/windows/resources/certificate.rb b/cookbooks/windows/resources/certificate.rb deleted file mode 100644 index 4003fbb..0000000 --- a/cookbooks/windows/resources/certificate.rb +++ /dev/null @@ -1,301 +0,0 @@ -# -# Author:: Richard Lavey (richard.lavey@calastone.com) -# Cookbook:: windows -# Resource:: certificate -# -# Copyright:: 2015-2017, Calastone Ltd. -# Copyright:: 2018-2019, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'chef/util/path_helper' - -chef_version_for_provides '< 14.7' if respond_to?(:chef_version_for_provides) -resource_name :windows_certificate - -property :source, String, name_property: true -property :pfx_password, String -property :private_key_acl, Array -property :store_name, String, default: 'MY', equal_to: ['TRUSTEDPUBLISHER', 'TrustedPublisher', 'CLIENTAUTHISSUER', 'REMOTE DESKTOP', 'ROOT', 'TRUSTEDDEVICES', 'WEBHOSTING', 'CA', 'AUTHROOT', 'TRUSTEDPEOPLE', 'MY', 'SMARTCARDROOT', 'TRUST', 'DISALLOWED'] -property :user_store, [TrueClass, FalseClass], default: false -property :cert_path, String -property :sensitive, [ TrueClass, FalseClass ], default: lazy { |r| r.pfx_password ? true : false } - -action :create do - load_gem - - # Extension of the certificate - ext = ::File.extname(new_resource.source) - cert_obj = fetch_cert_object(ext) # Fetch OpenSSL::X509::Certificate object - thumbprint = OpenSSL::Digest::SHA1.new(cert_obj.to_der).to_s # Fetch its thumbprint - - # Need to check if return value is Boolean:true - # If not then the given certificate should be added in certstore - if verify_cert(thumbprint) == true - Chef::Log.debug('Certificate is already present') - else - converge_by("Adding certificate #{new_resource.source} into Store #{new_resource.store_name}") do - if ext == '.pfx' - add_pfx_cert - else - add_cert(cert_obj) - end - end - end -end - -# acl_add is a modify-if-exists operation : not idempotent -action :acl_add do - if ::File.exist?(new_resource.source) - hash = '$cert.GetCertHashString()' - code_script = cert_script(false) - guard_script = cert_script(false) - else - # make sure we have no spaces in the hash string - hash = "\"#{new_resource.source.gsub(/\s/, '')}\"" - code_script = '' - guard_script = '' - end - code_script << acl_script(hash) - guard_script << cert_exists_script(hash) - - powershell_script "setting the acls on #{new_resource.source} in #{cert_location}\\#{new_resource.store_name}" do - guard_interpreter :powershell_script - convert_boolean_return true - code code_script - only_if guard_script - sensitive if new_resource.sensitive - end -end - -action :delete do - load_gem - - cert_obj = fetch_cert - if cert_obj - converge_by("Deleting certificate #{new_resource.source} from Store #{new_resource.store_name}") do - delete_cert - end - else - Chef::Log.debug('Certificate not found') - end -end - -action :fetch do - load_gem - - cert_obj = fetch_cert - if cert_obj - show_or_store_cert(cert_obj) - else - Chef::Log.debug('Certificate not found') - end -end - -action :verify do - load_gem - - out = verify_cert - if !!out == out - out = out ? 'Certificate is valid' : 'Certificate not valid' - end - Chef::Log.info(out.to_s) -end - -action_class do - require 'openssl' - - # load the gem and rescue a gem install if it fails to load - def load_gem - gem 'win32-certstore', '>= 0.2.4' - require 'win32-certstore' # until this is in core chef - rescue LoadError - Chef::Log.debug('Did not find win32-certstore >= 0.2.4 gem installed. Installing now') - chef_gem 'win32-certstore' do - compile_time true - action :upgrade - end - - require 'win32-certstore' - end - - def add_cert(cert_obj) - store = ::Win32::Certstore.open(new_resource.store_name) - store.add(cert_obj) - end - - def add_pfx_cert - store = ::Win32::Certstore.open(new_resource.store_name) - store.add_pfx(new_resource.source, new_resource.pfx_password) - end - - def delete_cert - store = ::Win32::Certstore.open(new_resource.store_name) - store.delete(new_resource.source) - end - - def fetch_cert - store = ::Win32::Certstore.open(new_resource.store_name) - store.get(new_resource.source) - end - - # Checks whether a certificate with the given thumbprint - # is already present and valid in certificate store - # If the certificate is not present, verify_cert returns a String: "Certificate not found" - # But if it is present but expired, it returns a Boolean: false - # Otherwise, it returns a Boolean: true - def verify_cert(thumbprint = new_resource.source) - store = ::Win32::Certstore.open(new_resource.store_name) - store.valid?(thumbprint) - end - - def show_or_store_cert(cert_obj) - if new_resource.cert_path - export_cert(cert_obj, new_resource.cert_path) - if ::File.size(new_resource.cert_path) > 0 - Chef::Log.info("Certificate export in #{new_resource.cert_path}") - else - ::File.delete(new_resource.cert_path) - end - else - Chef::Log.info(cert_obj.display) - end - end - - def export_cert(cert_obj, cert_path) - out_file = ::File.new(cert_path, 'w+') - case ::File.extname(cert_path) - when '.pem' - out_file.puts(cert_obj.to_pem) - when '.der' - out_file.puts(cert_obj.to_der) - when '.cer' - cert_out = powershell_out("openssl x509 -text -inform DER -in #{cert_obj.to_pem} -outform CER").stdout - out_file.puts(cert_out) - when '.crt' - cert_out = powershell_out("openssl x509 -text -inform DER -in #{cert_obj.to_pem} -outform CRT").stdout - out_file.puts(cert_out) - when '.pfx' - cert_out = powershell_out("openssl pkcs12 -export -nokeys -in #{cert_obj.to_pem} -outform PFX").stdout - out_file.puts(cert_out) - when '.p7b' - cert_out = powershell_out("openssl pkcs7 -export -nokeys -in #{cert_obj.to_pem} -outform P7B").stdout - out_file.puts(cert_out) - else - Chef::Log.info('Supported certificate format .pem, .der, .cer, .crt, .pfx and .p7b') - end - out_file.close - end - - def cert_location - @location ||= new_resource.user_store ? 'CurrentUser' : 'LocalMachine' - end - - def cert_script(persist) - cert_script = '$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2' - file = Chef::Util::PathHelper.cleanpath(new_resource.source) - cert_script << " \"#{file}\"" - if ::File.extname(file.downcase) == '.pfx' - cert_script << ", \"#{new_resource.pfx_password}\"" - if persist && new_resource.user_store - cert_script << ', ([System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet)' - elsif persist - cert_script << ', ([System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet -bor [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::MachineKeyset)' - end - end - cert_script << "\n" - end - - def cert_exists_script(hash) - <<-EOH -$hash = #{hash} -Test-Path "Cert:\\#{cert_location}\\#{new_resource.store_name}\\$hash" - EOH - end - - def within_store_script - inner_script = yield '$store' - <<-EOH -$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "#{new_resource.store_name}", ([System.Security.Cryptography.X509Certificates.StoreLocation]::#{cert_location}) -$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) -#{inner_script} -$store.Close() - EOH - end - - def acl_script(hash) - return '' if new_resource.private_key_acl.nil? || new_resource.private_key_acl.empty? - - # this PS came from http://blogs.technet.com/b/operationsguy/archive/2010/11/29/provide-access-to-private-keys-commandline-vs-powershell.aspx - # and from https://msdn.microsoft.com/en-us/library/windows/desktop/bb204778(v=vs.85).aspx - set_acl_script = <<-EOH -$hash = #{hash} -$storeCert = Get-ChildItem "cert:\\#{cert_location}\\#{new_resource.store_name}\\$hash" -if ($storeCert -eq $null) { throw 'no key exists.' } -$keyname = $storeCert.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName -if ($keyname -eq $null) { throw 'no private key exists.' } -if ($storeCert.PrivateKey.CspKeyContainerInfo.MachineKeyStore) -{ - $fullpath = "$Env:ProgramData\\Microsoft\\Crypto\\RSA\\MachineKeys\\$keyname" -} -else -{ - $currentUser = New-Object System.Security.Principal.NTAccount($Env:UserDomain, $Env:UserName) - $userSID = $currentUser.Translate([System.Security.Principal.SecurityIdentifier]).Value - $fullpath = "$Env:ProgramData\\Microsoft\\Crypto\\RSA\\$userSID\\$keyname" -} - EOH - new_resource.private_key_acl.each do |name| - set_acl_script << "$uname='#{name}'; icacls $fullpath /grant $uname`:RX\n" - end - set_acl_script - end - - # Method returns an OpenSSL::X509::Certificate object - # - # Based on its extension, the certificate contents are used to initialize - # PKCS12 (PFX), PKCS7 (P7B) objects which contains OpenSSL::X509::Certificate. - # - # @note Other then PEM, all the certificates are usually in binary format, and hence - # their contents are loaded by using File.binread - # - # @param ext [String] Extension of the certificate - # - # @return [OpenSSL::X509::Certificate] Object containing certificate's attributes - # - # @raise [OpenSSL::PKCS12::PKCS12Error] When incorrect password is provided for PFX certificate - # - def fetch_cert_object(ext) - contents = if binary_cert? - ::File.binread(new_resource.source) - else - ::File.read(new_resource.source) - end - - case ext - when '.pfx' - OpenSSL::PKCS12.new(contents, new_resource.pfx_password).certificate - when '.p7b' - OpenSSL::PKCS7.new(contents).certificates.first - else - OpenSSL::X509::Certificate.new(contents) - end - end - - # @return [Boolean] Whether the certificate file is binary encoded or not - # - def binary_cert? - powershell_out!("file -b --mime-encoding #{new_resource.source}").stdout.strip == 'binary' - end -end diff --git a/cookbooks/windows/resources/certificate_binding.rb b/cookbooks/windows/resources/certificate_binding.rb index df0aa44..5d908ec 100644 --- a/cookbooks/windows/resources/certificate_binding.rb +++ b/cookbooks/windows/resources/certificate_binding.rb @@ -19,7 +19,6 @@ # limitations under the License. # -include Chef::Mixin::PowershellOut include Windows::Helper property :cert_name, String, name_property: true @@ -28,7 +27,7 @@ property :address, String, default: '0.0.0.0' property :port, Integer, default: 443 property :app_id, String, default: '{4dc3e181-e14b-4a21-b022-59fc669b0914}' property :store_name, String, default: 'MY', equal_to: ['TRUSTEDPUBLISHER', 'CLIENTAUTHISSUER', 'REMOTE DESKTOP', 'ROOT', 'TRUSTEDDEVICES', 'WEBHOSTING', 'CA', 'AUTHROOT', 'TRUSTEDPEOPLE', 'MY', 'SMARTCARDROOT', 'TRUST'] -property :exists, [true, false], desired_state: true +property :exists, [true, false] load_current_value do |desired| mode = desired.address.match(/(\d+\.){3}\d+|\[.+\]/).nil? ? 'hostnameport' : 'ipport' diff --git a/cookbooks/windows/resources/dns.rb b/cookbooks/windows/resources/dns.rb index 35b0274..30149d4 100644 --- a/cookbooks/windows/resources/dns.rb +++ b/cookbooks/windows/resources/dns.rb @@ -1,6 +1,6 @@ # # Author:: Richard Lavey (richard.lavey@calastone.com) -# Cookbook Name:: windows +# Cookbook:: windows # Resource:: dns # # Copyright:: 2015, Calastone Ltd. @@ -18,10 +18,9 @@ # limitations under the License. # -actions :create, :delete default_action :create -attribute :host_name, kind_of: String, name_property: true, required: true +attribute :host_name, kind_of: String, required: true attribute :record_type, kind_of: String, default: 'A', regex: /^(?:A|CNAME)$/ attribute :dns_server, kind_of: String, default: '.' attribute :target, kind_of: [Array, String], required: true diff --git a/cookbooks/windows/resources/http_acl.rb b/cookbooks/windows/resources/http_acl.rb index c675043..b78f126 100644 --- a/cookbooks/windows/resources/http_acl.rb +++ b/cookbooks/windows/resources/http_acl.rb @@ -23,7 +23,7 @@ include Windows::Helper property :url, String, name_property: true property :user, String property :sddl, String -property :exists, [true, false], desired_state: true +property :exists, [true, false] # See https://msdn.microsoft.com/en-us/library/windows/desktop/cc307236%28v=vs.85%29.aspx for netsh info diff --git a/cookbooks/windows/resources/schannel.rb b/cookbooks/windows/resources/schannel.rb new file mode 100644 index 0000000..d608601 --- /dev/null +++ b/cookbooks/windows/resources/schannel.rb @@ -0,0 +1,39 @@ +# +# Author:: Jason Field (jason.field@calastone.com) +# Cookbook:: windows +# Resource:: schannel +# +# Copyright:: 2019, Calastone Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +property :use_strong_crypto, [true, false], default: true + +action :configure do + registry_key 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\.NETFramework\\v4.0.30319' do + values [{ + name: 'SchUseStrongCrypto', + type: :dword, + data: new_resource.use_strong_crypto ? 1 : 0, + }] + end + + registry_key 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\.NETFramework\\v4.0.30319' do + values [{ + name: 'SchUseStrongCrypto', + type: :dword, + data: new_resource.use_strong_crypto ? 1 : 0, + }] + end +end diff --git a/cookbooks/windows/resources/share.rb b/cookbooks/windows/resources/share.rb deleted file mode 100644 index 9e5196b..0000000 --- a/cookbooks/windows/resources/share.rb +++ /dev/null @@ -1,288 +0,0 @@ -# -# Author:: Sölvi Páll Ásgeirsson () -# Author:: Richard Lavey (richard.lavey@calastone.com) -# Author:: Tim Smith (tsmith@chef.io) -# Cookbook:: windows -# Resource:: share -# -# Copyright:: 2014-2017, Sölvi Páll Ásgeirsson. -# Copyright:: 2018, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -chef_version_for_provides '< 14.7' if respond_to?(:chef_version_for_provides) -resource_name :windows_share - -require 'chef/json_compat' -require 'chef/util/path_helper' - -# Specifies a name for the SMB share. The name may be composed of any valid file name characters, but must be less than 80 characters long. The names pipe and mailslot are reserved for use by the computer. -property :share_name, String, name_property: true - -# Specifies the path of the location of the folder to share. The path must be fully qualified. Relative paths or paths that contain wildcard characters are not permitted. -property :path, String - -# Specifies an optional description of the SMB share. A description of the share is displayed by running the Get-SmbShare cmdlet. The description may not contain more than 256 characters. -property :description, String, default: '' - -# Specifies which accounts are granted full permission to access the share. Use a comma-separated list to specify multiple accounts. An account may not be specified more than once in the FullAccess, ChangeAccess, or ReadAccess parameter lists, but may be specified once in the FullAccess, ChangeAccess, or ReadAccess parameter list and once in the NoAccess parameter list. -property :full_users, Array, default: [], coerce: proc { |u| u.sort } - -# Specifies which users are granted modify permission to access the share -property :change_users, Array, default: [], coerce: proc { |u| u.sort } - -# Specifies which users are granted read permission to access the share. Multiple users can be specified by supplying a comma-separated list. -property :read_users, Array, default: [], coerce: proc { |u| u.sort } - -# Specifies the lifetime of the new SMB share. A temporary share does not persist beyond the next restart of the computer. By default, new SMB shares are persistent, and non-temporary. -property :temporary, [true, false], default: false - -# Specifies the scope name of the share. -property :scope_name, String, default: '*' - -# Specifies the continuous availability time-out for the share. -property :ca_timeout, Integer, default: 0 - -# Indicates that the share is continuously available. -property :continuously_available, [true, false], default: false - -# Specifies the caching mode of the offline files for the SMB share. -# property :caching_mode, String, equal_to: %w(None Manual Documents Programs BranchCache) - -# Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. -property :concurrent_user_limit, Integer, default: 0 - -# Indicates that the share is encrypted. -property :encrypt_data, [true, false], default: false - -# Specifies which files and folders in the SMB share are visible to users. AccessBased: SMB does not the display the files and folders for a share to a user unless that user has rights to access the files and folders. By default, access-based enumeration is disabled for new SMB shares. Unrestricted: SMB displays files and folders to a user even when the user does not have permission to access the items. -# property :folder_enumeration_mode, String, equal_to: %(AccessBased Unrestricted) - -include Chef::Mixin::PowershellOut - -load_current_value do |desired| - # this command selects individual objects because EncryptData & CachingMode have underlying - # types that get converted to their Integer values by ConvertTo-Json & we need to make sure - # those get written out as strings - share_state_cmd = "Get-SmbShare -Name '#{desired.share_name}' | Select-Object Name,Path, Description, Temporary, CATimeout, ContinuouslyAvailable, ConcurrentUserLimit, EncryptData | ConvertTo-Json" - - Chef::Log.debug("Running '#{share_state_cmd}' to determine share state'") - ps_results = powershell_out(share_state_cmd) - - # detect a failure without raising and then set current_resource to nil - if ps_results.error? - Chef::Log.debug("Error fetching share state: #{ps_results.stderr}") - current_value_does_not_exist! - end - - Chef::Log.debug("The Get-SmbShare results were #{ps_results.stdout}") - results = Chef::JSONCompat.from_json(ps_results.stdout) - - path results['Path'] - description results['Description'] - temporary results['Temporary'] - ca_timeout results['CATimeout'] - continuously_available results['ContinuouslyAvailable'] - # caching_mode results['CachingMode'] - concurrent_user_limit results['ConcurrentUserLimit'] - encrypt_data results['EncryptData'] - # folder_enumeration_mode results['FolderEnumerationMode'] - - perm_state_cmd = %(Get-SmbShareAccess -Name "#{desired.share_name}" | Select-Object AccountName,AccessControlType,AccessRight | ConvertTo-Json) - - Chef::Log.debug("Running '#{perm_state_cmd}' to determine share permissions state'") - ps_perm_results = powershell_out(perm_state_cmd) - - # we raise here instead of warning like above because we'd only get here if the above Get-SmbShare - # command was successful and that continuing would leave us with 1/2 known state - raise "Could not determine #{desired.share_name} share permissions by running '#{perm_state_cmd}'" if ps_perm_results.error? - - Chef::Log.debug("The Get-SmbShareAccess results were #{ps_perm_results.stdout}") - - f_users, c_users, r_users = parse_permissions(ps_perm_results.stdout) - - full_users f_users - change_users c_users - read_users r_users -end - -def after_created - raise 'The windows_share resource relies on PowerShell cmdlets not present in Windows releases prior to 8/2012. Cannot continue!' if node['platform_version'].to_f < 6.3 -end - -# given the string output of Get-SmbShareAccess parse out -# arrays of full access users, change users, and read only users -def parse_permissions(results_string) - json_results = Chef::JSONCompat.from_json(results_string) - json_results = [json_results] unless json_results.is_a?(Array) # single result is not an array - - f_users = [] - c_users = [] - r_users = [] - - json_results.each do |perm| - next unless perm['AccessControlType'] == 0 # allow - case perm['AccessRight'] - when 0 then f_users << stripped_account(perm['AccountName']) # 0 full control - when 1 then c_users << stripped_account(perm['AccountName']) # 1 == change - when 2 then r_users << stripped_account(perm['AccountName']) # 2 == read - end - end - [f_users, c_users, r_users] -end - -# local names are returned from Get-SmbShareAccess in the full format MACHINE\\NAME -# but users of this resource would simply say NAME so we need to strip the values for comparison -def stripped_account(name) - name.slice!("#{node['hostname']}\\") - name -end - -action :create do - # we do this here instead of requiring the property because :delete doesn't need path set - raise 'No path property set' unless new_resource.path - - converge_if_changed do - # you can't actually change the path so you have to delete the old share first - if different_path? - Chef::Log.debug('The path has changed so we will delete and recreate share') - delete_share - create_share - elsif current_resource.nil? - # powershell cmdlet for create is different than updates - Chef::Log.debug('The current resource is nil so we will create a new share') - create_share - else - Chef::Log.debug('The current resource was not nil so we will update an existing share') - update_share - end - - # creating the share does not set permissions so we need to update - update_permissions - end -end - -action :delete do - if current_resource.nil? - Chef::Log.debug("#{new_resource.share_name} does not exist - nothing to do") - else - converge_by("delete #{new_resource.share_name}") do - delete_share - end - end -end - -action_class do - def different_path? - return false if current_resource.nil? # going from nil to something isn't different for our concerns - return false if current_resource.path == Chef::Util::PathHelper.cleanpath(new_resource.path) - true - end - - def delete_share - delete_command = "Remove-SmbShare -Name '#{new_resource.share_name}' -Force" - - Chef::Log.debug("Running '#{delete_command}' to remove the share") - powershell_out!(delete_command) - end - - def update_share - update_command = "Set-SmbShare -Name '#{new_resource.share_name}' -Description '#{new_resource.description}' -Force" - - Chef::Log.debug("Running '#{update_command}' to update the share") - powershell_out!(update_command) - end - - def create_share - raise "#{new_resource.path} is missing or not a directory. Shares cannot be created if the path doesn't first exist." unless ::File.directory? new_resource.path - - share_cmd = "New-SmbShare -Name '#{new_resource.share_name}' -Path '#{Chef::Util::PathHelper.cleanpath(new_resource.path)}' -Description '#{new_resource.description}' -ConcurrentUserLimit #{new_resource.concurrent_user_limit} -CATimeout #{new_resource.ca_timeout} -EncryptData:#{bool_string(new_resource.encrypt_data)} -ContinuouslyAvailable:#{bool_string(new_resource.continuously_available)}" - share_cmd << " -ScopeName #{new_resource.scope_name}" unless new_resource.scope_name == '*' # passing * causes the command to fail - share_cmd << " -Temporary:#{bool_string(new_resource.temporary)}" if new_resource.temporary # only set true - - Chef::Log.debug("Running '#{share_cmd}' to create the share") - powershell_out!(share_cmd) - - # New-SmbShare adds the "Everyone" user with read access no matter what so we need to remove it - # before we add our permissions - revoke_user_permissions(['Everyone']) - end - - # determine what users in the current state don't exist in the desired state - # users/groups will have their permissions updated with the same command that - # sets it, but removes must be performed with Revoke-SmbShareAccess - def users_to_revoke - @users_to_revoke ||= begin - # if the resource doesn't exist then nothing needs to be revoked - if current_resource.nil? - [] - else # if it exists then calculate the current to new resource diffs - (current_resource.full_users + current_resource.change_users + current_resource.read_users) - (new_resource.full_users + new_resource.change_users + new_resource.read_users) - end - end - end - - # update existing permissions on a share - def update_permissions - # revoke any users that had something, but now has nothing - revoke_user_permissions(users_to_revoke) unless users_to_revoke.empty? - - # set permissions for each of the permission types - %w(full read change).each do |perm_type| - # set permissions for a brand new share OR - # update permissions if the current state and desired state differ - next unless permissions_need_update?(perm_type) - grant_command = "Grant-SmbShareAccess -Name '#{new_resource.share_name}' -AccountName \"#{new_resource.send("#{perm_type}_users").join('","')}\" -Force -AccessRight #{perm_type}" - - Chef::Log.debug("Running '#{grant_command}' to update the share permissions") - powershell_out!(grant_command) - end - end - - # determine if permissions need to be updated. - # Brand new share with no permissions defined: no - # Brand new share with permissions defined: yes - # Existing share with differing permissions: yes - # - # @param [String] type the permissions type (Full, Read, or Change) - def permissions_need_update?(type) - property_name = "#{type}_users" - - # brand new share, but nothing to set - return false if current_resource.nil? && new_resource.send(property_name).empty? - - # brand new share with new permissions to set - return true if current_resource.nil? && !new_resource.send(property_name).empty? - - # there's a difference between the current and desired state - return true unless (new_resource.send(property_name) - current_resource.send(property_name)).empty? - - # anything else - false - end - - # revoke user permissions from a share - # @param [Array] users - def revoke_user_permissions(users) - revoke_command = "Revoke-SmbShareAccess -Name '#{new_resource.share_name}' -AccountName \"#{users.join('","')}\" -Force" - Chef::Log.debug("Running '#{revoke_command}' to revoke share permissions") - powershell_out!(revoke_command) - end - - # convert True/False into "$True" & "$False" - def bool_string(bool) - # bool ? 1 : 0 - bool ? '$true' : '$false' - end -end diff --git a/cookbooks/windows/resources/user_privilege.rb b/cookbooks/windows/resources/user_privilege.rb index 2264ded..e01888a 100644 --- a/cookbooks/windows/resources/user_privilege.rb +++ b/cookbooks/windows/resources/user_privilege.rb @@ -4,11 +4,13 @@ # Resource:: user_privilege # +chef_version_for_provides '< 16.0' if respond_to?(:chef_version_for_provides) + property :principal, String, name_property: true -property :privilege, [Array, String], required: true, coerce: proc { |v| [*v].sort } +property :privilege, [Array, String], required: true, coerce: proc { |v| Array(v).sort } action :add do - ([*new_resource.privilege] - [*current_resource.privilege]).each do |user_right| + new_resource.privilege - Array(current_resource.privilege).each do |user_right| converge_by("adding user privilege #{user_right}") do Chef::ReservedNames::Win32::Security.add_account_right(new_resource.principal, user_right) end diff --git a/cookbooks/windows/resources/zipfile.rb b/cookbooks/windows/resources/zipfile.rb index 424717b..f182b5a 100644 --- a/cookbooks/windows/resources/zipfile.rb +++ b/cookbooks/windows/resources/zipfile.rb @@ -116,6 +116,7 @@ action_class do def ensure_rubyzip_gem_installed require 'zip' + Chef::Log.warn('The windows_zipfile resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use the `archive_file` resource: https://docs.chef.io/resource_archive_file.html') rescue LoadError Chef::Log.info("Missing gem 'rubyzip'...installing now.") chef_gem 'rubyzip' do diff --git a/cookbooks/yum-epel/CHANGELOG.md b/cookbooks/yum-epel/CHANGELOG.md index 08b13d6..30780aa 100644 --- a/cookbooks/yum-epel/CHANGELOG.md +++ b/cookbooks/yum-epel/CHANGELOG.md @@ -2,6 +2,61 @@ This file is used to list changes made in each version of the yum-epel cookbook. +## 4.2.3 - *2021-11-03* + +- Rename helper method to `epel_8_repos` to not conflict with yum-centos + +## 4.2.2 - *2021-11-02* + +- Update documentation for epel on CentOS Stream + +## 4.2.1 - *2021-11-02* + +- Add epel and epel-debuginfo repos by default for CentOS Streams + +## 4.2.0 - *2021-11-02* + +- Add support for CentOS Stream 8 + +## 4.1.4 - *2021-08-30* + +- Standardise files with files in sous-chefs/repo-management + +## 4.1.3 - *2021-07-14* + +- Remove deprecated `failoverprorioty` setting + +## 4.1.2 - *2021-06-01* + +- Standardise files with files in sous-chefs/repo-management + +## 4.1.1 - *2021-01-24* + +- Fix support for Oracle Linux + +## 4.1.0 - *2021-01-14* + +- Sous Chefs Adoption + +## 4.0.1 (2021-01-04) + +- Return empty array on non-yum systems - [@ramereth](https://github.com/ramereth) + +## 4.0.0 (2020-12-15) + +- Cookstyle fixes - [@tas50](https://github.com/tas50) +- Switch all http URLs to HTTPS URLs - [@damacus](https://github.com/damacus) +- Switch gpgkey urls - [@knightorc](https://github.com/knightorc) +- Require Chef 12.15+ - [@tas50](https://github.com/tas50) +- Remove CentOS 6 / Amazon Linux 201X support/testing - [@ramereth](https://github.com/ramereth) +- Improve InSpec test by using yum.repo resource - [@ramereth](https://github.com/ramereth) +- Fix repo descriptions on Amazon Linux - [@ramereth](https://github.com/ramereth) +- Test all supported repos in new "all" suite - [@ramereth](https://github.com/ramereth) +- Ensure other epel repos are not enabled in default suite - [@ramereth](https://github.com/ramereth) +- Add various modular and playground repos for EL8 - [@ramereth](https://github.com/ramereth) +- Update README - [@ramereth](https://github.com/ramereth) +- Cleanup metadata.rb formatting - [@ramereth](https://github.com/ramereth) + ## 3.3.0 (2018-10-09) - Fix cookbook to work on all releases of Amazon Linux 2 diff --git a/cookbooks/yum-epel/CONTRIBUTING.md b/cookbooks/yum-epel/CONTRIBUTING.md deleted file mode 100644 index ef2f2b8..0000000 --- a/cookbooks/yum-epel/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD diff --git a/cookbooks/yum-epel/LICENSE b/cookbooks/yum-epel/LICENSE new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/cookbooks/yum-epel/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/cookbooks/yum-epel/README.md b/cookbooks/yum-epel/README.md index 734d106..bbd3312 100644 --- a/cookbooks/yum-epel/README.md +++ b/cookbooks/yum-epel/README.md @@ -1,10 +1,40 @@ # yum-epel Cookbook -[![Build Status](https://travis-ci.org/chef-cookbooks/yum-epel.svg?branch=master)](http://travis-ci.org/chef-cookbooks/yum-epel) [![Cookbook Version](https://img.shields.io/cookbook/v/yum-epel.svg)](https://supermarket.chef.io/cookbooks/yum-epel) +[![Cookbook Version](https://img.shields.io/cookbook/v/yum-epel.svg)](https://supermarket.chef.io/cookbooks/yum-epel) +[![CI State](https://github.com/sous-chefs/yum-epel/workflows/ci/badge.svg)](https://github.com/sous-chefs/yum-epel/actions?query=workflow%3Aci) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL). +Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS , CentOS Stream and Scientific Linux (SL), Oracle Linux (OL). -The yum-epel cookbook takes over management of the default repositoryids shipped with epel-release. It allows attribute manipulation of `epel`, `epel-debuginfo`, `epel-source`, `epel-testing`, `epel-testing-debuginfo`, and `epel-testing-source`. +The yum-epel cookbook takes over management of the default repositoryids shipped with epel-release. + +Below is a table showing which repositoryids we manage that are shipped by default via the epel-release package: + +| Repo ID | EL 7 | EL 8 | CentOS Stream 8 | +| ------------------------------ | :--------------: | :--------------: | :--------------: | +| epel |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| +| epel-debuginfo |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| +| epel-modular | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-modular-debuginfo | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-modular-source | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-next | :x: | :x: |:heavy_check_mark:| +| epel-next-debuginfo | :x: | :x: |:heavy_check_mark:| +| epel-next-source | :x: | :x: |:heavy_check_mark:| +| epel-next-testing | :x: | :x: |:heavy_check_mark:| +| epel-next-testing-debug | :x: | :x: |:heavy_check_mark:| +| epel-next-testing-source | :x: | :x: |:heavy_check_mark:| +| epel-playground | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-playground-debuginfo | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-playground-source | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-source |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| +| epel-testing |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| +| epel-testing-debuginfo |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| +| epel-testing-modular | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-testing-modular-debuginfo | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-testing-modular-source | :x: |:heavy_check_mark:|:heavy_check_mark:| +| epel-testing-source |:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:| ## Requirements @@ -14,7 +44,11 @@ The yum-epel cookbook takes over management of the default repositoryids shipped ### Chef -- Chef 12.14+ +- Chef 12.15+ + +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). ### Cookbooks @@ -22,100 +56,11 @@ The yum-epel cookbook takes over management of the default repositoryids shipped ## Attributes -The following attributes are set by default - -```ruby -default['yum-epel']['repos'] = %w( - epel - epel-debuginfo - epel-source - epel-testing - epel-testing-debuginfo - epel-testing-source -) -``` - -```ruby -default['yum']['epel']['repositoryid'] = 'epel' -default['yum']['epel']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch' -default['yum']['epel']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch' -default['yum']['epel']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' -default['yum']['epel']['failovermethod'] = 'priority' -default['yum']['epel']['gpgcheck'] = true -default['yum']['epel']['enabled'] = true -default['yum']['epel']['managed'] = true -``` - -```ruby -default['yum']['epel-debuginfo']['repositoryid'] = 'epel-debuginfo' -default['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch - Debug' -default['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch' -default['yum']['epel-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' -default['yum']['epel-debuginfo']['failovermethod'] = 'priority' -default['yum']['epel-debuginfo']['gpgcheck'] = true -default['yum']['epel-debuginfo']['enabled'] = false -default['yum']['epel-debuginfo']['managed'] = false -``` - -```ruby -default['yum']['epel-source']['repositoryid'] = 'epel-source' -default['yum']['epel-source']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch - Source' -default['yum']['epel-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch' -default['yum']['epel-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' -default['yum']['epel-source']['failovermethod'] = 'priority' -default['yum']['epel-source']['gpgcheck'] = true -default['yum']['epel-source']['enabled'] = false -default['yum']['epel-source']['managed'] = false -``` - -```ruby -default['yum']['epel-testing']['repositoryid'] = 'epel-testing' -default['yum']['epel-testing']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch' -default['yum']['epel-testing']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=$basearch' -default['yum']['epel-testing']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6r' -default['yum']['epel-testing']['failovermethod'] = 'priority' -default['yum']['epel-testing']['gpgcheck'] = true -default['yum']['epel-testing']['enabled'] = false -default['yum']['epel-testing']['managed'] = false -``` - -```ruby -default['yum']['epel-testing-debuginfo']['repositoryid'] = 'epel-testing-debuginfo' -default['yum']['epel-testing-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch Debug' -default['yum']['epel-testing-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=$basearch' -default['yum']['epel-testing-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' -default['yum']['epel-testing-debuginfo']['failovermethod'] = 'priority' -default['yum']['epel-testing-debuginfo']['gpgcheck'] = true -default['yum']['epel-testing-debuginfo']['enabled'] = false -default['yum']['epel-testing-debuginfo']['managed'] = false -``` - -```ruby -default['yum']['epel-testing-source']['repositoryid'] = 'epel-testing-source' -default['yum']['epel-testing-source']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch Source' -default['yum']['epel-testing-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=$basearch' -default['yum']['epel-testing-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' -default['yum']['epel-testing-source']['failovermethod'] = 'priority' -default['yum']['epel-testing-source']['gpgcheck'] = true -default['yum']['epel-testing-source']['enabled'] = false -default['yum']['epel-testing-source']['managed'] = false -``` +See individual repository attribute files for defaults. ## Recipes -- default - Walks through node attributes and feeds a yum_resource -- parameters. The following is an example a resource generated by the -- recipe during compilation. - -```ruby - yum_repository 'epel' do - mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch' - description 'Extra Packages for Enterprise Linux 5 - $basearch' - enabled true - gpgcheck true - gpgkey 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL' - end -``` +- `yum-epel::default` Generates `yum_repository` configs for the standard EPEL repositories. By default the `epel` repository is enabled. For CentOS Stream, the [epel-next](https://docs.fedoraproject.org/en-US/epel/#what_is_epel_next) repository is also enabled. ## Usage Example @@ -148,28 +93,33 @@ Point the epel repositories at an internally hosted server. ```ruby node.default['yum']['epel']['enabled'] = true node.default['yum']['epel']['mirrorlist'] = nil -node.default['yum']['epel']['baseurl'] = 'https://internal.example.com/centos/6/os/x86_64' +node.default['yum']['epel']['baseurl'] = 'https://internal.example.com/centos/7/os/x86_64' node.default['yum']['epel']['sslverify'] = false include_recipe 'yum-epel' ``` -## License & Authors +## Contributors -**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io)) +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -**Copyright:** 2011-2016, Chef Software, Inc. +### Backers -``` -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +Thank you to all our backers! - http://www.apache.org/licenses/LICENSE-2.0 +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/yum-epel/attributes/default.rb b/cookbooks/yum-epel/attributes/default.rb index 960a280..31eca73 100644 --- a/cookbooks/yum-epel/attributes/default.rb +++ b/cookbooks/yum-epel/attributes/default.rb @@ -1,8 +1,28 @@ -default['yum-epel']['repos'] = %w( - epel - epel-debuginfo - epel-source - epel-testing - epel-testing-debuginfo - epel-testing-source -) +default['yum-epel']['repos'] = + value_for_platform( + %w(redhat centos oracle) => { + '>= 8.0' => epel_8_repos, + '~> 7.0' => + %w( + epel + epel-debuginfo + epel-source + epel-testing + epel-testing-debuginfo + epel-testing-source + ), + }, + 'amazon' => { + 'default' => + %w( + epel + epel-debuginfo + epel-source + epel-testing + epel-testing-debuginfo + epel-testing-source + ), + }, + # No-op on non-yum systems + 'default' => [] + ) diff --git a/cookbooks/yum-epel/attributes/epel-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-debuginfo.rb index f95a9e4..01b9b1e 100644 --- a/cookbooks/yum-epel/attributes/epel-debuginfo.rb +++ b/cookbooks/yum-epel/attributes/epel-debuginfo.rb @@ -1,19 +1,14 @@ default['yum']['epel-debuginfo']['repositoryid'] = 'epel-debuginfo' -default['yum']['epel-debuginfo']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Debug" if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel-debuginfo']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-6&arch=$basearch' - default['yum']['epel-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel-debuginfo']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-7&arch=$basearch' - default['yum']['epel-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel-debuginfo']['description'] = 'Extra Packages for 7 - $basearch - Debug' + default['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-7&arch=$basearch' + default['yum']['epel-debuginfo']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel-debuginfo']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel-debuginfo']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Debug" + default['yum']['epel-debuginfo']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel-debuginfo']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end -default['yum']['epel-debuginfo']['failovermethod'] = 'priority' default['yum']['epel-debuginfo']['gpgcheck'] = true default['yum']['epel-debuginfo']['enabled'] = false default['yum']['epel-debuginfo']['managed'] = false diff --git a/cookbooks/yum-epel/attributes/epel-modular-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-modular-debuginfo.rb new file mode 100644 index 0000000..04e9f52 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-modular-debuginfo.rb @@ -0,0 +1,8 @@ +default['yum']['epel-modular-debuginfo']['repositoryid'] = 'epel-modular-debuginfo' +default['yum']['epel-modular-debuginfo']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever - $basearch - Debug' +default['yum']['epel-modular-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-modular-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-modular-debuginfo']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-modular-debuginfo']['gpgcheck'] = true +default['yum']['epel-modular-debuginfo']['enabled'] = false +default['yum']['epel-modular-debuginfo']['managed'] = false +default['yum']['epel-modular-debuginfo']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-modular-source.rb b/cookbooks/yum-epel/attributes/epel-modular-source.rb new file mode 100644 index 0000000..150e1eb --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-modular-source.rb @@ -0,0 +1,8 @@ +default['yum']['epel-modular-source']['repositoryid'] = 'epel-modular-source' +default['yum']['epel-modular-source']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever - $basearch - Source' +default['yum']['epel-modular-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-modular-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-modular-source']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-modular-source']['gpgcheck'] = true +default['yum']['epel-modular-source']['enabled'] = false +default['yum']['epel-modular-source']['managed'] = false +default['yum']['epel-modular-source']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-modular.rb b/cookbooks/yum-epel/attributes/epel-modular.rb new file mode 100644 index 0000000..9fea914 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-modular.rb @@ -0,0 +1,8 @@ +default['yum']['epel-modular']['repositoryid'] = 'epel-modular' +default['yum']['epel-modular']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever - $basearch' +default['yum']['epel-modular']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-modular']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-modular']['gpgcheck'] = true +default['yum']['epel-modular']['enabled'] = false +default['yum']['epel-modular']['managed'] = false +default['yum']['epel-modular']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-next-debuginfo.rb new file mode 100644 index 0000000..dd43687 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next-debuginfo.rb @@ -0,0 +1,11 @@ +default['yum']['epel-next-debuginfo']['repositoryid'] = 'epel-next-debuginfo' +default['yum']['epel-next-debuginfo']['description'] = + "Extra Packages for #{node['platform_version'].to_i} - $basearch - Next - Debug" +default['yum']['epel-next-debuginfo']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-next-debug-#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next-debuginfo']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next-debuginfo']['gpgcheck'] = true +default['yum']['epel-next-debuginfo']['enabled'] = false +default['yum']['epel-next-debuginfo']['managed'] = false +default['yum']['epel-next-debuginfo']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next-source.rb b/cookbooks/yum-epel/attributes/epel-next-source.rb new file mode 100644 index 0000000..e7c70a7 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next-source.rb @@ -0,0 +1,11 @@ +default['yum']['epel-next-source']['repositoryid'] = 'epel-next-source' +default['yum']['epel-next-source']['description'] = + "Extra Packages for #{node['platform_version'].to_i} $basearch - Next -Source" +default['yum']['epel-next-source']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-next-source-#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next-source']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next-source']['gpgcheck'] = true +default['yum']['epel-next-source']['enabled'] = false +default['yum']['epel-next-source']['managed'] = false +default['yum']['epel-next-source']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next-testing-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-next-testing-debuginfo.rb new file mode 100644 index 0000000..118b636 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next-testing-debuginfo.rb @@ -0,0 +1,11 @@ +default['yum']['epel-next-testing-debuginfo']['repositoryid'] = 'epel-next-testing-debuginfo' +default['yum']['epel-next-testing-debuginfo']['description'] = + "Extra Packages for #{node['platform_version'].to_i} - $basearch - Next - Testing Debug" +default['yum']['epel-next-testing-debuginfo']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-testing-next-debug-#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next-testing-debuginfo']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next-testing-debuginfo']['gpgcheck'] = true +default['yum']['epel-next-testing-debuginfo']['enabled'] = false +default['yum']['epel-next-testing-debuginfo']['managed'] = false +default['yum']['epel-next-testing-debuginfo']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next-testing-source.rb b/cookbooks/yum-epel/attributes/epel-next-testing-source.rb new file mode 100644 index 0000000..8548e54 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next-testing-source.rb @@ -0,0 +1,11 @@ +default['yum']['epel-next-testing-source']['repositoryid'] = 'epel-next-testing-source' +default['yum']['epel-next-testing-source']['description'] = + "Extra Packages for #{node['platform_version'].to_i} - $basearch - Next - Testing Source" +default['yum']['epel-next-testing-source']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next-testing-source']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next-testing-source']['gpgcheck'] = true +default['yum']['epel-next-testing-source']['enabled'] = false +default['yum']['epel-next-testing-source']['managed'] = false +default['yum']['epel-next-testing-source']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next-testing.rb b/cookbooks/yum-epel/attributes/epel-next-testing.rb new file mode 100644 index 0000000..18476e3 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next-testing.rb @@ -0,0 +1,11 @@ +default['yum']['epel-next-testing']['repositoryid'] = 'epel-next-testing' +default['yum']['epel-next-testing']['description'] = + "Extra Packages for #{node['platform_version'].to_i} - $basearch - Next - Testing" +default['yum']['epel-next-testing']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-testing-next-#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next-testing']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next-testing']['gpgcheck'] = true +default['yum']['epel-next-testing']['enabled'] = false +default['yum']['epel-next-testing']['managed'] = false +default['yum']['epel-next-testing']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-next.rb b/cookbooks/yum-epel/attributes/epel-next.rb new file mode 100644 index 0000000..246f5a3 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-next.rb @@ -0,0 +1,10 @@ +default['yum']['epel-next']['repositoryid'] = 'epel-next' +default['yum']['epel-next']['gpgcheck'] = true +default['yum']['epel-next']['description'] = 'Extra Packages for $releasever - Next - $basearch' +default['yum']['epel-next']['mirrorlist'] = + "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-next-#{node['platform_version'].to_i}&arch=$basearch" +default['yum']['epel-next']['gpgkey'] = + "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" +default['yum']['epel-next']['enabled'] = true +default['yum']['epel-next']['managed'] = true +default['yum']['epel-next']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-playground-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-playground-debuginfo.rb new file mode 100644 index 0000000..d823b83 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-playground-debuginfo.rb @@ -0,0 +1,8 @@ +default['yum']['epel-playground-debuginfo']['repositoryid'] = 'epel-playground-debuginfo' +default['yum']['epel-playground-debuginfo']['description'] = 'Extra Packages for Enterprise Linux $releasever - Playground - $basearch - Debug' +default['yum']['epel-playground-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=playground-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-playground-debuginfo']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-playground-debuginfo']['gpgcheck'] = true +default['yum']['epel-playground-debuginfo']['enabled'] = false +default['yum']['epel-playground-debuginfo']['managed'] = false +default['yum']['epel-playground-debuginfo']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-playground-source.rb b/cookbooks/yum-epel/attributes/epel-playground-source.rb new file mode 100644 index 0000000..c0a0cb3 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-playground-source.rb @@ -0,0 +1,8 @@ +default['yum']['epel-playground-source']['repositoryid'] = 'epel-playground-source' +default['yum']['epel-playground-source']['description'] = 'Extra Packages for Enterprise Linux $releasever - Playground - $basearch - Source' +default['yum']['epel-playground-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=playground-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-playground-source']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-playground-source']['gpgcheck'] = true +default['yum']['epel-playground-source']['enabled'] = false +default['yum']['epel-playground-source']['managed'] = false +default['yum']['epel-playground-source']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-playground.rb b/cookbooks/yum-epel/attributes/epel-playground.rb new file mode 100644 index 0000000..3b78bb5 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-playground.rb @@ -0,0 +1,8 @@ +default['yum']['epel-playground']['repositoryid'] = 'epel-playground' +default['yum']['epel-playground']['description'] = 'Extra Packages for Enterprise Linux $releasever - Playground - $basearch' +default['yum']['epel-playground']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=playground-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-playground']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-playground']['gpgcheck'] = true +default['yum']['epel-playground']['enabled'] = false +default['yum']['epel-playground']['managed'] = false +default['yum']['epel-playground']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-source.rb b/cookbooks/yum-epel/attributes/epel-source.rb index 51975ba..6c89989 100644 --- a/cookbooks/yum-epel/attributes/epel-source.rb +++ b/cookbooks/yum-epel/attributes/epel-source.rb @@ -1,19 +1,14 @@ default['yum']['epel-source']['repositoryid'] = 'epel-source' -default['yum']['epel-source']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Source" if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch' - default['yum']['epel-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-7&arch=$basearch' - default['yum']['epel-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel-source']['description'] = 'Extra Packages for 7 - $basearch - Source' + default['yum']['epel-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-7&arch=$basearch' + default['yum']['epel-source']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel-source']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel-source']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Source" + default['yum']['epel-source']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel-source']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end -default['yum']['epel-source']['failovermethod'] = 'priority' default['yum']['epel-source']['gpgcheck'] = true default['yum']['epel-source']['enabled'] = false default['yum']['epel-source']['managed'] = false diff --git a/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb index da874d3..4330c33 100644 --- a/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +++ b/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb @@ -1,19 +1,14 @@ default['yum']['epel-testing-debuginfo']['repositoryid'] = 'epel-testing-debuginfo' -default['yum']['epel-testing-debuginfo']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing Debug" if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel-testing-debuginfo']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-debug-epel6&arch=$basearch' - default['yum']['epel-testing-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel-testing-debuginfo']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-debug-epel7&arch=$basearch' - default['yum']['epel-testing-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel-testing-debuginfo']['description'] = 'Extra Packages for 7 - $basearch - Testing Debug' + default['yum']['epel-testing-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=testing-debug-epel7&arch=$basearch' + default['yum']['epel-testing-debuginfo']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel-testing-debuginfo']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=testing-debug-epel#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel-testing-debuginfo']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing Debug" + default['yum']['epel-testing-debuginfo']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=testing-debug-epel#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel-testing-debuginfo']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end -default['yum']['epel-testing-debuginfo']['failovermethod'] = 'priority' default['yum']['epel-testing-debuginfo']['gpgcheck'] = true default['yum']['epel-testing-debuginfo']['enabled'] = false default['yum']['epel-testing-debuginfo']['managed'] = false diff --git a/cookbooks/yum-epel/attributes/epel-testing-modular-debuginfo.rb b/cookbooks/yum-epel/attributes/epel-testing-modular-debuginfo.rb new file mode 100644 index 0000000..fa938de --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-testing-modular-debuginfo.rb @@ -0,0 +1,8 @@ +default['yum']['epel-testing-modular-debuginfo']['repositoryid'] = 'epel-testing-modular-debuginfo' +default['yum']['epel-testing-modular-debuginfo']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever - Testing - $basearch - Debug' +default['yum']['epel-testing-modular-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-modular-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-testing-modular-debuginfo']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-testing-modular-debuginfo']['gpgcheck'] = true +default['yum']['epel-testing-modular-debuginfo']['enabled'] = false +default['yum']['epel-testing-modular-debuginfo']['managed'] = false +default['yum']['epel-testing-modular-debuginfo']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-testing-modular-source.rb b/cookbooks/yum-epel/attributes/epel-testing-modular-source.rb new file mode 100644 index 0000000..4a4ae41 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-testing-modular-source.rb @@ -0,0 +1,8 @@ +default['yum']['epel-testing-modular-source']['repositoryid'] = 'epel-testing-modular-source' +default['yum']['epel-testing-modular-source']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever- Testing - $basearch - Source' +default['yum']['epel-testing-modular-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-modular-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-testing-modular-source']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-testing-modular-source']['gpgcheck'] = true +default['yum']['epel-testing-modular-source']['enabled'] = false +default['yum']['epel-testing-modular-source']['managed'] = false +default['yum']['epel-testing-modular-source']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-testing-modular.rb b/cookbooks/yum-epel/attributes/epel-testing-modular.rb new file mode 100644 index 0000000..a707c65 --- /dev/null +++ b/cookbooks/yum-epel/attributes/epel-testing-modular.rb @@ -0,0 +1,8 @@ +default['yum']['epel-testing-modular']['repositoryid'] = 'epel-testing-modular' +default['yum']['epel-testing-modular']['description'] = 'Extra Packages for Enterprise Linux Modular $releasever - Testing - $basearch' +default['yum']['epel-testing-modular']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-modular-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir' +default['yum']['epel-testing-modular']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' +default['yum']['epel-testing-modular']['gpgcheck'] = true +default['yum']['epel-testing-modular']['enabled'] = false +default['yum']['epel-testing-modular']['managed'] = false +default['yum']['epel-testing-modular']['make_cache'] = true diff --git a/cookbooks/yum-epel/attributes/epel-testing-source.rb b/cookbooks/yum-epel/attributes/epel-testing-source.rb index 07bc64d..7da8d24 100644 --- a/cookbooks/yum-epel/attributes/epel-testing-source.rb +++ b/cookbooks/yum-epel/attributes/epel-testing-source.rb @@ -1,19 +1,14 @@ default['yum']['epel-testing-source']['repositoryid'] = 'epel-testing-source' -default['yum']['epel-testing-source']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing Source" if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel-testing-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel6&arch=$basearch' - default['yum']['epel-testing-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel-testing-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel7&arch=$basearch' - default['yum']['epel-testing-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel-testing-source']['description'] = 'Extra Packages for 7 - $basearch - Testing Source' + default['yum']['epel-testing-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel7&arch=$basearch' + default['yum']['epel-testing-source']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel-testing-source']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel-testing-source']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing Source" + default['yum']['epel-testing-source']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=testing-source-epel#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel-testing-source']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end -default['yum']['epel-testing-source']['failovermethod'] = 'priority' default['yum']['epel-testing-source']['gpgcheck'] = true default['yum']['epel-testing-source']['enabled'] = false default['yum']['epel-testing-source']['managed'] = false diff --git a/cookbooks/yum-epel/attributes/epel-testing.rb b/cookbooks/yum-epel/attributes/epel-testing.rb index 3fe52b8..ae3aa16 100644 --- a/cookbooks/yum-epel/attributes/epel-testing.rb +++ b/cookbooks/yum-epel/attributes/epel-testing.rb @@ -1,19 +1,14 @@ default['yum']['epel-testing']['repositoryid'] = 'epel-testing' -default['yum']['epel-testing']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing " if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel-testing']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel6&arch=$basearch' - default['yum']['epel-testing']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel-testing']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel7&arch=$basearch' - default['yum']['epel-testing']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel-testing']['description'] = 'Extra Packages for 7 - $basearch - Testing ' + default['yum']['epel-testing']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel7&arch=$basearch' + default['yum']['epel-testing']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel-testing']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel-testing']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch - Testing " + default['yum']['epel-testing']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel-testing']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end -default['yum']['epel-testing']['failovermethod'] = 'priority' default['yum']['epel-testing']['gpgcheck'] = true default['yum']['epel-testing']['enabled'] = false default['yum']['epel-testing']['managed'] = false diff --git a/cookbooks/yum-epel/attributes/epel.rb b/cookbooks/yum-epel/attributes/epel.rb index 5e99bca..119296d 100644 --- a/cookbooks/yum-epel/attributes/epel.rb +++ b/cookbooks/yum-epel/attributes/epel.rb @@ -1,5 +1,4 @@ default['yum']['epel']['repositoryid'] = 'epel' -default['yum']['epel']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch" default['yum']['epel']['gpgcheck'] = true case node['kernel']['machine'] when 'armv7l', 'armv7hl' @@ -10,19 +9,15 @@ when 's390x' default['yum']['epel']['gpgkey'] = 'https://kojipkgs.fedoraproject.org/rhel/rc/7/Server/s390x/os/RPM-GPG-KEY-redhat-release' else if platform?('amazon') - if node['platform_version'].to_i > 2010 - default['yum']['epel']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch' - default['yum']['epel']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6' - else - default['yum']['epel']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-7&arch=$basearch' - default['yum']['epel']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' - end + default['yum']['epel']['description'] = 'Extra Packages for 7 - $basearch' + default['yum']['epel']['mirrorlist'] = 'https://mirrors.fedoraproject.org/mirrorlist?repo=epel-7&arch=$basearch' + default['yum']['epel']['gpgkey'] = 'https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7' else - default['yum']['epel']['mirrorlist'] = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch" + default['yum']['epel']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch" + default['yum']['epel']['mirrorlist'] = "https://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node['platform_version'].to_i}&arch=$basearch" default['yum']['epel']['gpgkey'] = "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" end end -default['yum']['epel']['failovermethod'] = 'priority' default['yum']['epel']['enabled'] = true default['yum']['epel']['managed'] = true default['yum']['epel']['make_cache'] = true diff --git a/cookbooks/yum-epel/chefignore b/cookbooks/yum-epel/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/cookbooks/yum-epel/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/cookbooks/yum-epel/kitchen.dokken.yml b/cookbooks/yum-epel/kitchen.dokken.yml new file mode 100644 index 0000000..00236db --- /dev/null +++ b/cookbooks/yum-epel/kitchen.dokken.yml @@ -0,0 +1,46 @@ +driver: + name: dokken + privileged: true # because Docker and SystemD + chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> + chef_license: accept-no-persist + +transport: + name: dokken + +provisioner: + name: dokken + deprecations_as_errors: true + +verifier: + name: inspec + +platforms: + - name: amazonlinux-2 + driver: + image: dokken/amazonlinux-2 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-7 + driver: + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-8 + driver: + image: dokken/centos-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-stream-8 + driver: + image: dokken/centos-stream-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-7 + driver: + image: dokken/oraclelinux-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-8 + driver: + image: dokken/oraclelinux-8 + pid_one_command: /usr/lib/systemd/systemd diff --git a/cookbooks/yum-epel/libraries/helpers.rb b/cookbooks/yum-epel/libraries/helpers.rb new file mode 100644 index 0000000..8898dad --- /dev/null +++ b/cookbooks/yum-epel/libraries/helpers.rb @@ -0,0 +1,46 @@ +module YumEpel + module Cookbook + module Helpers + def epel_8_repos + repos = %w( + epel + epel-debuginfo + epel-modular + epel-modular-debuginfo + epel-modular-source + epel-playground + epel-playground-debuginfo + epel-playground-source + epel-source + epel-testing + epel-testing-debuginfo + epel-testing-modular + epel-testing-modular-debuginfo + epel-testing-modular-source + epel-testing-source + ) + + repos.concat( + %w( + epel-next + epel-next-debuginfo + epel-next-source + epel-next-testing + epel-next-testing-debuginfo + epel-next-testing-source + ) + ) if yum_epel_centos_stream? + + repos + end + + private + + def yum_epel_centos_stream? + respond_to?(:centos_stream_platform?) && centos_stream_platform? + end + end + end +end +# Needed to used in attributes/ +Chef::Node.include ::YumEpel::Cookbook::Helpers diff --git a/cookbooks/yum-epel/metadata.json b/cookbooks/yum-epel/metadata.json index 399f0fd..674b1bb 100644 --- a/cookbooks/yum-epel/metadata.json +++ b/cookbooks/yum-epel/metadata.json @@ -1 +1,41 @@ -{"name":"yum-epel","version":"3.3.0","description":"Installs and configures the EPEL Yum repository","long_description":"# yum-epel Cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/yum-epel.svg?branch=master)](http://travis-ci.org/chef-cookbooks/yum-epel) [![Cookbook Version](https://img.shields.io/cookbook/v/yum-epel.svg)](https://supermarket.chef.io/cookbooks/yum-epel)\n\nExtra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).\n\nThe yum-epel cookbook takes over management of the default repositoryids shipped with epel-release. It allows attribute manipulation of `epel`, `epel-debuginfo`, `epel-source`, `epel-testing`, `epel-testing-debuginfo`, and `epel-testing-source`.\n\n## Requirements\n\n### Platforms\n\n- RHEL/CentOS and derivatives\n\n### Chef\n\n- Chef 12.14+\n\n### Cookbooks\n\n- none\n\n## Attributes\n\nThe following attributes are set by default\n\n```ruby\ndefault['yum-epel']['repos'] = %w(\n epel\n epel-debuginfo\n epel-source\n epel-testing\n epel-testing-debuginfo\n epel-testing-source\n)\n```\n\n```ruby\ndefault['yum']['epel']['repositoryid'] = 'epel'\ndefault['yum']['epel']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch'\ndefault['yum']['epel']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch'\ndefault['yum']['epel']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\ndefault['yum']['epel']['failovermethod'] = 'priority'\ndefault['yum']['epel']['gpgcheck'] = true\ndefault['yum']['epel']['enabled'] = true\ndefault['yum']['epel']['managed'] = true\n```\n\n```ruby\ndefault['yum']['epel-debuginfo']['repositoryid'] = 'epel-debuginfo'\ndefault['yum']['epel-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch - Debug'\ndefault['yum']['epel-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch'\ndefault['yum']['epel-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\ndefault['yum']['epel-debuginfo']['failovermethod'] = 'priority'\ndefault['yum']['epel-debuginfo']['gpgcheck'] = true\ndefault['yum']['epel-debuginfo']['enabled'] = false\ndefault['yum']['epel-debuginfo']['managed'] = false\n```\n\n```ruby\ndefault['yum']['epel-source']['repositoryid'] = 'epel-source'\ndefault['yum']['epel-source']['description'] = 'Extra Packages for Enterprise Linux 6 - $basearch - Source'\ndefault['yum']['epel-source']['mirrorlist'] = 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch'\ndefault['yum']['epel-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\ndefault['yum']['epel-source']['failovermethod'] = 'priority'\ndefault['yum']['epel-source']['gpgcheck'] = true\ndefault['yum']['epel-source']['enabled'] = false\ndefault['yum']['epel-source']['managed'] = false\n```\n\n```ruby\ndefault['yum']['epel-testing']['repositoryid'] = 'epel-testing'\ndefault['yum']['epel-testing']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch'\ndefault['yum']['epel-testing']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=$basearch'\ndefault['yum']['epel-testing']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6r'\ndefault['yum']['epel-testing']['failovermethod'] = 'priority'\ndefault['yum']['epel-testing']['gpgcheck'] = true\ndefault['yum']['epel-testing']['enabled'] = false\ndefault['yum']['epel-testing']['managed'] = false\n```\n\n```ruby\ndefault['yum']['epel-testing-debuginfo']['repositoryid'] = 'epel-testing-debuginfo'\ndefault['yum']['epel-testing-debuginfo']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch Debug'\ndefault['yum']['epel-testing-debuginfo']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel6&arch=$basearch'\ndefault['yum']['epel-testing-debuginfo']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\ndefault['yum']['epel-testing-debuginfo']['failovermethod'] = 'priority'\ndefault['yum']['epel-testing-debuginfo']['gpgcheck'] = true\ndefault['yum']['epel-testing-debuginfo']['enabled'] = false\ndefault['yum']['epel-testing-debuginfo']['managed'] = false\n```\n\n```ruby\ndefault['yum']['epel-testing-source']['repositoryid'] = 'epel-testing-source'\ndefault['yum']['epel-testing-source']['description'] = 'Extra Packages for Enterprise Linux 6 - Testing - $basearch Source'\ndefault['yum']['epel-testing-source']['mirrorlist'] = 'https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel6&arch=$basearch'\ndefault['yum']['epel-testing-source']['gpgkey'] = 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'\ndefault['yum']['epel-testing-source']['failovermethod'] = 'priority'\ndefault['yum']['epel-testing-source']['gpgcheck'] = true\ndefault['yum']['epel-testing-source']['enabled'] = false\ndefault['yum']['epel-testing-source']['managed'] = false\n```\n\n## Recipes\n\n- default - Walks through node attributes and feeds a yum_resource\n- parameters. The following is an example a resource generated by the\n- recipe during compilation.\n\n```ruby\n yum_repository 'epel' do\n mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch'\n description 'Extra Packages for Enterprise Linux 5 - $basearch'\n enabled true\n gpgcheck true\n gpgkey 'http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL'\n end\n```\n\n## Usage Example\n\nTo disable the epel repository through a Role or Environment definition\n\n```\ndefault_attributes(\n :yum => {\n :epel => {\n :enabled => {\n false\n }\n }\n }\n )\n```\n\nUncommonly used repositoryids are not managed by default. This is speeds up integration testing pipelines by avoiding yum-cache builds that nobody cares about. To enable the epel-testing repository with a wrapper cookbook, place the following in a recipe:\n\n```ruby\nnode.default['yum']['epel-testing']['enabled'] = true\nnode.default['yum']['epel-testing']['managed'] = true\ninclude_recipe 'yum-epel'\n```\n\n## More Examples\n\nPoint the epel repositories at an internally hosted server.\n\n```ruby\nnode.default['yum']['epel']['enabled'] = true\nnode.default['yum']['epel']['mirrorlist'] = nil\nnode.default['yum']['epel']['baseurl'] = 'https://internal.example.com/centos/6/os/x86_64'\nnode.default['yum']['epel']['sslverify'] = false\n\ninclude_recipe 'yum-epel'\n```\n\n## License & Authors\n\n**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))\n\n**Copyright:** 2011-2016, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","zlinux":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/yum-epel","issues_url":"https://github.com/chef-cookbooks/yum-epel/issues","chef_version":[[">= 12.14"]],"ohai_version":[]} \ No newline at end of file +{ + "name": "yum-epel", + "description": "Installs and configures the EPEL Yum repository", + "long_description": "", + "maintainer": "Sous Chefs", + "maintainer_email": "help@sous-chefs.org", + "license": "Apache-2.0", + "platforms": { + "amazon": ">= 0.0.0", + "centos": ">= 0.0.0", + "oracle": ">= 0.0.0", + "redhat": ">= 0.0.0", + "scientific": ">= 0.0.0", + "zlinux": ">= 0.0.0" + }, + "dependencies": { + + }, + "providing": { + + }, + "recipes": { + + }, + "version": "4.2.3", + "source_url": "https://github.com/sous-chefs/yum-epel", + "issues_url": "https://github.com/sous-chefs/yum-epel/issues", + "privacy": false, + "chef_versions": [ + [ + ">= 12.15" + ] + ], + "ohai_versions": [ + + ], + "gems": [ + + ], + "eager_load_libraries": true +} diff --git a/cookbooks/yum-epel/metadata.rb b/cookbooks/yum-epel/metadata.rb new file mode 100644 index 0000000..2414a7e --- /dev/null +++ b/cookbooks/yum-epel/metadata.rb @@ -0,0 +1,16 @@ +name 'yum-epel' +maintainer 'Sous Chefs' +maintainer_email 'help@sous-chefs.org' +license 'Apache-2.0' +description 'Installs and configures the EPEL Yum repository' +version '4.2.3' +source_url 'https://github.com/sous-chefs/yum-epel' +issues_url 'https://github.com/sous-chefs/yum-epel/issues' +chef_version '>= 12.15' + +supports 'amazon' +supports 'centos' +supports 'oracle' +supports 'redhat' +supports 'scientific' +supports 'zlinux' diff --git a/cookbooks/yum-epel/recipes/default.rb b/cookbooks/yum-epel/recipes/default.rb index 4ac475c..f8aa7ac 100644 --- a/cookbooks/yum-epel/recipes/default.rb +++ b/cookbooks/yum-epel/recipes/default.rb @@ -3,7 +3,7 @@ # Cookbook:: yum-epel # Recipe:: default # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/yum/.foodcritic b/cookbooks/yum/.foodcritic deleted file mode 100644 index b9f8767..0000000 --- a/cookbooks/yum/.foodcritic +++ /dev/null @@ -1 +0,0 @@ -~FC016 diff --git a/cookbooks/yum/CHANGELOG.md b/cookbooks/yum/CHANGELOG.md index c7dcf30..38ea170 100644 --- a/cookbooks/yum/CHANGELOG.md +++ b/cookbooks/yum/CHANGELOG.md @@ -2,6 +2,41 @@ This file is used to list changes made in each version of the yum cookbook. +## 7.2.0 - *2021-09-29* + +- Add `dnf_module` resource for managing DNF modules on RHEL 8+ / Fedora + +## 7.1.0 - *2021-08-29* + +- Add support for DNF (Yum v4) property `install_weak_deps` (#193) + +## 7.0.1 - *2021-08-26* + +- Standardise files with files in sous-chefs/repo-management (#191) + +## 7.0.0 - *2021-08-13* + +- Enable `unified_mode` for Chef 17 compatibility +- Remove deprecated `dnf_yum_compat` recipe + +## 6.1.1 - *2021-06-01* + +## 6.1.0 - *2021-03-24* + +- complete ip_resolve additions started in 6.0.0 + +## 6.0.0 - *2021-01-20* + +- Sous Chefs Adoption +- Cookstyle fixes +- Various testing fixes +- Standardise files with files in sous-chefs/repo-management +- Adding proper distroverpkg assignment for Oracle Linux +- Require 13+ +- Remove RHEL5 references +- Mark `dnf_yum_compat` recipe deprecated +- Add EL8 support + ## 5.1.0 (2017-08-04) - Avoid spec deprecation warnings diff --git a/cookbooks/yum/CONTRIBUTING.md b/cookbooks/yum/CONTRIBUTING.md deleted file mode 100644 index ef2f2b8..0000000 --- a/cookbooks/yum/CONTRIBUTING.md +++ /dev/null @@ -1,2 +0,0 @@ -Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD diff --git a/cookbooks/yum/LICENSE b/cookbooks/yum/LICENSE new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/cookbooks/yum/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/cookbooks/yum/README.md b/cookbooks/yum/README.md index 1c00047..1c8ebc3 100644 --- a/cookbooks/yum/README.md +++ b/cookbooks/yum/README.md @@ -1,8 +1,16 @@ # yum Cookbook -[![Build Status](https://travis-ci.org/chef-cookbooks/yum.svg?branch=master)](http://travis-ci.org/chef-cookbooks/yum) [![Cookbook Version](https://img.shields.io/cookbook/v/yum.svg)](https://supermarket.chef.io/cookbooks/yum) +[![Cookbook Version](https://img.shields.io/cookbook/v/yum.svg)](https://supermarket.chef.io/cookbooks/yum) +[![CI State](https://github.com/sous-chefs/yum/workflows/ci/badge.svg)](https://github.com/sous-chefs/yum/actions?query=workflow%3Aci) +[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -The Yum cookbook exposes the `yum_globalconfig` resource which allows a user to control global yum behavior. This resources aims to allow the user to configure all options listed in the `yum.conf` man page, found at +The Yum cookbook exposes the `yum_globalconfig` resource which allows a user to control global yum behavior. This resources aims to allow the user to configure all options listed in the `yum.conf` man page, found at + +## Maintainers + +This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). ## Requirements @@ -13,7 +21,7 @@ The Yum cookbook exposes the `yum_globalconfig` resource which allows a user to ### Chef -- Chef 12.14+ +- Chef 15.3+ ### Cookbooks @@ -21,43 +29,12 @@ The Yum cookbook exposes the `yum_globalconfig` resource which allows a user to ## Resources -### yum_globalconfig +- [`yum_globalconfig`](documentation/yum_globalconfig.md) +- [`dnf_module`](documentation/dnf_module.md) -This renders a template with global yum configuration parameters. The default recipe uses it to render `/etc/yum.conf`. It is flexible enough to be used in other scenarios, such as building RPMs in isolation by modifying `installroot`. - -#### Example - -```ruby -yum_globalconfig '/my/chroot/etc/yum.conf' do - cachedir '/my/chroot/etc/yum.conf' - keepcache 'yes' - debuglevel '2' - installroot '/my/chroot' - action :create -end -``` - -#### Properties - -`yum_globalconfig` can take most of the same parameters as a `yum_repository`, plus more, too numerous to describe here. Below are a few of the more commonly used ones. For a complete list, please consult the `yum.conf` man page, found here: - -- `cachedir` - Directory where yum should store its cache and db files. The default is '/var/cache/yum'. -- `keepcache` - Either `true` or `false`. Determines whether or not yum keeps the cache of headers and packages after successful installation. Default is `false` -- `debuglevel` - Debug message output level. Practical range is 0-10\. Default is '2'. -- `exclude` - List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed. -- `installonlypkgs` = List of package provides that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-bigmem, kernel-enterprise, kernel-smp, kernel-debug, kernel-unsupported, kernel-source, kernel-devel, kernel-PAE, kernel-PAE-debug. -- `logfile` - Full directory and file name for where yum should write its log file. -- `exactarch` - Either `true` or `false`. Set to `true` to make 'yum update' only update the architectures of packages that you have installed. ie: with this enabled yum will not install an i686 package to update an x86_64 package. Default is `true` -- `gpgcheck` - Either `true` or `false`. This tells yum whether or not it should perform a GPG signature check on the packages gotten from this repository. - -### yum_repository - -This resource is now provided by chef-client 12.14 and later and has been removed from this cookbook. If you require this resource we highly recommend upgrading your chef-client, but if that is not an option you can pin the 4.X yum cookbook. - -## Recipes +## Recipes (deprecated) - `default` - Configures `yum_globalconfig[/etc/yum.conf]` with values found in node attributes at `node['yum']['main']` -- `dnf_yum_compat` - Installs the yum package using dnf on Fedora systems to provide support for the package resource in recipes. This is necessary on chef-client < 12.18\. This recipe should be 1st on a Fedora runlist ## Attributes @@ -106,26 +83,27 @@ Recipes from older versions of this cookbook have been moved individual cookbook Put `depends 'yum'` in your metadata.rb to gain access to the yum_repository resource. -## License & Authors +## Contributors -- Author:: Eric G. Wolfe -- Author:: Matt Ray ([matt@chef.io](mailto:matt@chef.io)) -- Author:: Joshua Timberman ([joshua@chef.io](mailto:joshua@chef.io)) -- Author:: Sean OMeara ([someara@chef.io](mailto:someara@chef.io)) +This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) -```text -Copyright:: 2011 Eric G. Wolfe -Copyright:: 2013-2017 Chef Software, Inc. +### Backers -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +Thank you to all our backers! - http://www.apache.org/licenses/LICENSE-2.0 +![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) +![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) diff --git a/cookbooks/yum/attributes/main.rb b/cookbooks/yum/attributes/main.rb index 5ac4af7..3592fb8 100644 --- a/cookbooks/yum/attributes/main.rb +++ b/cookbooks/yum/attributes/main.rb @@ -1,11 +1,6 @@ -# http://linux.die.net/man/5/yum.conf -default['yum']['main']['cachedir'] = case node['platform_version'].to_i - when 5 - '/var/cache/yum' - else - '/var/cache/yum/$basearch/$releasever' - end +# http://man7.org/linux/man-pages/man5/yum.conf.5.html +default['yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever' default['yum']['main']['distroverpkg'] = case node['platform'] when 'amazon' 'system-release' @@ -13,55 +8,54 @@ default['yum']['main']['distroverpkg'] = case node['platform'] 'sl-release' when 'redhat' nil + when 'oracle' + 'oraclelinux-release' else "#{node['platform']}-release" end -# default["yum"]["main"]["releasever"] = nil # /.*/ -default['yum']['main']['releasever'] = case node['platform'] - when 'amazon' - 'latest' - end +default['yum']['main']['releasever'] = 'latest' if platform?('amazon') default['yum']['main']['alwaysprompt'] = nil # [true, false] default['yum']['main']['assumeyes'] = nil # [true, false] default['yum']['main']['bandwidth'] = nil # /^\d+$/ -default['yum']['main']['bugtracker_url'] = nil # /.*/ +default['yum']['main']['bugtracker_url'] = nil default['yum']['main']['clean_requirements_on_remove'] = nil # [true, false] default['yum']['main']['color'] = nil # %w{ always never } -default['yum']['main']['color_list_available_downgrade'] = nil # /.*/ -default['yum']['main']['color_list_available_install'] = nil # /.*/ -default['yum']['main']['color_list_available_reinstall'] = nil # /.*/ -default['yum']['main']['color_list_available_upgrade'] = nil # /.*/ -default['yum']['main']['color_list_installed_extra'] = nil # /.*/ -default['yum']['main']['color_list_installed_newer'] = nil # /.*/ -default['yum']['main']['color_list_installed_older'] = nil # /.*/ -default['yum']['main']['color_list_installed_reinstall'] = nil # /.*/ -default['yum']['main']['color_search_match'] = nil # /.*/ -default['yum']['main']['color_update_installed'] = nil # /.*/ -default['yum']['main']['color_update_local'] = nil # /.*/ -default['yum']['main']['color_update_remote'] = nil # /.*/ -default['yum']['main']['commands'] = nil # /.*/ +default['yum']['main']['color_list_available_downgrade'] = nil +default['yum']['main']['color_list_available_install'] = nil +default['yum']['main']['color_list_available_reinstall'] = nil +default['yum']['main']['color_list_available_upgrade'] = nil +default['yum']['main']['color_list_installed_extra'] = nil +default['yum']['main']['color_list_installed_newer'] = nil +default['yum']['main']['color_list_installed_older'] = nil +default['yum']['main']['color_list_installed_reinstall'] = nil +default['yum']['main']['color_search_match'] = nil +default['yum']['main']['color_update_installed'] = nil +default['yum']['main']['color_update_local'] = nil +default['yum']['main']['color_update_remote'] = nil +default['yum']['main']['commands'] = nil default['yum']['main']['deltarpm'] = nil # [true, false] default['yum']['main']['debuglevel'] = nil # /^\d+$/ default['yum']['main']['diskspacecheck'] = nil # [true, false] default['yum']['main']['enable_group_conditionals'] = nil # [true, false] default['yum']['main']['errorlevel'] = nil # /^\d+$/ default['yum']['main']['exactarch'] = nil # [true, false] -default['yum']['main']['exclude'] = nil # /.*/ +default['yum']['main']['exclude'] = nil default['yum']['main']['gpgcheck'] = true # [true, false] -default['yum']['main']['group_package_types'] = nil # /.*/ +default['yum']['main']['group_package_types'] = nil default['yum']['main']['groupremove_leaf_only'] = nil # [true, false] -default['yum']['main']['history_list_view'] = nil # /.*/ +default['yum']['main']['history_list_view'] = nil default['yum']['main']['history_record'] = nil # [true, false] -default['yum']['main']['history_record_packages'] = nil # /.*/ +default['yum']['main']['history_record_packages'] = nil default['yum']['main']['http_caching'] = nil # %w{ packages all none } +default['yum']['main']['ip_resolve'] = nil # %w{ 4 6 } default['yum']['main']['installonly_limit'] = nil # /\d+/, /keep/ -default['yum']['main']['installonlypkgs'] = nil # /.*/ -default['yum']['main']['installroot'] = nil # /.*/ +default['yum']['main']['installonlypkgs'] = nil +default['yum']['main']['installroot'] = nil default['yum']['main']['keepalive'] = nil # [true, false] default['yum']['main']['keepcache'] = false # [true, false] -default['yum']['main']['kernelpkgnames'] = nil # /.*/ +default['yum']['main']['kernelpkgnames'] = nil default['yum']['main']['localpkg_gpgcheck'] = false # [true,# false] -default['yum']['main']['logfile'] = '/var/log/yum.log' # /.*/ +default['yum']['main']['logfile'] = '/var/log/yum.log' default['yum']['main']['max_retries'] = nil # /^\d+$/ default['yum']['main']['mdpolicy'] = nil # %w{ packages all none } default['yum']['main']['metadata_expire'] = nil # /^\d+$/ @@ -69,35 +63,35 @@ default['yum']['main']['mirrorlist_expire'] = nil # /^\d+$/ default['yum']['main']['multilib_policy'] = nil # %w{ all best } default['yum']['main']['obsoletes'] = nil # [true, false] default['yum']['main']['overwrite_groups'] = nil # [true, false] -default['yum']['main']['password'] = nil # /.*/ -default['yum']['main']['path'] = '/etc/yum.conf' # /.*/ -default['yum']['main']['persistdir'] = nil # /.*/ -default['yum']['main']['pluginconfpath'] = nil # /.*/ -default['yum']['main']['pluginpath'] = nil # /.*/ +default['yum']['main']['password'] = nil +default['yum']['main']['path'] = '/etc/yum.conf' +default['yum']['main']['persistdir'] = nil +default['yum']['main']['pluginconfpath'] = nil +default['yum']['main']['pluginpath'] = nil default['yum']['main']['plugins'] = nil # [true, false] -default['yum']['main']['protected_multilib'] = nil # /.*/ -default['yum']['main']['protected_packages'] = nil # /.*/ -default['yum']['main']['proxy'] = nil # /.*/ -default['yum']['main']['proxy_password'] = nil # /.*/ -default['yum']['main']['proxy_username'] = nil # /.*/ -default['yum']['main']['password'] = nil # /.*/ +default['yum']['main']['protected_multilib'] = nil +default['yum']['main']['protected_packages'] = nil +default['yum']['main']['proxy'] = nil +default['yum']['main']['proxy_password'] = nil +default['yum']['main']['proxy_username'] = nil +default['yum']['main']['password'] = nil default['yum']['main']['recent'] = nil # /^\d+$/ default['yum']['main']['repo_gpgcheck'] = nil # [true, false] -default['yum']['main']['reposdir'] = nil # /.*/ +default['yum']['main']['reposdir'] = nil default['yum']['main']['reset_nice'] = nil # [true, false] default['yum']['main']['rpmverbosity'] = nil # %w{ info critical# emergency error warn debug } default['yum']['main']['showdupesfromrepos'] = nil # [true, false] default['yum']['main']['skip_broken'] = nil # [true, false] default['yum']['main']['ssl_check_cert_permissions'] = nil # [true, false] -default['yum']['main']['sslcacert'] = nil # /.*/ -default['yum']['main']['sslclientcert'] = nil # /.*/ -default['yum']['main']['sslclientkey'] = nil # /.*/ +default['yum']['main']['sslcacert'] = nil +default['yum']['main']['sslclientcert'] = nil +default['yum']['main']['sslclientkey'] = nil default['yum']['main']['sslverify'] = nil # [true, false] -default['yum']['main']['syslog_device'] = nil # /.*/ -default['yum']['main']['syslog_facility'] = nil # /.*/ -default['yum']['main']['syslog_ident'] = nil # /.*/ +default['yum']['main']['syslog_device'] = nil +default['yum']['main']['syslog_facility'] = nil +default['yum']['main']['syslog_ident'] = nil default['yum']['main']['throttle'] = nil # [/\d+k/, /\d+M/, /\d+G/] default['yum']['main']['timeout'] = nil # /\d+/ default['yum']['main']['tolerant'] = false -default['yum']['main']['tsflags'] = nil # /.*/ -default['yum']['main']['username'] = nil # /.*/ +default['yum']['main']['tsflags'] = nil +default['yum']['main']['username'] = nil diff --git a/cookbooks/yum/chefignore b/cookbooks/yum/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/cookbooks/yum/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/cookbooks/yum/kitchen.dokken.yml b/cookbooks/yum/kitchen.dokken.yml new file mode 100644 index 0000000..9d2678f --- /dev/null +++ b/cookbooks/yum/kitchen.dokken.yml @@ -0,0 +1,48 @@ +--- +driver: + name: dokken + privileged: true # because Docker and SystemD/Upstart + +transport: + name: dokken + +provisioner: + name: dokken + chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> + chef_license: accept-no-persist + +platforms: + - name: amazonlinux-2 + driver: + image: dokken/amazonlinux-2 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-7 + driver: + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-8 + driver: + image: dokken/centos-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: centos-stream-8 + driver: + image: dokken/centos-stream-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-7 + driver: + image: dokken/oraclelinux-7 + pid_one_command: /usr/lib/systemd/systemd + + - name: oraclelinux-8 + driver: + image: dokken/oraclelinux-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: fedora-latest + driver: + image: dokken/fedora-latest + pid_one_command: /usr/lib/systemd/systemd diff --git a/cookbooks/yum/libraries/matchers.rb b/cookbooks/yum/libraries/matchers.rb deleted file mode 100644 index 220238a..0000000 --- a/cookbooks/yum/libraries/matchers.rb +++ /dev/null @@ -1,9 +0,0 @@ -if defined?(ChefSpec) - def create_yum_globalconfig(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:yum_globalconfig, :create, resource_name) - end - - def delete_yum_globalconfig(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:yum_globalconfig, :delete, resource_name) - end -end diff --git a/cookbooks/yum/metadata.json b/cookbooks/yum/metadata.json index 44a7f68..c2b9d36 100644 --- a/cookbooks/yum/metadata.json +++ b/cookbooks/yum/metadata.json @@ -1 +1,42 @@ -{"name":"yum","version":"5.1.0","description":"Configures various yum components on Red Hat-like systems","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","zlinux":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/yum","issues_url":"https://github.com/chef-cookbooks/yum/issues","chef_version":[[">= 12.14"]],"ohai_version":[]} \ No newline at end of file +{ + "name": "yum", + "description": "Configures various yum components on Red Hat-like systems", + "long_description": "", + "maintainer": "Sous Chefs", + "maintainer_email": "help@sous-chefs.org", + "license": "Apache-2.0", + "platforms": { + "amazon": ">= 0.0.0", + "centos": ">= 0.0.0", + "fedora": ">= 0.0.0", + "oracle": ">= 0.0.0", + "redhat": ">= 0.0.0", + "scientific": ">= 0.0.0", + "zlinux": ">= 0.0.0" + }, + "dependencies": { + + }, + "providing": { + + }, + "recipes": { + + }, + "version": "7.2.0", + "source_url": "https://github.com/sous-chefs/yum", + "issues_url": "https://github.com/sous-chefs/yum/issues", + "privacy": false, + "chef_versions": [ + [ + ">= 15.3" + ] + ], + "ohai_versions": [ + + ], + "gems": [ + + ], + "eager_load_libraries": true +} diff --git a/cookbooks/yum/metadata.rb b/cookbooks/yum/metadata.rb new file mode 100644 index 0000000..4f6c382 --- /dev/null +++ b/cookbooks/yum/metadata.rb @@ -0,0 +1,17 @@ +name 'yum' +maintainer 'Sous Chefs' +maintainer_email 'help@sous-chefs.org' +license 'Apache-2.0' +description 'Configures various yum components on Red Hat-like systems' +version '7.2.0' +source_url 'https://github.com/sous-chefs/yum' +issues_url 'https://github.com/sous-chefs/yum/issues' +chef_version '>= 15.3' + +supports 'amazon' +supports 'centos' +supports 'fedora' +supports 'oracle' +supports 'redhat' +supports 'scientific' +supports 'zlinux' diff --git a/cookbooks/yum/recipes/default.rb b/cookbooks/yum/recipes/default.rb index e489fb2..76cd2b0 100644 --- a/cookbooks/yum/recipes/default.rb +++ b/cookbooks/yum/recipes/default.rb @@ -3,7 +3,7 @@ # Author:: Joshua Timberman () # Recipe:: yum::default # -# Copyright:: 2013-2017, Chef Software, Inc () +# Copyright:: 2013-2019, Chef Software, Inc () # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/yum/recipes/dnf_yum_compat.rb b/cookbooks/yum/recipes/dnf_yum_compat.rb deleted file mode 100644 index d88fecf..0000000 --- a/cookbooks/yum/recipes/dnf_yum_compat.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Author:: Tim Smith () -# Recipe:: yum::fedora_yum_compat -# -# Copyright:: 2015-2017, Chef Software, Inc () -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -execute 'make yum cache' do - command 'yum makecache' - action :nothing -end - -execute 'install yum' do - command 'dnf install yum -y' - not_if { ::File.exist?('/var/lib/yum') } - action :nothing - notifies :run, 'execute[make yum cache]', :immediately -end.run_action(:run) diff --git a/cookbooks/yum/resources/dnf_module.rb b/cookbooks/yum/resources/dnf_module.rb new file mode 100644 index 0000000..e256d32 --- /dev/null +++ b/cookbooks/yum/resources/dnf_module.rb @@ -0,0 +1,104 @@ +resource_name :dnf_module +provides :dnf_module + +unified_mode true + +property :module_name, String, + name_property: true, + description: 'Name of the module to install' + +property :options, [String, Array], + coerce: proc { |x| Array(x) }, + default: [], + description: 'Any additional options to pass to DNF' + +action_class do + def supported? + (platform_family?('rhel') && node['platform_version'] >= 8) || platform?('fedora') + end + + def list_modules(type) + raw_output = shell_out!('dnf -q module list').stdout.split("\n") + raw_output.keep_if { |l| l.match? /\[#{type}\]/ } + raw_output.map { |l| "#{l.split[0]}:#{l.split[1]}" }[0..-2] # remove Hint: line from end + end + + def enabled_modules + # extract modules from the rest of the output -- the lines with [e] (for enabled) + list_modules('e') + end + + def disabled_modules + # extract modules from the rest of the output -- the lines with [x] (for disabled) + # disable disables all versions of the stream, so add entry without :version + dl = list_modules('x') + dl + dl.map { |m| m.split(':').first }.uniq + end + + def installed_modules + # extract modules from the rest of the output -- the lines with [i] (for installed) + list_modules('i') + end + + def opts + new_resource.options.join(' ') + end +end + +action :switch_to do + return unless supported? + + unless enabled_modules.include?(new_resource.module_name) + converge_by "switch to #{new_resource.module_name}" do + shell_out!("dnf -qy module switch-to #{opts} '#{new_resource.module_name}'") + end + end +end + +action :enable do + return unless supported? + + unless enabled_modules.include?(new_resource.module_name) + converge_by "enable #{new_resource.module_name}" do + shell_out!("dnf -qy module enable #{opts} '#{new_resource.module_name}'") + end + end +end + +action :disable do + return unless supported? + + unless disabled_modules.include?(new_resource.module_name) + converge_by "disable #{new_resource.module_name}" do + shell_out!("dnf -qy module disable #{opts} '#{new_resource.module_name}'") + end + end +end + +action :install do + return unless supported? + + unless installed_modules.include?(new_resource.module_name) + converge_by "install #{new_resource.module_name}" do + shell_out!("dnf -qy module install #{opts} '#{new_resource.module_name}'") + end + end +end + +action :remove do + return unless supported? + + if installed_modules.include?(new_resource.module_name) + converge_by "remove #{new_resource.module_name}" do + shell_out!("dnf -qy module remove #{opts} '#{new_resource.module_name}'") + end + end +end + +action :reset do + return unless supported? + + converge_by "reset #{new_resource.module_name}" do + shell_out!("dnf -qy module reset #{opts} '#{new_resource.module_name}'") + end +end diff --git a/cookbooks/yum/resources/globalconfig.rb b/cookbooks/yum/resources/globalconfig.rb index d294767..5049e79 100644 --- a/cookbooks/yum/resources/globalconfig.rb +++ b/cookbooks/yum/resources/globalconfig.rb @@ -3,7 +3,7 @@ # Resource:: repository # # Author:: Sean OMeara -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2020, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,90 +18,137 @@ # limitations under the License. # -# http://linux.die.net/man/5/yum.conf -property :alwaysprompt, [true, false] -property :assumeyes, [true, false] -property :bandwidth, String, regex: /^\d+/ -property :bugtracker_url, String, regex: /.*/ -property :clean_requirements_on_remove, [true, false] -property :cachedir, String, regex: /.*/, default: '/var/cache/yum/$basearch/$releasever' -property :color, String, equal_to: %w(always never) -property :color_list_available_downgrade, String, regex: /.*/ -property :color_list_available_install, String, regex: /.*/ -property :color_list_available_reinstall, String, regex: /.*/ -property :color_list_available_upgrade, String, regex: /.*/ -property :color_list_installed_extra, String, regex: /.*/ -property :color_list_installed_newer, String, regex: /.*/ -property :color_list_installed_older, String, regex: /.*/ -property :color_list_installed_reinstall, String, regex: /.*/ -property :color_search_match, String, regex: /.*/ -property :color_update_installed, String, regex: /.*/ -property :color_update_local, String, regex: /.*/ -property :color_update_remote, String, regex: /.*/ -property :commands, String, regex: /.*/ -property :debuglevel, String, regex: /^\d+$/, default: '2' -property :deltarpm, [true, false] -property :diskspacecheck, [true, false] -property :distroverpkg, String, regex: /.*/ -property :enable_group_conditionals, [true, false] -property :errorlevel, String, regex: /^\d+$/ +# http://man7.org/linux/man-pages/man5/yum.conf.5.html + +unified_mode true + +property :alwaysprompt, [true, false], description: 'When true yum will not prompt for confirmation when the list of packages to be installed exactly matches those given on the command line. Unless assumeyes is enabled, it will prompt when additional packages need to be installed to fulfill dependencies regardless of this setting. Note that older versions of yum would also always prompt for package removal, and that is no longer true.' +property :assumeno, [true, false], description: "If yum would prompt for confirmation of critical actions, assume the user chose no. This is basically the same as doing 'echo | yum ...' but is a bit more usable. This option overrides assumeyes, but is still subject to alwaysprompt." +property :assumeyes, [true, false], description: 'Determines whether or not yum prompts for confirmation of critical actions.' +property :autocheck_running_kernel, [true, false], description: "Set this to false to disable the automatic checking of the running kernel against updateinfo ('yum updateinfo check-running-kernel'), in the 'check-update' and 'updateinfo summary' commands." +property :autosavets, [true, false], description: 'Should yum automatically save a transaction to a file when the transaction is solved but not run. Yum defaults to True' +property :bandwidth, String, regex: /^\d+/, description: "Use to specify the maximum available network bandwidth in bytes/second. Used with the throttle property. If throttle is a percentage and bandwidth is '0' then bandwidth throttling will be disabled. If throttle is expressed as a data rate (bytes/sec) then this option is ignored." +property :bugtracker_url, String, description: 'URL where bugs should be filed for yum. Configurable for local versions or distro-specific bugtrackers.' +property :cachedir, String, default: '/var/cache/yum/$basearch/$releasever', description: 'Directory where yum should store its cache and db files.' +property :cashe_root_dir, String, description: "Directory where yum would initialize the cashe, should almost certainly be left at the default. Yum's default is '/var/cache/CAShe'. Note that unlike all other configuration, this does not change with installroot, the reason is so that multiple install root can share the same data. See man cashe for more info." +property :check_config_file_age, [true, false], description: 'Specifies whether yum should auto metadata expire repos that are older than any of the configuration files that led to them (usually the yum.conf file and the foo.repo file).' +property :clean_requirements_on_remove, [true, false], description: "When removing packages (by removal, update or obsoletion) go through each package's dependencies. If any of them are no longer required by any other package then also mark them to be removed." +property :color, String, equal_to: %w(always never), description: 'Display colorized output automatically, depending on the output terminal' +property :color_list_available_downgrade, String +property :color_list_available_install, String +property :color_list_available_reinstall, String +property :color_list_available_upgrade, String +property :color_list_installed_extra, String +property :color_list_installed_newer, String +property :color_list_installed_older, String +property :color_list_installed_reinstall, String +property :color_search_match, String +property :color_update_installed, String +property :color_update_local, String +property :color_update_remote, String +property :commands, String, description: "List of functional commands to run if no functional commands are specified on the command line (eg. 'update foo bar baz quux'). None of the short options (eg. -y, -e, -d) are accepted for this option." +property :debuglevel, String, regex: /^\d+$/, default: '2', description: 'Debug message output level 0-10.' +property :deltarpm, [String, Integer], description: "When non-zero, delta-RPM files are used if available. The value specifies the maximum number of 'applydeltarpm' processes Yum will spawn, if the value is negative then yum works out how many cores you have and multiplies that by the value (cores=2, deltarpm=-2; 4 processes). (2 by default).\nNote that the 'applydeltarpm' process uses a significant amount of disk IO, so running too many instances can significantly slow down all disk IO including the downloads that yum is doing (thus. a too high value can make everything slower)." +property :deltarpm_metadata_percentage, String, description: "When the relative size of deltarpm metadata vs pkgs is larger than this, deltarpm metadata is not downloaded from the repo. Yum's default value is 100 (Deltarpm metadata must be smaller than the packages from the repo). Note that you can give values over 100, so 200 means that the metadata is required to be half the size of the packages. Use '0' to turn off this check, and always download metadata." +property :deltarpm_percentage, String, description: "When the relative size of delta vs pkg is larger than this, delta is not used. Yum's default value is 75 (Deltas must be at least 25% smaller than the pkg). Use '0' to turn off delta rpm processing. Local repositories (with file:// baseurl) have delta rpms turned off by default." +property :depsolve_loop_limit, Integer, description: "Set the number of times any attempt to depsolve before we just give up. This shouldn't be needed as yum should always solve or fail, however it has been observed that it can loop forever with very large system upgrades. Setting this to `0' (or " > ") makes yum try forever. Yum's default is '100'." +property :disable_excludes, [true, false], description: 'Permanently set the --disableexcludes command line option.' +property :diskspacecheck, [true, false], description: 'Set this to false to disable the checking for sufficient diskspace and inodes before a RPM transaction is run.' +property :distroverpkg, String, description: "The package used by yum to determine the 'version' of the distribution, this sets $releasever for use in config. files. This can be any installed package. Default is 'system-release(releasever)', 'redhat-release'. Yum will now look at the version provided by the provide, and if that is non-empty then will use the full V(-R), otherwise it uses the version of the package." +property :enable_group_conditionals, [true, false], description: 'Determines whether yum will allow the use of conditionals packages.' +property :errorlevel, String, regex: /^\d+$/, description: 'Error message output level 0-10.' property :exactarch, [true, false], default: true -property :exclude, String, regex: /.*/ -property :gpgcheck, [true, false], default: true -property :group_package_types, String, regex: /.*/ -property :groupremove_leaf_only, [true, false] -property :history_list_view, String, equal_to: %w(users commands single-user-commands) -property :history_record, [true, false] -property :history_record_packages, String, regex: /.*/ -property :http_caching, String, equal_to: %w(packages all none) -property :installonly_limit, String, regex: [/^\d+/, /keep/], default: '3' -property :installonlypkgs, String, regex: /.*/ -property :installroot, String, regex: /.*/ -property :keepalive, [true, false] -property :keepcache, [true, false], default: false -property :kernelpkgnames, String, regex: /.*/ -property :localpkg_gpgcheck, [true, false] -property :logfile, String, regex: /.*/, default: '/var/log/yum.log' -property :max_retries, String, regex: /^\d+$/ -property :mdpolicy, String, equal_to: %w(instant group:primary group:small group:main group:all) -property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/] -property :mirrorlist_expire, String, regex: /^\d+$/ -property :multilib_policy, String, equal_to: %w(all best) -property :obsoletes, [true, false] -property :overwrite_groups, [true, false] -property :password, String, regex: /.*/ -property :path, String, regex: /.*/, name_property: true -property :persistdir, String, regex: /.*/ -property :pluginconfpath, String, regex: /.*/ -property :pluginpath, String, regex: /.*/ -property :plugins, [true, false], default: true -property :protected_multilib, [true, false] -property :protected_packages, String, regex: /.*/ -property :proxy, String, regex: /.*/ -property :proxy_password, String, regex: /.*/ -property :proxy_username, String, regex: /.*/ -property :recent, String, regex: /^\d+$/ -property :releasever, String, regex: /.*/ -property :repo_gpgcheck, [true, false] -property :reposdir, String, regex: /.*/ -property :reset_nice, [true, false] -property :rpmverbosity, String, equal_to: %w(info critical emergency error warn debug) -property :showdupesfromrepos, [true, false] -property :skip_broken, [true, false] -property :ssl_check_cert_permissions, [true, false] -property :sslcacert, String, regex: /.*/ -property :sslclientcert, String, regex: /.*/ -property :sslclientkey, String, regex: /.*/ -property :sslverify, [true, false] -property :syslog_device, String, regex: /.*/ -property :syslog_facility, String, regex: /.*/ -property :syslog_ident, String, regex: /.*/ -property :throttle, String, regex: [/\d+k/, /\d+M/, /\d+G/] -property :timeout, String, regex: /^\d+$/ -property :tolerant, [true, false] -property :tsflags, String, regex: /.*/ -property :username, String, regex: /.*/ +property :exactarchlist, String, description: "List of packages that should never change archs in an update. That means, if a package has a newer version available which is for a different compatible arch, yum will not consider that version an update if the package name is in this list. For example, on x86_64, foo-1.x86_64 won't be updated to foo-2.i686 if foo is in this list. Kernels in particular fall into this category. Shell globs using wildcards (eg. * and ?) are allowed." +property :exclude, String, description: "List of packages to exclude from all repositories, so yum works as if that package was never in the repositories. This should be a space separated list. This is commonly used so a package isn't upgraded or installed accidentally, but can be used to remove packages in any way that 'yum list' will show packages. Shell globs using wildcards (eg. * and ?) are allowed." +property :exit_on_lock, [true, false], description: 'Should the yum client exit immediately when something else has the lock. Yum defaults to false' +property :fssnap_abort_on_errors, String, equal_to: %w(), description: "When fssnap_automatic_pre or fssnap_automatic_post is enabled, it's possible to specify which fssnap errors should make the transaction fail. Yum's default is 'any'.\n'broken-setup' - Abort current transaction if snapshot support is unavailable because lvm is missing or broken.\n'snapshot-failure' - Abort current transaction if creating a snapshot fails (e.g. there is not enough free space to make a snapshot).\n'any' - Abort current transaction if any of the above occurs.\n'none' - Never abort a transaction in case of errors." +property :fssnap_automatic_keep, Integer, description: "How many old snapshots should yum keep when trying to automatically create a new snapshot. Setting to 0 disables this feature. Yum's default is '1'" +property :fssnap_automatic_post, [true, false], description: 'Should yum try to automatically create a snapshot after it runs a transaction. Yum defaults to False' +property :fssnap_automatic_pre, [true, false], description: 'Should yum try to automatically create a snapshot before it runs a transaction. Yum defaults to False' +property :fssnap_devices, String, description: 'The origin LVM devices to use for snapshots. Wildcards and negation are allowed, first match (positive or negative) wins. Default is: !*/swap !*/lv_swap glob:/etc/yum/fssnap.d/*.conf' +property :fssnap_percentage, Integer, description: "The size of new snaphosts, expressed as a percentage of the old origin device. Any number between 1 and 100. Yum defaults to '100'." +property :ftp_disable_epsv, [true, false], description: 'This options disables Extended Passive Mode (the EPSV command) which does not work correctly on some buggy ftp servers.' +property :gpgcheck, [true, false], default: true, description: 'This tells yum whether or not it should perform a GPG signature check on packages. When this is set in the [main] section it sets the default for all repositories.' +property :group_command, String, equal_to: %w(simple compat objects), description: "Tells yum what to do for group install/upgrade/remove commands.\nSimple acts like you did yum group cmd $(repoquery --group --list group), so it is very easy to reason about what will happen. Alas. this is often not what people want to happen.\nCompat. works much like simple, except that when you run 'group upgrade' it actually runs 'group install' (this means that you get any new packages added to the group, but you also get packages added that were there before and you didn't want). \nObjects makes groups act like a real object, separate from the packages they contain. Yum keeps track of the groups you have installed, so 'group upgrade' will install new packages for the group but not install old ones. It also knows about group members that are installed but weren't installed as part of the group, and won't remove those on 'group remove'. Running 'yum upgrade' will also run 'yum group upgrade' (thus. adding new packages for all groups)." +property :group_package_types, String, description: "List of the following: optional, default, mandatory. Tells yum which type of packages in groups will be installed when 'groupinstall' is called." +property :groupremove_leaf_only, [true, false], description: "Used to determine yum's behaviour when the groupremove command is run. If groupremove_leaf_only is false (default) then all packages in the group will be removed. If groupremove_leaf_only is true then only those packages in the group that aren't required by another package will be removed." +property :history_list_view, String, equal_to: %w(users commands single-user-commands), description: "Which column of information to display in the 'yum history list' command." +property :history_record, [true, false], description: 'Should yum record history entries for transactions. This takes some disk space, and some extra time in the transactions. But it allows how to know a lot of information about what has happened before, and display it to the user with the history info/list/summary commands. yum also provides the history undo/redo commands.' +property :history_record_packages, String, description: 'This is a list of package names that should be recorded as having helped the transaction. yum plugins have an API to add themselves to this, so it should not normally be necessary to add packages here. Not that this is also used for the packages to look for in --version. Defaults to rpm, yum, yum-metadata-parser.' +property :http_caching, String, equal_to: %w(packages all none), description: "Determines how upstream HTTP caches are instructed to handle any HTTP downloads that Yum does. This option can take the following values: all' means that all HTTP downloads should be cached. 'packages' means that only RPM package downloads should be cached (but not repository metadata downloads). 'none' means that no HTTP downloads should be cached." +property :installonly_limit, String, regex: [/^\d+/, /keep/], default: '3', description: "Number of packages listed in installonlypkgs to keep installed at the same time. Setting to 0 disables this feature. Default is '0'. Note that this functionality used to be in the 'installonlyn' plugin, where this option was altered via tokeep. Note that as of version 3.2.24, yum will now look in the yumdb for a installonly attribute on installed packages. If that attribute is 'keep', then they will never be removed." +property :installonlypkgs, String, description: 'List of package provides that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-bigmem, kernel-enterprise, kernel-smp, kernel-modules, kernel-debug, kernel- unsupported, kernel-source, kernel-devel, kernel-PAE, kernel- PAE-debug.' +property :installroot, String, description: 'Specifies an alternative installroot, relative to which all packages will be installed.' +property :install_weak_deps, [true, false], description: "When this option is set to true and a new package is about to be installed, all packages linked by a weak dependency relation (i.e., Recommends or Supplements flags) with this package will be pulled into the transaction. Default is DNF's default of true." +property :ip_resolve, [String, Integer], equal_to: [4, '4', 6, '6'], description: "Determines how yum resolves host names. '4': resolve to IPv4 addresses only. '6': resolve to IPv6 addresses only." +property :keepalive, [true, false], description: 'Set whether HTTP keepalive should be used for HTTP/1.1 servers that support it. This can improve transfer speeds by using one connection when downloading multiple files from a repository.' +property :keepcache, [true, false], default: false, description: 'Determines whether or not yum keeps the cache of headers and packages after successful installation.' +property :kernelpkgnames, String, description: 'List of package names that are kernels. This is really only here for the updating of kernel packages and should be removed out in the yum 2.1 series.' +property :loadts_ignoremissing, [true, false], description: "Should the load-ts command ignore packages that are missing. This includes packages in the TS to be removed, which aren't installed, and packages in the TS to be added, which aren't available. If this is set to true, and an rpm is missing then loadts_ignorenewrpm is automatically set to true. Yum defaults to False." +property :loadts_ignorenewrpm, [true, false], description: 'Should the load-ts command ignore the future rpmdb version or abort if there is a mismatch between the TS file and what will happen on the current machine. Note that if loadts_ignorerpm is True, this option does nothing. Yum defaults to False' +property :loadts_ignorerpm, [true, false], description: 'Should the load-ts command ignore the rpmdb version (yum version nogroups) or abort if there is a mismatch between the TS file and the current machine. If this is set to true, then loadts_ignorenewrpm is automatically set to true. Yum defaults to False' +property :localpkg_gpgcheck, [true, false], description: 'This tells yum whether or not it should perform a GPG signature check on local packages (packages in a file, not in a repositoy).' +property :logfile, String, default: '/var/log/yum.log', description: 'Full directory and file name for where yum should write its log file.' +property :max_connections, String, regex: /^\d+/, description: 'The maximum number of simultaneous connections. This overrides the urlgrabber default of 5 connections. Note that there are also implicit per-mirror limits and the downloader honors these too.' +property :mddownloadpolicy, String, equal_to: %w(sqlite xml), description: "You can select which kinds of repodata you would prefer yum to download:\n'sqlite' - Download the .sqlite files, if available. This is currently slightly faster, once they are downloaded. However these files tend to be bigger, and thus. take longer to download. \n'xml' - Download the .XML files, which yum will do anyway as a fallback on the other options. These files tend to be smaller, but they require parsing/converting locally after download and some aditional checks are performed on them each time they are used." +property :mdpolicy, String, equal_to: %w(instant group:primary group:small group:main group:all), description: "You can select from different metadata download policies depending on how much data you want to download with the main repository metadata index. The advantages of downloading more metadata with the index is that you can't get into situations where you need to use that metadata later and the versions available aren't compatible (or the user lacks privileges) and that if the metadata is corrupt in any way yum will revert to the previous metadata.\n'instant' - Just download the new metadata index, this is roughly what yum always did, however it now does some checking on the index and reverts if it classifies it as bad.\n'group:primary' - Download the primary metadata with the index. This contains most of the package information and so is almost always required anyway.\n'group:small' - With the primary also download the updateinfo metadata, groups, and pkgtags. This is required for yum-security operations and it also used in the graphical clients. This file also tends to be significantly smaller than most others. This is the default. \n'group:main' - With the primary and updateinfo download the filelists metadata and the group metadata. The filelists data is required for operations like 'yum install /bin/bash', and also some dependency resolutions require it. The group data is used in some graphical clients and for group operations like 'yum grouplist Base'.\n'group:all' - Download all metadata listed in the index, currently the only one not listed above is the other metadata, which contains the changelog information which is used by yum-changelog. This is what 'yum makecache' uses." +property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/], description: "Time (in seconds) after which the metadata will expire. So that if the current metadata downloaded is less than this many seconds old then yum will not update the metadata against the repository. If you find that yum is not downloading information on updates as often as you would like lower the value of this option. You can also change from the default of using seconds to using days, hours or minutes by appending a d, h or m respectively. The default is 6 hours, to compliment yum-updatesd running once an hour. It's also possible to use the word 'never', meaning that the metadata will never expire. Note that when using a metalink file the metalink must always be newer than the metadata for the repository, due to the validation, so this timeout also applies to the metalink file." +property :metadata_expire_filter, String, equal_to: %w(never read-only:past read-only:present read-only:future), description: "Filter the metadata_expire time, allowing a trade of speed for accuracy if a command doesn't require it. Each yum command can specify that it requires a certain level of timeliness quality from the remote repos. from 'I\'m about to install/upgrade, so this better be current' to 'Anything that\'s available is good enough'. \n'never' - Nothing is filtered, always obey metadata_expire. \n'read-only:past' - Commands that only care about past\ information are filtered from metadata expiring. Eg. yum history info (if history needs to lookup anything about a previous transaction, then by definition the remote package was available in the past). \n'read-only:present' - Commands that are balanced between past and future. This is the default. Eg. yum list yum\n'read-only:future' - Commands that are likely to result in running other commands which will require the latest metadata. Eg. yum check-update\nNote that this option requires that all the enabled repositories be roughly the same freshness (meaning the cache age difference from one another is at most 5 days). Failing that, metadata_expire will always be obeyed, just like with 'never'.\nAlso note that this option does not override 'yum clean expire-cache'." +property :minrate, String, description: "This sets the low speed threshold in bytes per second. If the server is sending data slower than this for at least 'timeout' seconds, Yum aborts the connection." +property :mirrorlist_expire, String, regex: /^\d+$/, description: 'Time (in seconds) after which the mirrorlist locally cached will expire. If the current mirrorlist is less than this many seconds old then yum will not download another copy of the mirrorlist, it has the same extra format as metadata_expire. If you find that yum is not downloading the mirrorlists as often as you would like lower the value of this option.' +property :multilib_policy, String, equal_to: %w(all best), description: "The policy installation policy. Can be set to 'all' or 'best'. All means install all possible arches for any package you want to install. Therefore yum install foo will install foo.i386 and foo.x86_64 on x86_64, if it is available. Best means install the best arch for this platform, only. " +property :obsoletes, [true, false], description: "This option only has affect during an update. It enables yum's obsoletes processing logic. Useful when doing distribution level upgrades. See also the yum upgrade command documentation for more details" property :options, Hash +property :override_install_langs, [true, false], description: "This is a way to override rpm's _install_langs macro. without having to change it within rpm's macro file" +property :overwrite_groups, [true, false], description: "Used to determine yum's behaviour if two or more repositories offer the package groups with the same name. If overwrite_groups is true then the group packages of the last matching repository will be used. If overwrite_groups is false then the groups from all matching repositories will be merged together as one large group. Note that this option does not override remove_leaf_only, so enabling that option means this has almost no affect." +property :password, String, description: 'password to use with the username for basic authentication.' +property :path, String, name_property: true +property :persistdir, String, description: 'Directory where yum should store information that should persist over multiple runs.' +property :pluginconfpath, String, description: 'A list of directories where yum should look for plugin configuration files.' +property :pluginpath, String, description: 'A list of directories where yum should look for plugin modules.' +property :plugins, [true, false], default: true, description: 'Global switch to enable or disable yum plugins.' +property :protected_multilib, [true, false], description: 'This tells yum whether or not it should perform a check to make sure that multilib packages are the same version. For example, if this option is off (rpm behavior) then in some cases it might be possible for pkgA-1.x86_64 and pkgA-2.i386 to be installed at the same time. However this is very rarely desired. Install only packages, like the kernel, are exempt from this check.' +property :protected_packages, String, description: 'This is a list of packages that yum should never completely remove. They are protected via Obsoletes as well as user/plugin removals.' +property :proxy, String, description: 'URL to the proxy server that yum should use.' +property :proxy_password, String, description: 'The password for the specified proxy.' +property :proxy_username, String, description: 'The username for the specified proxy.' +property :query_install_excludes, [true, false], description: 'This applies the command line exclude option (only, not the configuration exclude above) to installed packages being shown in some query commands' +property :recent, String, regex: /^\d+$/, description: "Number of days back to look for 'recent' packages added to a repository." +property :recheck_installed_requires, [true, false], description: "When upgrading a package do we recheck any requirements that existed in the old package. Turning this on shouldn't do anything but slow yum depsolving down, however using rpm --nodeps etc. can break the rpmdb and then this will help." +property :releasever, String +property :remove_leaf_only, [true, false], description: "Used to determine yum's behaviour when a package is removed. If remove_leaf_only is false then packages, and their deps, will be removed. If remove_leaf_only is true then only those packages that aren't required by another package will be removed." +property :repo_gpgcheck, [true, false], description: 'This tells yum whether or not it should perform a GPG signature check on the repodata. When this is set in the [main] section it sets the default for all repositories.' +property :repopkgsremove_leaf_only, [true, false], description: "Used to determine yum's behaviour when the repo-pkg remove command is run. If repopkgremove_leaf_only is false then all packages in the repo. will be removed. If repopkgremove_leaf_only is true then only those packages in the repo. that aren't required by another package will be removed. Note that this option does not override remove_leaf_only, so enabling that option means this has almost no affect." +property :reposdir, String, description: "A list of directories where yum should look for .repo files which define repositories to use. Default is '/etc/yum/repos.d'. Each file in this directory should contain one or more repository sections as documented in [repository] options below. These will be merged with the repositories defined in /etc/yum/yum.conf to form the complete set of repositories that yum will use." +property :requires_policy, String, equal_to: %w(strong weak info), description: 'Strong means install just the needed requirements. Weak means also install any weak requirements. Info means install all requirements. This only happens on install/reinstall, upgrades/downgrades do not consult this at all. Note that yum will try to just drop weak and info requirements on errors.' +property :reset_nice, [true, false], description: 'If set to true then yum will try to reset the nice value to zero, before running an rpm transaction.' +property :retries, String, regex: /^\d+$/, description: "Set the number of times any attempt to retrieve a file should retry before returning an error. Setting this to '0' makes yum try forever." +property :rpmverbosity, String, equal_to: %w(info critical emergency error warn debug), description: 'Debug scriptlet output level.' +property :shell_exit_status, String, equal_to: %w(0 ?), description: "Determines the exit status that should be returned by `yum shell' when it terminates after reading the `exit' command or EOF. If ? is set, the exit status is that of the last command executed before `exit' (bash-like behavior). Yum defaults to 0." +property :showdupesfromrepos, [true, false], description: 'Set to true if you wish to show any duplicate packages from any repository, from package listings like the info or list commands. Set to false if you want only to see the newest packages from any repository.' +property :skip_broken, [true, false], description: 'Resolve depsolve problems by removing packages that are causing problems from the transaction.' +property :skip_missing_names_on_install, [true, false], description: "If set to False, 'yum install' will fail if it can't find any of the provided names (package, group, rpm file). Yum's default is true." +property :skip_missing_names_on_update, [true, false], description: "If set to False, 'yum update' will fail if it can't find any of the provided names (package, group, rpm file). It will also fail if the provided name is a package which is available, but not installed. Yum's default is true." +property :ssl_check_cert_permissions, [true, false], description: "Whether yum should check the permissions on the paths for the certificates on the repository (both remote and local). If we can't read any of the files then yum will force skip_if_unavailable to be true. This is most useful for non-root processes which use yum on repos. that have client cert files which are readable only by root." +property :sslcacert, String, description: 'Path to the directory containing the databases of the certificate authorities yum should use to verify SSL certificates.' +property :sslclientcert, String, description: 'Path to the SSL client certificate yum should use to connect to repos/remote sites.' +property :sslclientkey, String, description: 'Path to the SSL client key yum should use to connect to repos/remote sites.' +property :sslverify, [true, false], description: 'Should yum verify SSL certificates/hosts at all.' +property :syslog_device, String, description: 'Where to log syslog messages. Can be a local device (path) or a host:port string to use a remote syslog. If empty or points to a nonexistent device, syslog logging is disabled.' +property :syslog_facility, String, description: 'Facility name for syslog messages.' +property :syslog_ident, String, description: 'Identification (program name) for syslog messages.' +property :throttle, String, regex: [/\d+k/, /\d+M/, /\d+G/], description: "Enable bandwidth throttling for downloads. This option can be expressed as a absolute data rate in bytes/sec. An SI prefix (k, M or G) may be appended to the bandwidth value (eg. '5.5k' is 5.5 kilobytes/sec, '2M' is 2 Megabytes/sec)." +property :timeout, String, regex: /^\d+$/, description: 'Number of seconds to wait for a connection before timing out.' +property :tolerant, [true, false], description: "If enabled, yum will go slower, checking for things that shouldn't be possible making it more tolerant of external errors. Default to '0' (not tolerant)." +property :tsflags, String, description: "Comma or space separated list of transaction flags to pass to the rpm transaction set. These include 'noscripts', 'notriggers', 'nodocs', 'test', 'justdb' and 'nocontexts'. 'repackage' is also available but that does nothing with newer rpm versions. You can set all/any of them. However, if you don't know what these do in the context of an rpm transaction set you're best leaving it alone." +property :ui_repoid_vars, String, description: 'When a repository id is displayed, append these yum variables to the string if they are used in the baseurl/etc. Variables are appended in the order listed (and found).' +property :upgrade_group_objects_upgrade, [true, false], description: "Set this to false to disable the automatic running of 'group upgrade' when running the 'upgrade' command, and group_command is set to 'objects'." +property :upgrade_requirements_on_install, [true, false], description: "When installing/reinstalling/upgrading packages go through each package's installed dependencies and check for an update." +property :usercache, String, description: "Determines whether or not yum should store per-user cache in $TMPDIR. When set to '0', then whenever yum runs as a non-root user, --cacheonly is implied and system cache is used directly, and no new user cache is created in $TMPDIR. This can be used to prevent $TMPDIR from filling up if many users on the system often use yum and root tends to have up-to-date metadata that the users can rely on (they can still enable this feature with --setopt if they wish)." +property :username, String, description: 'username to use for basic authentication to a repo or really any url.' +property :usr_w_check, [true, false], description: "Set this to false to disable the checking for writability on /usr in the installroot (when going into the depsolving stage). Yum's default is true." + +alias_method :max_retries, :retries action :create do template new_resource.path do diff --git a/cookbooks/yum/templates/main.erb b/cookbooks/yum/templates/main.erb index 19e6710..28a163f 100644 --- a/cookbooks/yum/templates/main.erb +++ b/cookbooks/yum/templates/main.erb @@ -1,4 +1,4 @@ -# This file was generated by Chef +# This file was generated by Chef Infra Client # Do NOT modify this file by hand. [main] @@ -113,6 +113,16 @@ history_record_packages=<%= @config.history_record_packages %> <% if @config.http_caching %> http_caching=<%= @config.http_caching %> <% end %> +<% if @config.ip_resolve %> +ip_resolve=<%= @config.ip_resolve %> +<% end %> +<% unless @config.install_weak_deps.nil? %> +<% if @config.install_weak_deps %> +install_weak_deps=1 +<% else %> +install_weak_deps=0 +<% end %> +<% end %> <% if @config.installonly_limit %> installonly_limit=<%= @config.installonly_limit %> <% end %> diff --git a/nodes/bitcoin-2.json b/nodes/bitcoin-2.json index d4548b3..aaa9fcf 100644 --- a/nodes/bitcoin-2.json +++ b/nodes/bitcoin-2.json @@ -25,7 +25,7 @@ "kosmos-bitcoin::lnd", "kosmos-bitcoin::rtl", "kosmos-bitcoin::lndhub", - "kosmos-postgresql::hostsfile", + "kosmos_postgresql::hostsfile", "kosmos-bitcoin::dotnet", "kosmos-bitcoin::nbxplorer", "kosmos-bitcoin::btcpay",