From 411c9f0d1dc1dfd3aa92f868c2fc9e2caa30129c Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Fri, 17 Mar 2023 11:24:12 -0400 Subject: [PATCH 1/2] Updates - Including drop Debian 9 support PDK update Lots of lint fixes --- .fixtures.yml | 23 ++++++--- .github/workflows/ci.yaml | 19 +++---- .rubocop.yml | 39 ++++++--------- .sync.yml | 20 ++++++-- Gemfile | 26 ++++------ Rakefile | 2 +- lib/facter/globus_info.rb | 2 + lib/facter/globus_node_setup.rb | 2 + lib/facter/util/globus.rb | 4 ++ .../functions/globus/endpoint_setup_args.rb | 2 + .../functions/globus/node_setup_args.rb | 2 + .../globus_connect_config/ini_setting.rb | 2 + lib/puppet/type/globus_connect_config.rb | 10 ++-- manifests/cli.pp | 1 - manifests/config.pp | 46 ++++++++--------- manifests/init.pp | 12 ++--- manifests/install.pp | 2 - manifests/repo/deb.pp | 1 - manifests/repo/el.pp | 2 +- manifests/sdk.pp | 1 - manifests/service.pp | 1 - manifests/timer.pp | 1 - manifests/user.pp | 2 - metadata.json | 3 +- spec/acceptance/globus_cli_spec.rb | 2 + spec/acceptance/globus_sdk_spec.rb | 2 + spec/acceptance/globus_spec.rb | 2 + spec/acceptance/globus_timer_spec.rb | 2 + spec/acceptance/nodesets/debian-9.yml | 28 ----------- .../nodesets/{centos-7.yml => el7.yml} | 4 +- .../nodesets/{rocky-8.yml => el8.yml} | 4 +- spec/acceptance/nodesets/ubuntu-1804.yml | 2 +- spec/classes/globus_cli_spec.rb | 15 +++--- spec/classes/globus_sdk_spec.rb | 15 +++--- spec/classes/globus_spec.rb | 50 ++++++++++--------- spec/classes/globus_timer_spec.rb | 15 +++--- spec/default_module_facts.yml | 2 + spec/shared_examples/globus_config.rb | 10 ++-- spec/shared_examples/globus_configv4.rb | 8 +-- spec/shared_examples/globus_install.rb | 2 + spec/shared_examples/globus_installv4.rb | 2 + spec/shared_examples/globus_repo_deb.rb | 8 ++- spec/shared_examples/globus_repo_debv4.rb | 6 ++- spec/shared_examples/globus_repo_el.rb | 3 ++ spec/shared_examples/globus_repo_elv4.rb | 4 ++ spec/shared_examples/globus_service.rb | 2 + spec/shared_examples/globus_servicev4.rb | 2 + spec/shared_examples/globus_user.rb | 9 ++-- spec/spec_helper.rb | 8 +-- spec/spec_helper_acceptance.rb | 4 +- spec/spec_helper_acceptance_setup.rb | 2 + spec/spec_helper_local.rb | 19 ++++--- spec/unit/facter/globus_info_spec.rb | 2 + spec/unit/facter/globus_node_setup_spec.rb | 2 + .../globus_connect_config/ini_setting_spec.rb | 2 + .../puppet/type/globus_connect_config_spec.rb | 2 + 56 files changed, 250 insertions(+), 215 deletions(-) delete mode 100644 spec/acceptance/nodesets/debian-9.yml rename spec/acceptance/nodesets/{centos-7.yml => el7.yml} (65%) rename spec/acceptance/nodesets/{rocky-8.yml => el8.yml} (88%) diff --git a/.fixtures.yml b/.fixtures.yml index a00bd8a..09e8d01 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,11 +1,18 @@ fixtures: - repositories: - stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git - epel: https://github.com/voxpupuli/puppet-epel.git - apt: https://github.com/puppetlabs/puppetlabs-apt.git - inifile: https://github.com/puppetlabs/puppetlabs-inifile.git - firewall: https://github.com/puppetlabs/puppetlabs-firewall.git - yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git - python: https://github.com/voxpupuli/puppet-python.git + forge_modules: + stdlib: + repo: puppetlabs/stdlib + epel: + repo: puppet/epel + apt: + repo: puppetlabs/apt + inifile: + repo: puppetlabs/inifile + firewall: + repo: puppetlabs/firewall + yumrepo_core: + repo: puppetlabs/yumrepo_core + python: + repo: puppet/python symlinks: globus: "#{source_dir}" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d7a7e3a..b56205f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,7 @@ on: - master pull_request: + jobs: unit: runs-on: ubuntu-latest @@ -15,11 +16,11 @@ jobs: fail-fast: false matrix: include: - - ruby: 2.5.7 + - ruby: 2.5.9 puppet: 6 fixtures: .fixtures.yml allow_failure: false - - ruby: 2.7.0 + - ruby: 2.7.6 puppet: 7 fixtures: .fixtures.yml allow_failure: false @@ -36,6 +37,7 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Validate run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint @@ -47,9 +49,8 @@ jobs: fail-fast: false matrix: set: - - "centos-7" - - "rocky-8" - - "debian-9" + - "el7" + - "el8" - "debian-10" - "ubuntu-1804" - "ubuntu-2004" @@ -65,19 +66,13 @@ jobs: run: | echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json sudo service docker restart - # https://github.com/actions/virtual-environments/issues/181#issuecomment-610874237 - - name: apparmor - run: | - set -x - sudo apt-get remove mysql-server --purge - sudo apt-get install apparmor-profiles - sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Run tests run: bundle exec rake beaker diff --git a/.rubocop.yml b/.rubocop.yml index 5307849..01bca0f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,11 @@ --- require: - rubocop-rspec -- rubocop-i18n AllCops: DisplayCopNames: true - TargetRubyVersion: '2.1' + TargetRubyVersion: '2.5' Include: - - "./**/*.rb" + - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" @@ -21,13 +20,6 @@ AllCops: Metrics/LineLength: Description: People have wide screens, use them. Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. @@ -40,10 +32,6 @@ Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: true Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact @@ -72,13 +60,20 @@ Style/TrailingCommaInArguments: Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: - Description: Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets +RSpec/ImplicitSubject: + Enabled: false +Lint/BooleanSymbol: + Enabled: false +Naming/MethodParameterName: + AllowedNames: + - is +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/RepeatedDescription: + Enabled: false RSpec/MessageSpies: EnforcedStyle: receive Style/Documentation: @@ -93,15 +88,9 @@ Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true -GetText/DecorateFunctionMessage: - Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: - Enabled: false -GetText/DecorateStringFormattingUsingPercent: - Enabled: false Layout/EndOfLine: Enabled: false -Layout/IndentHeredoc: +Layout/HeredocIndentation: Enabled: false Metrics/AbcSize: Enabled: false diff --git a/.sync.yml b/.sync.yml index c1f0a54..d9e109a 100644 --- a/.sync.yml +++ b/.sync.yml @@ -2,19 +2,33 @@ .github/workflows/ci.yaml: acceptance_matrix: set: - - centos-7 - - rocky-8 - - debian-9 + - el7 + - el8 + - ---el9 - debian-10 - ubuntu-1804 - ubuntu-2004 puppet: - puppet6 - puppet7 +.rubocop.yml: + profiles: + strict: + configs: + RSpec/RepeatedExampleGroupBody: + Enabled: false + RSpec/RepeatedDescription: + Enabled: false .gitlab-ci.yml: delete: true appveyor.yml: delete: true +spec/acceptance/nodesets/el9.yml: + delete: true +spec/acceptance/nodesets/debian-11.yml: + delete: true +spec/acceptance/nodesets/ubuntu-2204.yml: + delete: true spec/acceptance/nodesets/centos-7.yml: extra_commands: - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' diff --git a/Gemfile b/Gemfile index 2f01d84..4bc7150 100644 --- a/Gemfile +++ b/Gemfile @@ -17,30 +17,22 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-lint-param-docs", require: false - gem "github_changelog_generator", require: false + gem "voxpupuli-test", '5.4.1', require: false + gem "faraday", '~> 1.0', require: false + gem "github_changelog_generator", require: false + gem "puppet-blacksmith", require: false + gem "puppet-strings", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0') + gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-pe", require: false gem "beaker-hostgenerator" gem "beaker-rspec" - gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || '~> 0.7.0') + gem "beaker-docker" gem "beaker-puppet" + gem "beaker-puppet_install_helper", require: false + gem "beaker-module_install_helper", require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index dc7ab0a..1bdbda9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' +require 'beaker-rspec/rake_task' if Bundler.rubygems.find_name('beaker-rspec').any? require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? diff --git a/lib/facter/globus_info.rb b/lib/facter/globus_info.rb index a78ed3e..9b0ce51 100644 --- a/lib/facter/globus_info.rb +++ b/lib/facter/globus_info.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'json' require 'facter/util/globus' diff --git a/lib/facter/globus_node_setup.rb b/lib/facter/globus_node_setup.rb index 158f18b..c68067e 100644 --- a/lib/facter/globus_node_setup.rb +++ b/lib/facter/globus_node_setup.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'facter/util/globus' Facter.add('globus_node_setup') do diff --git a/lib/facter/util/globus.rb b/lib/facter/util/globus.rb index ec128e2..156b4d2 100644 --- a/lib/facter/util/globus.rb +++ b/lib/facter/util/globus.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Util class for Globus facts class Facter::Util::Globus def self.info @@ -10,8 +12,10 @@ def self.info_exists? def self.read_info return nil unless info_exists? + f = File.read(info) return nil if f.nil? + value = nil begin value = JSON.parse(f) diff --git a/lib/puppet/functions/globus/endpoint_setup_args.rb b/lib/puppet/functions/globus/endpoint_setup_args.rb index decb2c4..4c1c30a 100644 --- a/lib/puppet/functions/globus/endpoint_setup_args.rb +++ b/lib/puppet/functions/globus/endpoint_setup_args.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Functions.create_function(:'globus::endpoint_setup_args') do dispatch :args do param 'Hash', :values diff --git a/lib/puppet/functions/globus/node_setup_args.rb b/lib/puppet/functions/globus/node_setup_args.rb index e8199c5..572605f 100644 --- a/lib/puppet/functions/globus/node_setup_args.rb +++ b/lib/puppet/functions/globus/node_setup_args.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Functions.create_function(:'globus::node_setup_args') do dispatch :args do param 'Hash', :values diff --git a/lib/puppet/provider/globus_connect_config/ini_setting.rb b/lib/puppet/provider/globus_connect_config/ini_setting.rb index 12c731d..c480821 100644 --- a/lib/puppet/provider/globus_connect_config/ini_setting.rb +++ b/lib/puppet/provider/globus_connect_config/ini_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:globus_connect_config).provide( :ini_setting, parent: Puppet::Type.type(:ini_setting).provider(:ruby), diff --git a/lib/puppet/type/globus_connect_config.rb b/lib/puppet/type/globus_connect_config.rb index 56b2360..859e5bf 100644 --- a/lib/puppet/type/globus_connect_config.rb +++ b/lib/puppet/type/globus_connect_config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.newtype(:globus_connect_config) do ensurable @@ -47,16 +49,14 @@ def should_to_s(newvalue) end validate do - if self[:ensure] == :present - if self[:value].nil? - raise Puppet::Error, "Property value must be set for #{self[:name]} when ensure is present" - end + if self[:ensure] == :present && self[:value].nil? + raise Puppet::Error, "Property value must be set for #{self[:name]} when ensure is present" end end autorequire(:file) do [ - '/etc/globus-connect-server.conf', + '/etc/globus-connect-server.conf' ] end end diff --git a/manifests/cli.pp b/manifests/cli.pp index 866850d..e8cc235 100644 --- a/manifests/cli.pp +++ b/manifests/cli.pp @@ -14,7 +14,6 @@ Stdlib::Absolutepath $install_path = '/opt/globus-cli', Boolean $manage_python = true, ) { - if $manage_python { include globus::python } diff --git a/manifests/config.pp b/manifests/config.pp index 66c3b06..63e9108 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,7 +1,6 @@ # @summary Manage globus configs # @api private class globus::config { - if $globus::run_setup_commands { $_globus_connect_config_notify = Exec['globus-connect-server-setup'] $_resources_require_setup = Exec['globus-connect-server-setup'] @@ -111,19 +110,19 @@ } if String($globus::version) == '5' { $endpoint_setup_args = globus::endpoint_setup_args({ - display_name => $globus::display_name, - client_id => $globus::client_id, - client_secret => $globus::client_secret, - owner => $globus::owner, - deployment_key => $globus::deployment_key, - organization => $globus::organization, - keywords => $globus::keywords, - department => $globus::department, - contact_email => $globus::contact_email, - contact_info => $globus::contact_info, - info_link => $globus::info_link, - description => $globus::description, - public => $globus::public, + display_name => $globus::display_name, + client_id => $globus::client_id, + client_secret => $globus::client_secret, + owner => $globus::owner, + deployment_key => $globus::deployment_key, + organization => $globus::organization, + keywords => $globus::keywords, + department => $globus::department, + contact_email => $globus::contact_email, + contact_info => $globus::contact_info, + info_link => $globus::info_link, + description => $globus::description, + public => $globus::public, }) $endpoint_setup = "globus-connect-server endpoint setup ${endpoint_setup_args}" file { '/root/globus-endpoint-setup': @@ -132,16 +131,16 @@ group => 'root', mode => '0700', show_diff => false, - content => "export GLOBUS_CLIENT_SECRET=${globus::client_secret}\n${endpoint_setup}\n" + content => "export GLOBUS_CLIENT_SECRET=${globus::client_secret}\n${endpoint_setup}\n", } $node_setup_args = globus::node_setup_args({ - client_id => $globus::client_id, - deployment_key => $globus::deployment_key, - incoming_port_range => $globus::incoming_port_range, - outgoing_port_range => $globus::outgoing_port_range, - ip_address => $globus::_ip_address, - export_node => $globus::export_node, - import_node => $globus::import_node, + client_id => $globus::client_id, + deployment_key => $globus::deployment_key, + incoming_port_range => $globus::incoming_port_range, + outgoing_port_range => $globus::outgoing_port_range, + ip_address => $globus::_ip_address, + export_node => $globus::export_node, + import_node => $globus::import_node, }) $node_setup = "globus-connect-server node setup ${node_setup_args}" file { '/root/globus-node-setup': @@ -150,7 +149,7 @@ group => 'root', mode => '0700', show_diff => false, - content => "export GLOBUS_CLIENT_SECRET=${globus::client_secret}\n${node_setup}\n" + content => "export GLOBUS_CLIENT_SECRET=${globus::client_secret}\n${node_setup}\n", } if $globus::run_setup_commands { exec { 'globus-endpoint-setup': @@ -239,5 +238,4 @@ } } } - } diff --git a/manifests/init.pp b/manifests/init.pp index 9bf811b..fca465e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -292,7 +292,7 @@ # Endpoint Config - v4 Boolean $endpoint_public = false, String $endpoint_default_directory = '/~/', - String $endpoint_name = $::hostname, + String $endpoint_name = $facts['networking']['hostname'], # Security Config - v4 Boolean $security_fetch_credentials_from_relay = true, @@ -337,7 +337,6 @@ Optional[String] $oauth_stylesheet = undef, Optional[String] $oauth_logo = undef, ) { - $osfamily = $facts.dig('os', 'family') $osmajor = $facts.dig('os', 'release', 'major') $os = "${osfamily}-${osmajor}" @@ -365,7 +364,7 @@ } if $include_io_server { - $_gridftp_server = pick($gridftp_server, "${::fqdn}:${gridftp_server_port}") + $_gridftp_server = pick($gridftp_server, "${facts['networking']['fqdn']}:${gridftp_server_port}") $_io_setup_command = 'globus-connect-server-io-setup' } else { $_gridftp_server = $gridftp_server @@ -373,7 +372,7 @@ } if $include_id_server { - $_myproxy_server = pick($myproxy_server, "${::fqdn}:${myproxy_server_port}") + $_myproxy_server = pick($myproxy_server, "${facts['networking']['fqdn']}:${myproxy_server_port}") $_id_setup_command = 'globus-connect-server-id-setup' } else { $_myproxy_server = $myproxy_server @@ -381,7 +380,7 @@ } if $include_oauth_server { - $_oauth_server = pick($oauth_server, $::fqdn) + $_oauth_server = pick($oauth_server, $facts['networking']['fqdn']) $_oauth_setup_command = 'globus-connect-server-web-setup' } else { $_oauth_server = $oauth_server @@ -418,7 +417,7 @@ case $osfamily { 'RedHat': { if $manage_epel { - include ::epel + include epel Class['epel'] -> Class['globus::repo::el'] } contain globus::repo::el @@ -434,5 +433,4 @@ # Do nothing } } - } diff --git a/manifests/install.pp b/manifests/install.pp index 96a89c3..9d70e46 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,7 +1,6 @@ # @summary manage Globus install # @api private class globus::install { - if String($globus::version) == '4' { if $globus::include_io_server { package { 'globus-connect-server-io': @@ -27,5 +26,4 @@ ensure => 'present', } } - } diff --git a/manifests/repo/deb.pp b/manifests/repo/deb.pp index a256cd7..e071906 100644 --- a/manifests/repo/deb.pp +++ b/manifests/repo/deb.pp @@ -1,7 +1,6 @@ # @summary Manage globus repo # @api private class globus::repo::deb { - $release_name = basename($globus::release_url) $repo_dir = '/usr/share/globus-toolkit-repo' $release_path = "${repo_dir}/${release_name}" diff --git a/manifests/repo/el.pp b/manifests/repo/el.pp index bdb935b..851849b 100644 --- a/manifests/repo/el.pp +++ b/manifests/repo/el.pp @@ -25,7 +25,7 @@ path => '/usr/bin:/bin:/usr/sbin:/sbin', command => "wget -qO- ${globus::release_url} | rpm2cpio - | cpio -i --quiet --to-stdout ./etc/pki/rpm-gpg/RPM-GPG-KEY-Globus > /etc/pki/rpm-gpg/RPM-GPG-KEY-Globus", creates => '/etc/pki/rpm-gpg/RPM-GPG-KEY-Globus', - before => Yumrepo['Globus-Toolkit'] + before => Yumrepo['Globus-Toolkit'], } yumrepo { 'Globus-Toolkit': diff --git a/manifests/sdk.pp b/manifests/sdk.pp index e43bd27..9c39a95 100644 --- a/manifests/sdk.pp +++ b/manifests/sdk.pp @@ -14,7 +14,6 @@ Stdlib::Absolutepath $install_path = '/opt/globus-sdk', Boolean $manage_python = true, ) { - if $manage_python { include globus::python } diff --git a/manifests/service.pp b/manifests/service.pp index 08480f1..f4d9f01 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,7 +1,6 @@ # @summary Manage Globus service # @api private class globus::service { - if ($globus::include_io_server or String($globus::version) == '5') and $globus::manage_service { service { 'globus-gridftp-server': ensure => 'running', diff --git a/manifests/timer.pp b/manifests/timer.pp index ff73a48..69c88cd 100644 --- a/manifests/timer.pp +++ b/manifests/timer.pp @@ -14,7 +14,6 @@ Stdlib::Absolutepath $install_path = '/opt/globus-timer', Boolean $manage_python = true, ) { - if $manage_python { include globus::python } diff --git a/manifests/user.pp b/manifests/user.pp index 5e3003f..c5cac04 100644 --- a/manifests/user.pp +++ b/manifests/user.pp @@ -1,7 +1,6 @@ # @summary Manage globus user and group # @api private class globus::user { - if $globus::osfamily == 'Debian' { $shell = '/bin/false' } else { @@ -27,5 +26,4 @@ forcelocal => true, } } - } diff --git a/metadata.json b/metadata.json index b4c1f37..7c62bff 100644 --- a/metadata.json +++ b/metadata.json @@ -56,7 +56,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "9", "10" ] }, @@ -82,5 +81,5 @@ ], "pdk-version": "2.1.0", "template-url": "https://github.com/treydock/pdk-templates.git#master", - "template-ref": "heads/master-0-g089be8b" + "template-ref": "heads/master-0-g77d89fa" } diff --git a/spec/acceptance/globus_cli_spec.rb b/spec/acceptance/globus_cli_spec.rb index 9032924..a64e9d7 100644 --- a/spec/acceptance/globus_cli_spec.rb +++ b/spec/acceptance/globus_cli_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'globus::cli class:', unless: fact('os.name') == 'Debian' && fact('os.release.major') == '9' do diff --git a/spec/acceptance/globus_sdk_spec.rb b/spec/acceptance/globus_sdk_spec.rb index 0f3bc74..798fba2 100644 --- a/spec/acceptance/globus_sdk_spec.rb +++ b/spec/acceptance/globus_sdk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'globus::sdk class:', unless: fact('os.name') == 'Debian' && fact('os.release.major') == '9' do diff --git a/spec/acceptance/globus_spec.rb b/spec/acceptance/globus_spec.rb index 387d3c5..90955de 100644 --- a/spec/acceptance/globus_spec.rb +++ b/spec/acceptance/globus_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'globus class:' do diff --git a/spec/acceptance/globus_timer_spec.rb b/spec/acceptance/globus_timer_spec.rb index b6f8c37..b33c350 100644 --- a/spec/acceptance/globus_timer_spec.rb +++ b/spec/acceptance/globus_timer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'globus::timer class:', unless: fact('os.name') == 'Debian' && fact('os.release.major') == '9' do diff --git a/spec/acceptance/nodesets/debian-9.yml b/spec/acceptance/nodesets/debian-9.yml deleted file mode 100644 index 0a2caa5..0000000 --- a/spec/acceptance/nodesets/debian-9.yml +++ /dev/null @@ -1,28 +0,0 @@ -HOSTS: - debian9: - roles: - - agent - platform: debian-9-amd64 - hypervisor: docker - image: debian:9 - docker_preserve_image: true - docker_cmd: - - '/sbin/init' - docker_image_commands: - - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates' - - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - - 'locale-gen en_US.UTF-8' - docker_env: - - LANG=en_US.UTF-8 - - LANGUAGE=en_US.UTF-8 - - LC_ALL=en_US.UTF-8 - docker_container_name: 'globus-debian9' -CONFIG: - log_level: debug - type: foss -ssh: - password: root - auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/centos-7.yml b/spec/acceptance/nodesets/el7.yml similarity index 65% rename from spec/acceptance/nodesets/centos-7.yml rename to spec/acceptance/nodesets/el7.yml index 44a21b9..1083378 100644 --- a/spec/acceptance/nodesets/centos-7.yml +++ b/spec/acceptance/nodesets/el7.yml @@ -10,8 +10,8 @@ HOSTS: - '/usr/sbin/init' docker_image_commands: - 'yum install -y wget which cronie iproute initscripts' - - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' + - 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo' + - 'yum update -y systemd' docker_env: - LANG=en_US.UTF-8 - LANGUAGE=en_US.UTF-8 diff --git a/spec/acceptance/nodesets/rocky-8.yml b/spec/acceptance/nodesets/el8.yml similarity index 88% rename from spec/acceptance/nodesets/rocky-8.yml rename to spec/acceptance/nodesets/el8.yml index 035eac9..2e019e3 100644 --- a/spec/acceptance/nodesets/rocky-8.yml +++ b/spec/acceptance/nodesets/el8.yml @@ -4,14 +4,14 @@ HOSTS: - agent platform: el-8-x86_64 hypervisor: docker - image: rockylinux/rockylinux:8 + image: almalinux:8 docker_preserve_image: true docker_cmd: - '/usr/sbin/init' docker_image_commands: - 'dnf install -y dnf-utils' - 'dnf config-manager --set-enabled powertools' - - 'dnf install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks cpio' + - 'dnf install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks glibc-langpack-en cpio' docker_env: - LANG=en_US.UTF-8 - LANGUAGE=en_US.UTF-8 diff --git a/spec/acceptance/nodesets/ubuntu-1804.yml b/spec/acceptance/nodesets/ubuntu-1804.yml index d337b21..5241dd3 100644 --- a/spec/acceptance/nodesets/ubuntu-1804.yml +++ b/spec/acceptance/nodesets/ubuntu-1804.yml @@ -9,7 +9,7 @@ HOSTS: docker_cmd: '["/sbin/init"]' docker_image_commands: - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" - - 'apt-get install -y wget net-tools iproute2 locales apt-transport-https ca-certificates' + - 'apt-get install -y wget net-tools iproute2 locales apt-transport-https ca-certificates lsb-release' - 'locale-gen en_US.UTF-8' docker_env: - LANG=en_US.UTF-8 diff --git a/spec/classes/globus_cli_spec.rb b/spec/classes/globus_cli_spec.rb index b72d287..76fee60 100644 --- a/spec/classes/globus_cli_spec.rb +++ b/spec/classes/globus_cli_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'globus::cli' do @@ -21,19 +23,20 @@ it do is_expected.to contain_python__pyvenv('globus-cli').with( - 'ensure' => 'present', - 'version' => platforms[platform_os][:venv_python_version], - 'venv_dir' => '/opt/globus-cli', + 'ensure' => 'present', + 'version' => platforms[platform_os][:venv_python_version], + 'venv_dir' => '/opt/globus-cli', 'systempkgs' => 'true', ) end + it { is_expected.to contain_python__pyvenv('globus-cli').that_comes_before('Python::Pip[globus-cli]') } it do is_expected.to contain_python__pip('globus-cli').with( - 'ensure' => 'present', - 'pip_provider' => platforms[platform_os][:pip_provider], - 'virtualenv' => '/opt/globus-cli', + 'ensure' => 'present', + 'pip_provider' => platforms[platform_os][:pip_provider], + 'virtualenv' => '/opt/globus-cli', ) end diff --git a/spec/classes/globus_sdk_spec.rb b/spec/classes/globus_sdk_spec.rb index b8d6b7b..e94cd9e 100644 --- a/spec/classes/globus_sdk_spec.rb +++ b/spec/classes/globus_sdk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'globus::sdk' do @@ -21,19 +23,20 @@ it do is_expected.to contain_python__pyvenv('globus-sdk').with( - 'ensure' => 'present', - 'version' => platforms[platform_os][:venv_python_version], - 'venv_dir' => '/opt/globus-sdk', + 'ensure' => 'present', + 'version' => platforms[platform_os][:venv_python_version], + 'venv_dir' => '/opt/globus-sdk', 'systempkgs' => 'true', ) end + it { is_expected.to contain_python__pyvenv('globus-sdk').that_comes_before('Python::Pip[globus-sdk]') } it do is_expected.to contain_python__pip('globus-sdk').with( - 'ensure' => 'present', - 'pip_provider' => platforms[platform_os][:pip_provider], - 'virtualenv' => '/opt/globus-sdk', + 'ensure' => 'present', + 'pip_provider' => platforms[platform_os][:pip_provider], + 'virtualenv' => '/opt/globus-sdk', ) end end diff --git a/spec/classes/globus_spec.rb b/spec/classes/globus_spec.rb index aaf037d..37ae136 100644 --- a/spec/classes/globus_spec.rb +++ b/spec/classes/globus_spec.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'globus' do - on_supported_os.each do |os, facts| + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) do - facts + os_facts end let(:default_params) do @@ -13,7 +15,7 @@ client_secret: 'bar', owner: 'admin@example.com', display_name: 'Example', - organization: 'Example', + organization: 'Example' } end let(:params) { default_params } @@ -22,11 +24,11 @@ it { is_expected.to create_class('globus') } - if facts[:os]['family'] == 'RedHat' + if os_facts[:os]['family'] == 'RedHat' it { is_expected.to contain_class('epel').that_comes_before('Class[globus::repo::el]') } it { is_expected.to contain_class('globus::repo::el').that_comes_before('Class[globus::install]') } end - if facts[:os]['family'] == 'Debian' + if os_facts[:os]['family'] == 'Debian' it { is_expected.to contain_class('globus::repo::deb').that_comes_before('Class[globus::install]') } end it { is_expected.to contain_class('globus::user').that_comes_before('Class[globus::install]') } @@ -34,30 +36,31 @@ it { is_expected.to contain_class('globus::config').that_comes_before('Class[globus::service]') } it { is_expected.to contain_class('globus::service') } - context 'version => 5' do + context 'when version => 5' do let(:params) { default_params } - if facts[:os]['family'] == 'RedHat' - it_behaves_like 'globus::repo::el', facts + if os_facts[:os]['family'] == 'RedHat' + it_behaves_like 'globus::repo::el', os_facts end - if facts[:os]['family'] == 'Debian' + if os_facts[:os]['family'] == 'Debian' it { is_expected.not_to contain_class('epel') } - it_behaves_like 'globus::repo::deb', facts + + it_behaves_like 'globus::repo::deb', os_facts end - it_behaves_like 'globus::user', facts - it_behaves_like 'globus::install', facts - it_behaves_like 'globus::config', facts - it_behaves_like 'globus::service', facts + it_behaves_like 'globus::user', os_facts + it_behaves_like 'globus::install', os_facts + it_behaves_like 'globus::config', os_facts + it_behaves_like 'globus::service', os_facts end - context 'manage_epel => false' do + context 'when manage_epel => false' do let(:params) { default_params.merge(manage_epel: false) } it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_class('epel') } end - context 'version => 4', if: support_v4(facts) do + context 'when version => 4', if: support_v4(os_facts) do let(:default_params) { { version: '4' } } let(:params) { default_params } @@ -66,16 +69,17 @@ it { is_expected.not_to contain_group('gcsweb') } it { is_expected.not_to contain_user('gcsweb') } - if facts[:os]['family'] == 'RedHat' - it_behaves_like 'globus::repo::elv4', facts + if os_facts[:os]['family'] == 'RedHat' + it_behaves_like 'globus::repo::elv4', os_facts end - if facts[:os]['family'] == 'Debian' + if os_facts[:os]['family'] == 'Debian' it { is_expected.not_to contain_class('epel') } - it_behaves_like 'globus::repo::debv4', facts + + it_behaves_like 'globus::repo::debv4', os_facts end - it_behaves_like 'globus::installv4', facts - it_behaves_like 'globus::configv4', facts - it_behaves_like 'globus::servicev4', facts + it_behaves_like 'globus::installv4', os_facts + it_behaves_like 'globus::configv4', os_facts + it_behaves_like 'globus::servicev4', os_facts end end end diff --git a/spec/classes/globus_timer_spec.rb b/spec/classes/globus_timer_spec.rb index d1222d4..2a32552 100644 --- a/spec/classes/globus_timer_spec.rb +++ b/spec/classes/globus_timer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'globus::timer' do @@ -21,19 +23,20 @@ it do is_expected.to contain_python__pyvenv('globus-timer').with( - 'ensure' => 'present', - 'version' => platforms[platform_os][:venv_python_version], - 'venv_dir' => '/opt/globus-timer', + 'ensure' => 'present', + 'version' => platforms[platform_os][:venv_python_version], + 'venv_dir' => '/opt/globus-timer', 'systempkgs' => 'true', ) end + it { is_expected.to contain_python__pyvenv('globus-timer').that_comes_before('Python::Pip[globus-timer-cli]') } it do is_expected.to contain_python__pip('globus-timer-cli').with( - 'ensure' => 'present', - 'pip_provider' => platforms[platform_os][:pip_provider], - 'virtualenv' => '/opt/globus-timer', + 'ensure' => 'present', + 'pip_provider' => platforms[platform_os][:pip_provider], + 'virtualenv' => '/opt/globus-timer', ) end diff --git a/spec/default_module_facts.yml b/spec/default_module_facts.yml index 783f207..bc23be9 100644 --- a/spec/default_module_facts.yml +++ b/spec/default_module_facts.yml @@ -1,4 +1,6 @@ --- networking: + hostname: foo + fqdn: foo.example.com ip: '172.16.254.254' python3_version: '3.5.0' \ No newline at end of file diff --git a/spec/shared_examples/globus_config.rb b/spec/shared_examples/globus_config.rb index 3599e37..10c31c5 100644 --- a/spec/shared_examples/globus_config.rb +++ b/spec/shared_examples/globus_config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::config' do |_facts| let(:endpoint_setup) do [ @@ -6,7 +8,7 @@ "--owner 'admin@example.com'", "--organization 'Example'", '--deployment-key /var/lib/globus-connect-server/gcs-manager/deployment-key.json', - '--agree-to-letsencrypt-tos', + '--agree-to-letsencrypt-tos' ] end let(:node_setup) do @@ -15,7 +17,7 @@ '--client-id foo', '--deployment-key /var/lib/globus-connect-server/gcs-manager/deployment-key.json', '--incoming-port-range 50000 51000', - '--ip-address 172.16.254.254', + '--ip-address 172.16.254.254' ] end @@ -101,7 +103,7 @@ '$LCMAPS_DB_FILE "/etc/lcmaps.db"', '$LCMAPS_POLICY_NAME "authorize_only"', '$LLGT_LIFT_PRIVILEGED_PROTECTION "1"', - '$LCMAPS_DEBUG_LEVEL "2"', + '$LCMAPS_DEBUG_LEVEL "2"' ]) end @@ -122,7 +124,7 @@ '$LCMAPS_DB_FILE "/etc/lcmaps.db"', '$LCMAPS_POLICY_NAME "authorize_only"', '$LLGT_LIFT_PRIVILEGED_PROTECTION "1"', - '$LCMAPS_DEBUG_LEVEL "2"', + '$LCMAPS_DEBUG_LEVEL "2"' ]) end end diff --git a/spec/shared_examples/globus_configv4.rb b/spec/shared_examples/globus_configv4.rb index ba53c4e..3e338ff 100644 --- a/spec/shared_examples/globus_configv4.rb +++ b/spec/shared_examples/globus_configv4.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::configv4' do |facts| it 'purges unmanaged configs' do is_expected.to contain_resources('globus_connect_config').with_purge('true') @@ -18,7 +20,7 @@ it { is_expected.to contain_globus_connect_config('Globus/User').with_value('%(GLOBUS_USER)s').with_notify('Exec[globus-connect-server-setup]') } it { is_expected.to contain_globus_connect_config('Globus/Password').with_value('%(GLOBUS_PASSWORD)s').with_secret('true') } - it { is_expected.to contain_globus_connect_config('Endpoint/Name').with_value(facts[:hostname]) } + it { is_expected.to contain_globus_connect_config('Endpoint/Name').with_value(facts[:networking]['hostname']) } it { is_expected.to contain_globus_connect_config('Endpoint/Public').with_value('false') } it { is_expected.to contain_globus_connect_config('Endpoint/DefaultDirectory').with_value('/~/') } it { is_expected.to contain_globus_connect_config('Security/FetchCredentialFromRelay').with_value('true') } @@ -107,7 +109,7 @@ '$LCMAPS_DB_FILE "/etc/lcmaps.db"', '$LCMAPS_POLICY_NAME "authorize_only"', '$LLGT_LIFT_PRIVILEGED_PROTECTION "1"', - '$LCMAPS_DEBUG_LEVEL "2"', + '$LCMAPS_DEBUG_LEVEL "2"' ]) end @@ -128,7 +130,7 @@ '$LCMAPS_DB_FILE "/etc/lcmaps.db"', '$LCMAPS_POLICY_NAME "authorize_only"', '$LLGT_LIFT_PRIVILEGED_PROTECTION "1"', - '$LCMAPS_DEBUG_LEVEL "2"', + '$LCMAPS_DEBUG_LEVEL "2"' ]) end end diff --git a/spec/shared_examples/globus_install.rb b/spec/shared_examples/globus_install.rb index 65e8081..5dae8e8 100644 --- a/spec/shared_examples/globus_install.rb +++ b/spec/shared_examples/globus_install.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::install' do |_facts| it { is_expected.not_to contain_package('globus-connect-server-io') } it { is_expected.not_to contain_package('globus-connect-server-id') } diff --git a/spec/shared_examples/globus_installv4.rb b/spec/shared_examples/globus_installv4.rb index 60f8b72..bdc1f69 100644 --- a/spec/shared_examples/globus_installv4.rb +++ b/spec/shared_examples/globus_installv4.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::installv4' do |_facts| it { is_expected.to contain_package('globus-connect-server-io').with_ensure('present') } it { is_expected.to contain_package('globus-connect-server-id').with_ensure('present') } diff --git a/spec/shared_examples/globus_repo_deb.rb b/spec/shared_examples/globus_repo_deb.rb index 3e03243..b7ab4d6 100644 --- a/spec/shared_examples/globus_repo_deb.rb +++ b/spec/shared_examples/globus_repo_deb.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::repo::deb' do |facts| let(:release_url) { 'http://downloads.globus.org/toolkit/gt6/stable/installers/repo/deb/globus-toolkit-repo_latest_all.deb' } let(:release_path) { '/usr/share/globus-toolkit-repo/globus-toolkit-repo_latest_all.deb' } @@ -41,11 +43,12 @@ include: { 'src' => 'true' }, key: { 'id' => '66A86341D3CDB1B26BE4D46F44AE7EC2FAF24365', - 'source' => repo_key, + 'source' => repo_key }, require: 'Exec[extract-globus-repo-key]', ) end + it { is_expected.to contain_apt__source('globus-toolkit-6-testing').with_ensure('absent') } it do @@ -57,10 +60,11 @@ include: { 'src' => 'true' }, key: { 'id' => '66A86341D3CDB1B26BE4D46F44AE7EC2FAF24365', - 'source' => repo_key, + 'source' => repo_key }, require: 'Exec[extract-globus-repo-key]', ) end + it { is_expected.to contain_apt__source('globus-connect-server-testing').with_ensure('absent') } end diff --git a/spec/shared_examples/globus_repo_debv4.rb b/spec/shared_examples/globus_repo_debv4.rb index 3015876..d65de64 100644 --- a/spec/shared_examples/globus_repo_debv4.rb +++ b/spec/shared_examples/globus_repo_debv4.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::repo::debv4' do |facts| let(:release_url) { 'http://downloads.globus.org/toolkit/gt6/stable/installers/repo/deb/globus-toolkit-repo_latest_all.deb' } let(:release_path) { '/usr/share/globus-toolkit-repo/globus-toolkit-repo_latest_all.deb' } @@ -41,7 +43,7 @@ include: { 'src' => 'true' }, key: { 'id' => '66A86341D3CDB1B26BE4D46F44AE7EC2FAF24365', - 'source' => repo_key, + 'source' => repo_key }, require: 'Exec[extract-globus-repo-key]', ) @@ -56,7 +58,7 @@ include: { 'src' => 'true' }, key: { 'id' => '66A86341D3CDB1B26BE4D46F44AE7EC2FAF24365', - 'source' => repo_key, + 'source' => repo_key }, require: 'Exec[extract-globus-repo-key]', ) diff --git a/spec/shared_examples/globus_repo_el.rb b/spec/shared_examples/globus_repo_el.rb index 435952f..9c13101 100644 --- a/spec/shared_examples/globus_repo_el.rb +++ b/spec/shared_examples/globus_repo_el.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::repo::el' do |facts| if facts[:operatingsystem] == 'Fedora' let(:url_os) { 'fedora' } @@ -41,5 +43,6 @@ require: 'Exec[RPM-GPG-KEY-Globus]', ) end + it { is_expected.to contain_yumrepo('globus-connect-server-5-testing').with_enabled('0') } end diff --git a/spec/shared_examples/globus_repo_elv4.rb b/spec/shared_examples/globus_repo_elv4.rb index 4563a21..0ca4a3d 100644 --- a/spec/shared_examples/globus_repo_elv4.rb +++ b/spec/shared_examples/globus_repo_elv4.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::repo::elv4' do |facts| if facts[:operatingsystem] == 'Fedora' let(:url_os) { 'fedora' } @@ -30,6 +32,7 @@ gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Globus', ) end + it { is_expected.to contain_yumrepo('Globus-Toolkit-6-Testing').with_enabled('0') } it 'creates Yumrepo[globus-connect-server-5' do @@ -44,5 +47,6 @@ require: 'Exec[RPM-GPG-KEY-Globus]', ) end + it { is_expected.to contain_yumrepo('globus-connect-server-5-testing').with_enabled('0') } end diff --git a/spec/shared_examples/globus_service.rb b/spec/shared_examples/globus_service.rb index 80a29f1..b46a6ae 100644 --- a/spec/shared_examples/globus_service.rb +++ b/spec/shared_examples/globus_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::service' do |os_facts| it do is_expected.to contain_service('globus-gridftp-server').with( diff --git a/spec/shared_examples/globus_servicev4.rb b/spec/shared_examples/globus_servicev4.rb index 0c31807..0eb10bf 100644 --- a/spec/shared_examples/globus_servicev4.rb +++ b/spec/shared_examples/globus_servicev4.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples_for 'globus::servicev4' do |_facts| it do is_expected.to contain_service('globus-gridftp-server').with(ensure: 'running', diff --git a/spec/shared_examples/globus_user.rb b/spec/shared_examples/globus_user.rb index 6f0dd6f..6c7e3de 100644 --- a/spec/shared_examples/globus_user.rb +++ b/spec/shared_examples/globus_user.rb @@ -1,8 +1,11 @@ +# frozen_string_literal: true + shared_examples_for 'globus::user' do |facts| let(:shell) do - if facts[:os]['family'] == 'RedHat' + case facts[:os]['family'] + when 'RedHat' '/sbin/nologin' - elsif facts[:os]['family'] == 'Debian' + when 'Debian' '/bin/false' end end @@ -18,7 +21,7 @@ it do is_expected.to contain_user('gcsweb').with( - ensure: 'present', + ensure: 'present', uid: nil, gid: 'gcsweb', shell: shell, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b367fde..036b5f8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,16 +9,16 @@ require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) -include RspecPuppetFacts +include RspecPuppetFacts # rubocop:disable Style/MixinUsage default_facts = { puppetversion: Puppet.version, - facterversion: Facter.version, + facterversion: Facter.version } default_fact_files = [ File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), + File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')) ] default_fact_files.each do |f| @@ -26,7 +26,7 @@ begin default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e + rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 0f66cf4..d0d3a82 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'beaker-rspec' require 'beaker-puppet' require 'beaker/puppet_install_helper' require 'beaker/module_install_helper' -dir = File.expand_path(File.dirname(__FILE__)) +dir = __dir__ Dir["#{dir}/acceptance/shared_examples/**/*.rb"].sort.each { |f| require f } require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) diff --git a/spec/spec_helper_acceptance_setup.rb b/spec/spec_helper_acceptance_setup.rb index 15dbd52..7de4d6b 100644 --- a/spec/spec_helper_acceptance_setup.rb +++ b/spec/spec_helper_acceptance_setup.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.configure do |c| c.before(:suite) do on hosts, 'mkdir -p /opt/puppetlabs/puppet/cache/lib/facter/' diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 2d43a0a..28bd1ed 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -1,4 +1,6 @@ -dir = File.expand_path(File.dirname(__FILE__)) +# frozen_string_literal: true + +dir = __dir__ Dir["#{dir}/shared_examples/**/*.rb"].sort.each { |f| require f } def platforms @@ -6,37 +8,38 @@ def platforms 'RedHat-7' => { python_version: '3', pip_provider: 'pip3', - venv_python_version: '3.6', + venv_python_version: '3.6' }, 'RedHat-8' => { python_version: '3', pip_provider: 'pip3', - venv_python_version: '3.6', + venv_python_version: '3.6' }, 'Debian-9' => { python_version: '3', pip_provider: 'pip', - venv_python_version: 'system', + venv_python_version: 'system' }, 'Debian-10' => { python_version: '3', pip_provider: 'pip', - venv_python_version: 'system', + venv_python_version: 'system' }, 'Debian-18.04' => { python_version: '3', pip_provider: 'pip', - venv_python_version: 'system', + venv_python_version: 'system' }, 'Debian-20.04' => { python_version: '3', pip_provider: 'pip', - venv_python_version: 'system', - }, + venv_python_version: 'system' + } } end def support_v4(facts) return false if facts[:os]['release']['major'].to_i == 8 && facts[:os]['family'] == 'RedHat' + true end diff --git a/spec/unit/facter/globus_info_spec.rb b/spec/unit/facter/globus_info_spec.rb index 185e3f2..4d9fac6 100644 --- a/spec/unit/facter/globus_info_spec.rb +++ b/spec/unit/facter/globus_info_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'facter/util/globus' diff --git a/spec/unit/facter/globus_node_setup_spec.rb b/spec/unit/facter/globus_node_setup_spec.rb index 182e874..bd66714 100644 --- a/spec/unit/facter/globus_node_setup_spec.rb +++ b/spec/unit/facter/globus_node_setup_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'facter/util/globus' diff --git a/spec/unit/puppet/provider/globus_connect_config/ini_setting_spec.rb b/spec/unit/puppet/provider/globus_connect_config/ini_setting_spec.rb index d5de838..d03fe4d 100644 --- a/spec/unit/puppet/provider/globus_connect_config/ini_setting_spec.rb +++ b/spec/unit/puppet/provider/globus_connect_config/ini_setting_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # these tests are a little concerning b/c they are hacking around the # modulepath, so these tests will not catch issues that may eventually arise diff --git a/spec/unit/puppet/type/globus_connect_config_spec.rb b/spec/unit/puppet/type/globus_connect_config_spec.rb index a2e386e..b8f35cd 100644 --- a/spec/unit/puppet/type/globus_connect_config_spec.rb +++ b/spec/unit/puppet/type/globus_connect_config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # these tests are a little concerning b/c they are hacking around the # modulepath, so these tests will not catch issues that may eventually arise From 159d613cc5ed5a30521da4155c3349f510f703a8 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Fri, 17 Mar 2023 12:15:01 -0400 Subject: [PATCH 2/2] Fix acceptance tests Address conflict with OS mod_auth_openidc Co-authored-by: Yorick Poels --- .sync.yml | 8 ++++---- manifests/install.pp | 8 ++++++++ manifests/service.pp | 15 ++++++++++++++- spec/acceptance/globus_spec.rb | 7 ++++++- spec/acceptance/nodesets/el7.yml | 2 ++ spec/shared_examples/globus_install.rb | 13 ++++++++++++- spec/shared_examples/globus_service.rb | 11 ++++++++++- 7 files changed, 56 insertions(+), 8 deletions(-) diff --git a/.sync.yml b/.sync.yml index d9e109a..bb5cb73 100644 --- a/.sync.yml +++ b/.sync.yml @@ -23,13 +23,13 @@ delete: true appveyor.yml: delete: true +spec/acceptance/nodesets/el7.yml: + extra_commands: + - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' + - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' spec/acceptance/nodesets/el9.yml: delete: true spec/acceptance/nodesets/debian-11.yml: delete: true spec/acceptance/nodesets/ubuntu-2204.yml: delete: true -spec/acceptance/nodesets/centos-7.yml: - extra_commands: - - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' - - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' diff --git a/manifests/install.pp b/manifests/install.pp index 9d70e46..48fcdde 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -22,6 +22,14 @@ } if String($globus::version) == '5' { + if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 { + package { 'mod_auth_openidc-dnf-module': + ensure => 'disabled', + name => 'mod_auth_openidc', + provider => 'dnfmodule', + before => Package[$globus::package_name], + } + } package { $globus::package_name: ensure => 'present', } diff --git a/manifests/service.pp b/manifests/service.pp index f4d9f01..fd6a76f 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,7 +1,7 @@ # @summary Manage Globus service # @api private class globus::service { - if ($globus::include_io_server or String($globus::version) == '5') and $globus::manage_service { + if $globus::include_io_server and String($globus::version) == '4' and $globus::manage_service { service { 'globus-gridftp-server': ensure => 'running', enable => true, @@ -14,9 +14,22 @@ # Only attempt to start GCS services if Globus node is setup if $facts['globus_node_setup'] { $gcs_ensure = 'running' + $gridftp_ensure = 'running' } else { + # EL8 seems to have issues starting on fresh install + if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') == 0 { + $gridftp_ensure = undef + } else { + $gridftp_ensure = 'running' + } $gcs_ensure = undef } + service { 'globus-gridftp-server': + ensure => $gridftp_ensure, + enable => true, + hasstatus => true, + hasrestart => true, + } service { 'gcs_manager': ensure => $gcs_ensure, enable => true, diff --git a/spec/acceptance/globus_spec.rb b/spec/acceptance/globus_spec.rb index 90955de..07ce6cb 100644 --- a/spec/acceptance/globus_spec.rb +++ b/spec/acceptance/globus_spec.rb @@ -115,7 +115,12 @@ class { 'globus': it { is_expected.to be_installed } end - describe service('globus-gridftp-server') do + describe service('globus-gridftp-server'), if: fact('os.release.major').to_s == '8' do + it { is_expected.to be_enabled } + it { is_expected.not_to be_running } + end + + describe service('globus-gridftp-server'), unless: fact('os.release.major').to_s == '8' do it { is_expected.to be_enabled } it { is_expected.to be_running } end diff --git a/spec/acceptance/nodesets/el7.yml b/spec/acceptance/nodesets/el7.yml index 1083378..7afe4a4 100644 --- a/spec/acceptance/nodesets/el7.yml +++ b/spec/acceptance/nodesets/el7.yml @@ -12,6 +12,8 @@ HOSTS: - 'yum install -y wget which cronie iproute initscripts' - 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo' - 'yum update -y systemd' + - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' + - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' docker_env: - LANG=en_US.UTF-8 - LANGUAGE=en_US.UTF-8 diff --git a/spec/shared_examples/globus_install.rb b/spec/shared_examples/globus_install.rb index 5dae8e8..ec5603e 100644 --- a/spec/shared_examples/globus_install.rb +++ b/spec/shared_examples/globus_install.rb @@ -1,8 +1,19 @@ # frozen_string_literal: true -shared_examples_for 'globus::install' do |_facts| +shared_examples_for 'globus::install' do |facts| it { is_expected.not_to contain_package('globus-connect-server-io') } it { is_expected.not_to contain_package('globus-connect-server-id') } it { is_expected.not_to contain_package('globus-connect-server-web') } + + if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i >= 8 + it do + is_expected.to contain_package('mod_auth_openidc-dnf-module').with( + ensure: 'disabled', + name: 'mod_auth_openidc', + provider: 'dnfmodule', + before: 'Package[globus-connect-server54]', + ) + end + end it { is_expected.to contain_package('globus-connect-server54').with_ensure('present') } end diff --git a/spec/shared_examples/globus_service.rb b/spec/shared_examples/globus_service.rb index b46a6ae..9ec7deb 100644 --- a/spec/shared_examples/globus_service.rb +++ b/spec/shared_examples/globus_service.rb @@ -1,9 +1,17 @@ # frozen_string_literal: true shared_examples_for 'globus::service' do |os_facts| + let(:gridftp_ensure) do + if os_facts[:os]['release']['major'].to_s == '8' + nil + else + 'running' + end + end + it do is_expected.to contain_service('globus-gridftp-server').with( - ensure: 'running', + ensure: gridftp_ensure, enable: 'true', hasstatus: 'true', hasrestart: 'true', @@ -39,6 +47,7 @@ context 'when globus_node_setup is true' do let(:facts) { os_facts.merge(globus_node_setup: true) } + it { is_expected.to contain_service('globus-gridftp-server').with_ensure('running') } it { is_expected.to contain_service('gcs_manager').with_ensure('running') } it { is_expected.to contain_service('gcs_manager_assistant').with_ensure('running') } end