Skip to content

Commit

Permalink
Support for Ruby 3 and Puppet 8 (#214)
Browse files Browse the repository at this point in the history
Also update gem dependencies.
  • Loading branch information
silug authored Aug 24, 2023
1 parent d378ec1 commit bd24e0a
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 34 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 5.21.0 / 2023-08-24
- Fixed
- Support for Ruby 3 and Puppet 8
- Update gem dependencies

### 5.20.0 /2023-07-03
- Added
- Support for `puppetlabs-spec-helper` 6.x and `puppet-lint`
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
# PUPPET_VERSION | specifies the version of the puppet gem to load
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~> 7'
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 7.0.0', '< 9.0.0']
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']

gem_sources.each { |gem_source| source gem_source }
Expand Down
2 changes: 1 addition & 1 deletion lib/simp/ci/gitlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def load_gitlab_yaml
return @gitlab_yaml if @gitlab_yaml

begin
@gitlab_yaml = YAML.load_file(@gitlab_config_file)
@gitlab_yaml = YAML.safe_load(File.read(@gitlab_config_file), filename: @gitlab_config_file, aliases: true)
rescue Psych::SyntaxError => e
msg = "ERROR: Malformed YAML: #{e.message}"
raise LintError.new(msg)
Expand Down
4 changes: 2 additions & 2 deletions lib/simp/componentinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Simp::ComponentInfo
def initialize(component_dir, latest_version_only = false, verbose = true)
@component_dir = component_dir

if File.exists?(File.join(@component_dir, 'metadata.json'))
if File.exist?(File.join(@component_dir, 'metadata.json'))
@type = :module
load_module_info(latest_version_only, verbose)
else
Expand All @@ -107,7 +107,7 @@ def load_module_info(latest_version_only, verbose)


changelog_file = File.join(component_dir, 'CHANGELOG')
unless File.exists?(changelog_file)
unless File.exist?(changelog_file)
fail("ERROR: No CHANGELOG file found in #{component_dir}")
end
@changelog = parse_changelog(IO.read(changelog_file), latest_version_only, verbose)
Expand Down
4 changes: 2 additions & 2 deletions lib/simp/rake/build/auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def define
fail SIMPBuildException, "ERROR: Mixing `SIMP_BUILD_rm_staging_dir=yes` and `SIMP_BUILD_unpack=no` is silly."
end

if File.exists?(output_dir) && !File.directory?(output_dir)
if File.exist?(output_dir) && !File.directory?(output_dir)
fail SIMPBuildException, "ERROR: ISO output dir exists but is not a directory:\n\n" +
" '#{output_dir}'\n\n"
end
Expand Down Expand Up @@ -521,7 +521,7 @@ def prepare_staging_dir( staging_dir, do_rm_staging, repo_root_dir, verbose )
puts '-'*80

FileUtils.rm_rf staging_dir, :verbose => verbose
elsif File.exists? staging_dir
elsif File.exist? staging_dir
warn ''
warn '!'*80
warn '#### WARNING: staging dir already exists at:'
Expand Down
4 changes: 2 additions & 2 deletions lib/simp/rake/build/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def define_tasks

fail("Could not find directory #{mod}") unless Dir.exist?(mod)

next unless File.exists?(File.join(mod,'Gemfile'))
next unless File.exist?(File.join(mod,'Gemfile'))
puts "\n#{mod}\n" if verbose
Dir.chdir(mod) do
if File.exist?('Gemfile.lock')
Expand Down Expand Up @@ -515,7 +515,7 @@ def update_rpm(pkg,yum_conf,verbose=false)

# Create example packages.yaml
packages_yaml_path = File.join(target_dir, 'packages.yaml')
unless File.exists? packages_yaml_path
unless File.exist? packages_yaml_path
pkg = 'example-package-name'
pkg_file = "#{pkg}-1.0.0-1.el#{major_os_ver}.#{args[:arch]}.rpm"
yum_url = "https://yum.server/#{args[:os]}/#{major_os_ver}/#{args[:arch]}"
Expand Down
4 changes: 2 additions & 2 deletions lib/simp/rake/build/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,15 @@ def populate_rpm_dir(rpm_dir)
.delete_if{|x| x =~ /\.src\.rpm$/}
.each do |path|
sym_path = "repos/basetest/#{File.basename(path)}"
ln_sf(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
ln_sf(path,sym_path, :verbose => @verbose) unless File.exist?(sym_path)
end

if args[:aux_dir]
Dir.glob(File.join(args[:aux_dir], '**', '*.rpm'))
.delete_if{|x| x =~ /\.src\.rpm$/}
.each do |path|
sym_path = "repos/lookaside/#{File.basename(path)}"
ln_sf(path,sym_path, :verbose => @verbose) unless File.exists?(sym_path)
ln_sf(path,sym_path, :verbose => @verbose) unless File.exist?(sym_path)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/simp/rake/helpers/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module Simp; end
module Simp::Rake; end

class Simp::Rake::Helpers
VERSION = '5.20.0'
VERSION = '5.21.0'
end
2 changes: 1 addition & 1 deletion lib/simp/rake/pupmod/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def define_tasks
def metadata( file_path = nil )
require 'json'
_file = file_path || File.join(@base_dir, 'metadata.json')
fail "ERROR: file not found: '#{_file}'" unless File.exists? _file
fail "ERROR: file not found: '#{_file}'" unless File.exist? _file
@metadata ||= JSON.parse( File.read(_file) )
end

Expand Down
4 changes: 2 additions & 2 deletions rakelib/gitlab_ci.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'yaml'


def gitlab_ci_lint( gitlab_ci_url, gitlab_ci_yml_path )
unless File.exists? gitlab_ci_yml_path
unless File.exist? gitlab_ci_yml_path
warn "WARNING: no GitLab CI config found at '#{gitlab_ci_yml_path}'"
warn '(skipping)'
return
Expand Down Expand Up @@ -76,7 +76,7 @@ namespace :gitlab_ci do
unless(gitlab_url && project_id)
warn 'WARNING: no gitlab_url or project_id given via task arg or env var' if $VERBOSE
warn 'Checking for .gitlab-project-api.yaml...' if $VERBOSE
unless File.exists? '.gitlab-project-api.yaml'
unless File.exist? '.gitlab-project-api.yaml'
fail( [
"\nERROR: no gitlab_url or project_id given via task arg or env va
r",
Expand Down
12 changes: 6 additions & 6 deletions simp-rake-helpers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ Gem::Specification.new do |s|
"Trevor Vaughan"
]
s.metadata = {
'issue_tracker' => 'https://simp-project.atlassian.net'
'issue_tracker' => 'https://github.com/simp/rubygem-simp-rake-helpers/issues'
}
# gem dependencies
# for the published gem
# ensure the gem is built out of versioned files

s.add_runtime_dependency 'simp-beaker-helpers', '~> 1.24'
s.add_runtime_dependency 'bundler', '>= 1.14', '< 3.0'
s.add_runtime_dependency 'rake', '>= 10.0', '< 13.0'
s.add_runtime_dependency 'rake', '>= 10.0', '< 14.0'
s.add_runtime_dependency 'puppet', '>= 3.0', '< 9.0'
s.add_runtime_dependency 'puppet-lint', '>= 1.0', '< 5.0'
s.add_runtime_dependency 'puppet-lint-optional_default-check', '>= 1.0', '< 2.0'
s.add_runtime_dependency 'puppet-lint-params_empty_string-check', '>= 1.0', '<3.0'
s.add_runtime_dependency 'puppet-lint-optional_default-check', '>= 1.0', '< 3.0'
s.add_runtime_dependency 'puppet-lint-params_empty_string-check', '>= 1.0', '< 3.0'

s.add_runtime_dependency 'puppetlabs_spec_helper', '~> 6.0'
s.add_runtime_dependency 'metadata-json-lint', '>= 1.2', '< 4.0'
s.add_runtime_dependency 'parallel', '~> 1.0'
s.add_runtime_dependency 'simp-rspec-puppet-facts', '>= 2.4.1', '< 4.0'
s.add_runtime_dependency 'puppet-blacksmith', '>= 3.3.0', '< 8.0'
s.add_runtime_dependency 'parallel_tests', '> 2.4', '< 2.25'
s.add_runtime_dependency 'r10k', '>= 2.2', '< 4.0'
s.add_runtime_dependency 'parallel_tests', '> 2.4', '< 5.0'
s.add_runtime_dependency 'r10k', '>= 2.2', '< 5.0'
s.add_runtime_dependency 'pager', '~> 1.0'
s.add_runtime_dependency 'ruby-progressbar', '~> 1.0'

Expand Down
11 changes: 4 additions & 7 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
HOSTS:
el7-build-server:
roles:
Expand All @@ -6,7 +7,7 @@ HOSTS:
platform: el-7-x86_64
hypervisor: docker
image: simpproject/simp_build_centos7
docker_cmd: '/usr/sbin/sshd -D -E /var/log/sshd.log'
docker_cmd: "/usr/sbin/sshd -D -E /var/log/sshd.log"

el8-build-server:
roles:
Expand All @@ -19,12 +20,8 @@ HOSTS:

CONFIG:
log_level: verbose
type: aio
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
<% else -%>
puppet_collection: puppet6
<% end -%>
type: aio
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
ssh:
password: root
auth_methods:
Expand Down
11 changes: 4 additions & 7 deletions spec/acceptance/nodesets/default_ruby3_1.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
HOSTS:
el7-build-server:
roles:
Expand All @@ -6,7 +7,7 @@ HOSTS:
platform: el-7-x86_64
hypervisor: docker
image: simpproject/simp_build_centos7_ruby3_1
docker_cmd: '/usr/sbin/sshd -D -E /var/log/sshd.log'
docker_cmd: "/usr/sbin/sshd -D -E /var/log/sshd.log"

el8-build-server:
roles:
Expand All @@ -19,12 +20,8 @@ HOSTS:

CONFIG:
log_level: verbose
type: aio
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
<% else -%>
puppet_collection: puppet6
<% end -%>
type: aio
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
ssh:
password: root
auth_methods:
Expand Down

0 comments on commit bd24e0a

Please sign in to comment.