From e416c2135870678656ab534d516b32f6be7c1c35 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Tue, 17 Sep 2024 19:10:38 -0700 Subject: [PATCH] rm manage_ruby_dependency param & r10k::install::gem This parameter has an UNDECLARED dependency on the EOL puppetlabs/ruby module. That module uses legacy facts and is not compatible with puppet8. --- .fixtures.yml | 1 - README.md | 20 +------------ REFERENCE.md | 33 --------------------- manifests/init.pp | 4 +-- manifests/install.pp | 8 +---- manifests/install/gem.pp | 29 ------------------ manifests/params.pp | 1 - spec/classes/init_spec.rb | 11 ------- spec/classes/install/gem_spec.rb | 51 -------------------------------- spec/classes/webhook_spec.rb | 4 +-- 10 files changed, 5 insertions(+), 157 deletions(-) delete mode 100644 manifests/install/gem.pp delete mode 100644 spec/classes/install/gem_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml index bc226152..8785da72 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -7,7 +7,6 @@ fixtures: git: https://github.com/puppetlabs/puppetlabs-git.git inifile: https://github.com/puppetlabs/puppetlabs-inifile.git mcollective: https://github.com/choria-io/puppet-mcollective.git - ruby: https://github.com/puppetlabs/puppetlabs-ruby.git systemd: https://github.com/voxpupuli/puppet-systemd.git vcsrepo: https://github.com/puppetlabs/puppetlabs-vcsrepo.git yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git diff --git a/README.md b/README.md index 13b5e631..5e095194 100644 --- a/README.md +++ b/README.md @@ -615,9 +615,6 @@ Deprecated: for older [configfile](https://docs.puppetlabs.com/puppet/latest/ref ##### `manage_modulepath` Deprecated: declare a resource for managing `modulepath` in Puppet.conf -##### `manage_ruby_dependency` -When using system ruby , options on how to declare - ##### `proxy` A string setting the`r10k.yaml` configuration value of the same name @@ -628,22 +625,7 @@ An optional string specifying location to retrieve gem Integer defining how many threads should be spawn while updating modules. Only available for r10k >= 3.3.0. ##### `r10k_basedir` -This module requires the [puppetlabs-ruby](https://github.com/puppetlabs/puppetlabs-ruby.git) module. In the event that your environment already includes -the module with some customization, you can use the `manage_ruby_dependency` -parameter to adjust how this module expresses that requirement. -The supported values are `include`,`declare`, or `ignore`. The values' behavior -is outlined below: - - * *declare* **default** This will explicitly declare the ruby module. - Additional declarations of the ruby module will result in an inability to - compile a catalog. - - * *include* This will simply include the ruby module. When combined with class - ordering, this will permit the user to manage the instantiation of the ruby module elsewhere, potentially with non-standard parameter values. - - * *ignore* This will assume that ruby is handled via some other mechanism than - a puppet module named `ruby`. It is left to the user to insure the - requirement be met. + ##### `package_name` The name of the package to be installed via the provider diff --git a/REFERENCE.md b/REFERENCE.md index 0eba9768..69433752 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -10,7 +10,6 @@ * [`r10k`](#r10k): This class configures r10k * [`r10k::install::bundle`](#r10k--install--bundle): This class installs the r10k bundle -* [`r10k::install::gem`](#r10k--install--gem): Install the r10k gem using system ruby * [`r10k::install::puppet_gem`](#r10k--install--puppet_gem): This class links the r10k binary for Puppet FOSS 4.2 and up * [`r10k::mcollective`](#r10k--mcollective): Install the r10k mcollective agent * [`r10k::mcollective::application`](#r10k--mcollective--application): Install the r10k mcollective application to a client @@ -55,7 +54,6 @@ The following parameters are available in the `r10k` class: * [`puppet_master`](#-r10k--puppet_master) * [`modulepath`](#-r10k--modulepath) * [`manage_modulepath`](#-r10k--manage_modulepath) -* [`manage_ruby_dependency`](#-r10k--manage_ruby_dependency) * [`r10k_basedir`](#-r10k--r10k_basedir) * [`package_name`](#-r10k--package_name) * [`provider`](#-r10k--provider) @@ -128,14 +126,6 @@ Data type: `Boolean` Default value: `$r10k::params::manage_modulepath` -##### `manage_ruby_dependency` - -Data type: `Enum['include','declare','ignore']` - - - -Default value: `$r10k::params::manage_ruby_dependency` - ##### `r10k_basedir` Data type: `Stdlib::Absolutepath` @@ -347,29 +337,6 @@ Data type: `String[1]` Default value: `'https://github.com/adrienthebo/r10k.git'` -### `r10k::install::gem` - -Install the r10k gem using system ruby - -#### Parameters - -The following parameters are available in the `r10k::install::gem` class: - -* [`manage_ruby_dependency`](#-r10k--install--gem--manage_ruby_dependency) -* [`version`](#-r10k--install--gem--version) - -##### `manage_ruby_dependency` - -Data type: `String[1]` - - - -##### `version` - -Data type: `String[1]` - -R10k gem version - ### `r10k::install::puppet_gem` This class links the r10k binary for Puppet FOSS 4.2 and up diff --git a/manifests/init.pp b/manifests/init.pp index c5465086..bb1c45b3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,7 +6,6 @@ # @param puppet_master # @param modulepath # @param manage_modulepath -# @param manage_ruby_dependency # @param r10k_basedir # @param package_name # @param provider @@ -23,7 +22,7 @@ # @param puppetconf_path # @param cachedir # Path to a directory to be used by r10k for caching data -# @param sources +# @param sources # Hash containing data sources to be used by r10k to create dynamic Puppet environments # @param postrun # Array containing the parts of a system call Example: ['/usr/bin/curl', '-F', 'deploy=done', 'http://my-app.site/endpoint'] @@ -48,7 +47,6 @@ Boolean $puppet_master = $r10k::params::puppet_master, String[1] $modulepath = $r10k::params::modulepath, Boolean $manage_modulepath = $r10k::params::manage_modulepath, - Enum['include','declare','ignore'] $manage_ruby_dependency = $r10k::params::manage_ruby_dependency, Stdlib::Absolutepath $r10k_basedir = $r10k::params::r10k_basedir, String[1] $package_name = $r10k::params::package_name, String[1] $provider = $r10k::params::provider, diff --git a/manifests/install.pp b/manifests/install.pp index c51ab1f9..27728f87 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -11,13 +11,7 @@ include r10k::install::bundle } 'puppet_gem', 'gem', 'openbsd', 'pkgng', 'pacman', 'portage': { - if $r10k::provider == 'gem' { - class { 'r10k::install::gem': - manage_ruby_dependency => $r10k::manage_ruby_dependency, - version => $r10k::version; - } - } - elsif $r10k::provider == 'puppet_gem' { + if $r10k::provider == 'puppet_gem' { # Puppet FOSS 4.2 and up ships a vendor provided ruby. # Using puppet_gem uses that instead of the system ruby. include r10k::install::puppet_gem diff --git a/manifests/install/gem.pp b/manifests/install/gem.pp deleted file mode 100644 index 592c2f16..00000000 --- a/manifests/install/gem.pp +++ /dev/null @@ -1,29 +0,0 @@ -# @summary Install the r10k gem using system ruby -# -# @param manage_ruby_dependency -# @param version -# R10k gem version -# -class r10k::install::gem ( - String[1] $manage_ruby_dependency, - String[1] $version, -) { - case $manage_ruby_dependency { - 'include': { - include ruby - require ruby::dev - Class['ruby'] -> Class['ruby::dev'] - } - 'declare': { - class { 'ruby': - rubygems_update => false, - } - require ruby::dev - Class['ruby'] -> Class['ruby::dev'] - } - default: { - #This catches the 'ignore' case, and satisfies the 'default' requirement - #do nothing - } - } -} diff --git a/manifests/params.pp b/manifests/params.pp index cb31fccb..a578fa5c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,7 +6,6 @@ } $version = 'installed' $manage_modulepath = false - $manage_ruby_dependency = 'ignore' $root_user = 'root' $root_group = 'root' diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 7a0fbc14..8e145e57 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -166,15 +166,12 @@ let :params do { install_options: '', - manage_ruby_dependency: 'declare', provider: 'gem', version: version, puppet_master: true } end - it { is_expected.to contain_class('r10k::install::gem').with(version: version) } - it do expect(subject).to contain_package('r10k').with( ensure: version, @@ -186,7 +183,6 @@ context 'with gem with empty install_options', if: os_facts[:os]['name'] != 'Gentoo' do let :params do { - manage_ruby_dependency: 'include', provider: 'gem', version: version, install_options: [], @@ -206,7 +202,6 @@ context 'with gem with populated install_options', if: os_facts[:os]['name'] != 'Gentoo' do let :params do { - manage_ruby_dependency: 'include', provider: 'gem', version: version, install_options: ['BOGON'], @@ -228,7 +223,6 @@ { version: version, provider: 'puppet_gem', - manage_ruby_dependency: 'declare', install_options: '' } end @@ -246,7 +240,6 @@ context 'with puppet_gem on Puppet FOSS' do let :params do { - manage_ruby_dependency: 'declare', install_options: '', provider: 'puppet_gem', version: version, @@ -272,7 +265,6 @@ context 'with defaults and source specified', if: os_facts[:os]['name'] != 'Gentoo' do let :params do { - manage_ruby_dependency: 'include', provider: 'gem', version: version, gem_source: 'https://some.alternate.source.com/', @@ -281,8 +273,6 @@ } end - it { is_expected.to contain_class('r10k::install::gem') } - it do expect(subject).to contain_package('r10k').with( ensure: version, @@ -297,7 +287,6 @@ { version: version, provider: 'bundle', - manage_ruby_dependency: 'declare', install_options: '', puppet_master: true } diff --git a/spec/classes/install/gem_spec.rb b/spec/classes/install/gem_spec.rb deleted file mode 100644 index 0796cc12..00000000 --- a/spec/classes/install/gem_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -version = '2.0.0' - -describe 'r10k::install::gem', type: :class do - on_supported_os.each do |os, facts| - context "on #{os}" do - let :facts do - facts - end - - context "installing version '#{version}' via gem", if: facts[:os]['name'] != 'Gentoo' do - let :params do - { - manage_ruby_dependency: 'declare', - version: version - } - end - - it { is_expected.to contain_class('ruby').with(rubygems_update: false) } - it { is_expected.to contain_class('ruby::dev') } - - context 'when manage_ruby_dependency is set to "include"' do - let :params do - { - manage_ruby_dependency: 'include', - version: version - } - end - - it { is_expected.to contain_class('ruby').with(rubygems_update: false) } - it { is_expected.to contain_class('ruby::dev') } - end - - context 'when manage_ruby_dependency is set to "ignore"' do - let :params do - { - manage_ruby_dependency: 'ignore', - version: version - } - end - - it { is_expected.not_to contain_class('ruby') } - it { is_expected.not_to contain_class('ruby::dev') } - end - end - end - end -end diff --git a/spec/classes/webhook_spec.rb b/spec/classes/webhook_spec.rb index d3c4c250..2ace00bc 100644 --- a/spec/classes/webhook_spec.rb +++ b/spec/classes/webhook_spec.rb @@ -10,7 +10,7 @@ end context 'with default params' do - if %w[archlinux-rolling-x86_64 gentoo-2-x86_64].include?(os) + if %w[archlinux-rolling-x86_64 archlinux-6-x86_64 gentoo-2-x86_64].include?(os) it { is_expected.not_to compile } else it { is_expected.to compile.with_all_deps } @@ -89,7 +89,7 @@ generate_types: true ' context 'with default install_method' do - if %w[archlinux-rolling-x86_64 gentoo-2-x86_64].include?(os) + if %w[archlinux-rolling-x86_64 archlinux-6-x86_64 gentoo-2-x86_64].include?(os) it { is_expected.not_to compile } else it { is_expected.to compile.with_all_deps }