diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bbb023d..80ad981 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: ruby_version: - - '2.7' + # - '2.7' - '3.2' steps: - name: Checkout @@ -54,4 +54,6 @@ jobs: run: bundle exec rake 'sce:fixtures' - name: Run RSpec - run: bundle exec rake spec + # Going to use `rpsec` instead of `bundle exec rake spec` and manually feed it the pattern of spec files to run. + # `bundle exec rake spec` is running into some issue with the pattern defined in the Rakefle and was only running 8 tests. + run: bundle exec rspec spec/abide_dev_utils_spec.rb spec/abide_dev_utils/**/*_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index ffb93c5..c687a5a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,15 @@ PATH remote: . specs: - abide_dev_utils (0.18.4) + abide_dev_utils (0.18.5) cmdparse (~> 3.0) - facterdb (~> 2.1.0) + facterdb (~> 4.1.0) google-cloud-storage (~> 1.34) hashdiff (~> 1.0) jira-ruby (~> 2.2) metadata-json-lint (~> 4.0) nokogiri (~> 1.13) + puppet-lint (~> 4.0) puppet-strings (>= 2.7) ruby-progressbar (~> 1.11) selenium-webdriver (~> 4.0.0.beta4) @@ -16,10 +17,10 @@ PATH GEM remote: https://rubygems-puppetcore.puppet.com/ specs: - facter (4.11.0) + facter (4.16.0) hocon (~> 1.3) - thor (>= 1.0.1, < 1.3) - puppet (8.11.0) + thor (~> 1.2) + puppet (8.16.0) concurrent-ruby (~> 1.0) deep_merge (~> 1.0) facter (>= 4.3.0, < 5) @@ -27,10 +28,10 @@ GEM getoptlong (~> 0.2.0) locale (~> 2.1) multi_json (~> 1.13) - puppet-resource_api (~> 1.5) + puppet-resource_api (~> 1.9) scanf (~> 1.0) semantic_puppet (~> 1.0) - puppet (8.11.0-universal-darwin) + puppet (8.16.0-universal-darwin) CFPropertyList (>= 3.0.6, < 4) concurrent-ruby (~> 1.0) deep_merge (~> 1.0) @@ -39,92 +40,90 @@ GEM getoptlong (~> 0.2.0) locale (~> 2.1) multi_json (~> 1.13) - puppet-resource_api (~> 1.5) + puppet-resource_api (~> 1.9) scanf (~> 1.0) semantic_puppet (~> 1.0) GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.7) + CFPropertyList (3.0.8) + activesupport (8.1.2) base64 - nkf - rexml - activesupport (8.0.2) - base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) - async (2.23.1) + async (2.36.0) console (~> 1.29) fiber-annotation - io-event (~> 1.9) + io-event (~> 1.11) metrics (~> 0.12) - traces (~> 0.15) - async-http (0.88.0) + traces (~> 0.18) + async-http (0.94.2) async (>= 2.10.2) - async-pool (~> 0.9) + async-pool (~> 0.11) io-endpoint (~> 0.14) io-stream (~> 0.6) metrics (~> 0.12) - protocol-http (~> 0.49) - protocol-http1 (~> 0.30) + protocol-http (~> 0.58) + protocol-http1 (~> 0.36) protocol-http2 (~> 0.22) + protocol-url (~> 0.2) traces (~> 0.10) - async-http-faraday (0.21.0) + async-http-faraday (0.22.1) async-http (~> 0.42) faraday - async-pool (0.10.3) - async (>= 1.25) + async-pool (0.11.1) + async (>= 2.0) atlassian-jwt (0.2.1) jwt (~> 2.1) - base64 (0.2.0) - benchmark (0.4.0) - bigdecimal (3.1.9) + base64 (0.3.0) + bigdecimal (4.0.1) childprocess (4.1.0) cmdparse (3.0.7) coderay (1.1.3) - concurrent-ruby (1.3.5) - connection_pool (2.5.0) - console (1.30.2) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + console (1.34.3) fiber-annotation fiber-local (~> 1.1) json declarative (0.0.20) deep_merge (1.2.2) - diff-lcs (1.6.1) + diff-lcs (1.6.2) digest-crc (0.7.0) rake (>= 12.0.0, < 14.0.0) - drb (2.2.1) - facterdb (2.1.0) - facter (< 5.0.0) + drb (2.2.3) + facterdb (4.1.0) jgrep (~> 1.5, >= 1.5.4) - faraday (2.12.2) + faraday (2.14.1) faraday-net_http (>= 2.0, < 3.5) json logger - faraday-http-cache (2.5.1) + faraday-follow_redirects (0.5.0) + faraday (>= 1, < 3) + faraday-http-cache (2.6.1) faraday (>= 0.8) - faraday-net_http (3.4.0) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) fast_gettext (3.1.0) prime fiber-annotation (0.2.0) fiber-local (1.1.0) fiber-storage - fiber-storage (1.0.0) - forwardable (1.3.3) + fiber-storage (1.0.1) + forwardable (1.4.0) gem-release (2.2.4) getoptlong (0.2.1) github_changelog_generator (1.16.4) @@ -136,98 +135,97 @@ GEM octokit (~> 4.6) rainbow (>= 2.2.1) rake (>= 10.0) - google-apis-core (0.16.0) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 1.9) - httpclient (>= 2.8.3, < 3.a) - mini_mime (~> 1.0) - mutex_m + google-apis-core (1.0.2) + addressable (~> 2.8, >= 2.8.7) + faraday (~> 2.13) + faraday-follow_redirects (~> 0.3) + googleauth (~> 1.14) + mini_mime (~> 1.1) representable (~> 3.0) - retriable (>= 2.0, < 4.a) - google-apis-iamcredentials_v1 (0.22.0) + retriable (~> 3.1) + google-apis-iamcredentials_v1 (0.26.0) google-apis-core (>= 0.15.0, < 2.a) - google-apis-storage_v1 (0.50.0) + google-apis-storage_v1 (0.60.0) google-apis-core (>= 0.15.0, < 2.a) google-cloud-core (1.8.0) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (2.2.2) + google-cloud-env (2.3.1) base64 (~> 0.2) faraday (>= 1.0, < 3.a) google-cloud-errors (1.5.0) - google-cloud-storage (1.55.0) + google-cloud-storage (1.58.0) addressable (~> 2.8) digest-crc (~> 0.4) - google-apis-core (~> 0.13) + google-apis-core (>= 0.18, < 2) google-apis-iamcredentials_v1 (~> 0.18) google-apis-storage_v1 (>= 0.42) google-cloud-core (~> 1.6) googleauth (~> 1.9) mini_mime (~> 1.0) - google-logging-utils (0.1.0) - googleauth (1.14.0) + google-logging-utils (0.2.0) + googleauth (1.16.1) faraday (>= 1.0, < 3.a) google-cloud-env (~> 2.2) google-logging-utils (~> 0.1) - jwt (>= 1.4, < 3.0) + jwt (>= 1.4, < 4.0) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - hashdiff (1.1.2) - hashie (5.0.0) + hashdiff (1.2.1) + hashie (5.1.0) + logger hocon (1.4.0) - httpclient (2.9.0) - mutex_m - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) - io-endpoint (0.15.2) - io-event (1.10.0) - io-stream (0.6.1) + io-console (0.8.2) + io-endpoint (0.17.2) + io-event (1.14.2) + io-stream (0.11.1) jgrep (1.5.4) jira-ruby (2.3.0) activesupport atlassian-jwt multipart-post oauth (~> 0.5, >= 0.5.0) - json (2.10.2) - json-schema (5.1.1) + json (2.18.1) + json-schema (6.1.0) addressable (~> 2.8) - bigdecimal (~> 3.1) - jwt (2.10.1) + bigdecimal (>= 3.1, < 5) + jwt (2.10.2) base64 - language_server-protocol (3.17.0.4) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) locale (2.1.4) logger (1.7.0) - metadata-json-lint (4.2.1) - json-schema (>= 2.8, < 6.0) + metadata-json-lint (4.3.0) + json-schema (>= 2.8, < 7.0) semantic_puppet (~> 1.0) spdx-licenses (~> 1.0) method_source (1.1.0) - metrics (0.12.2) + metrics (0.15.0) mini_mime (1.1.5) - minitest (5.25.5) - multi_json (1.15.0) + minitest (6.0.1) + prism (~> 1.5) + multi_json (1.19.1) multipart-post (2.4.1) - mutex_m (0.3.0) - net-http (0.6.0) - uri - nkf (0.2.0) - nokogiri (1.18.7-aarch64-linux-gnu) + net-http (0.9.1) + uri (>= 0.11.1) + nokogiri (1.19.0-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-aarch64-linux-musl) + nokogiri (1.19.0-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.18.7-arm-linux-gnu) + nokogiri (1.19.0-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-arm-linux-musl) + nokogiri (1.19.0-arm-linux-musl) racc (~> 1.4) - nokogiri (1.18.7-arm64-darwin) + nokogiri (1.19.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-darwin) + nokogiri (1.19.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-linux-gnu) + nokogiri (1.19.0-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-x86_64-linux-musl) + nokogiri (1.19.0-x86_64-linux-musl) racc (~> 1.4) oauth (0.6.2) snaky_hash (~> 2.0) @@ -236,55 +234,61 @@ GEM faraday (>= 1, < 3) sawyer (~> 0.9) os (1.1.4) - parallel (1.26.3) - parser (3.3.7.4) + parallel (1.27.0) + parser (3.3.10.1) ast (~> 2.4.1) racc - prime (0.1.3) + prime (0.1.4) forwardable singleton - prism (1.4.0) + prism (1.9.0) protocol-hpack (1.5.1) - protocol-http (0.49.0) - protocol-http1 (0.34.0) - protocol-http (~> 0.22) - protocol-http2 (0.22.1) + protocol-http (0.59.0) + protocol-http1 (0.37.0) + protocol-http (~> 0.58) + protocol-http2 (0.24.0) protocol-hpack (~> 1.4) protocol-http (~> 0.47) - pry (0.15.2) + protocol-url (0.4.0) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (6.0.1) + reline (>= 0.6.0) + public_suffix (7.0.2) + puppet-lint (4.3.0) puppet-resource_api (1.9.0) hocon (>= 1.0) - puppet-strings (4.1.3) + puppet-strings (5.0.0) + puppet (>= 8.0.0) rgen (~> 0.9) - yard (~> 0.9, < 0.9.37) + yard (~> 0.9) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) - regexp_parser (2.10.0) + rake (13.3.1) + regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.4.1) + rexml (3.4.4) rgen (0.10.2) - rspec (3.13.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.3) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) - rubocop (1.75.1) + rspec-support (3.13.7) + rubocop (1.84.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -292,25 +296,25 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.43.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.43.0) + rubocop-ast (1.49.0) parser (>= 3.3.7.2) - prism (~> 1.4) + prism (~> 1.7) rubocop-capybara (2.22.1) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-factory_bot (2.27.1) + rubocop-factory_bot (2.28.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) rubocop-i18n (3.2.3) lint_roller (~> 1.1) rubocop (>= 1.72.1) - rubocop-performance (1.24.0) + rubocop-performance (1.26.1) lint_roller (~> 1.1) - rubocop (>= 1.72.1, < 2.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) rubocop-rspec (2.31.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -319,8 +323,8 @@ GEM rubocop-rspec_rails (2.29.1) rubocop (~> 1.61) ruby-progressbar (1.13.0) - rubyzip (2.4.1) - sawyer (0.9.2) + rubyzip (3.2.2) + sawyer (0.9.3) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) scanf (1.0.0) @@ -330,28 +334,28 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) semantic_puppet (1.1.1) - signet (0.19.0) + signet (0.21.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) - jwt (>= 1.5, < 3.0) + jwt (>= 1.5, < 4.0) multi_json (~> 1.10) singleton (0.3.0) - snaky_hash (2.0.1) - hashie - version_gem (~> 1.1, >= 1.1.1) + snaky_hash (2.0.3) + hashie (>= 0.1.0, < 6) + version_gem (>= 1.1.8, < 3) spdx-licenses (1.3.0) - thor (1.2.2) - traces (0.15.2) + thor (1.5.0) + traces (0.18.2) trailblazer-option (0.1.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - uri (1.0.3) - version_gem (1.1.6) - yard (0.9.36) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + uri (1.1.1) + version_gem (1.1.9) + yard (0.9.38) PLATFORMS aarch64-linux-gnu diff --git a/Rakefile b/Rakefile index a18ba4c..0af278b 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,8 @@ require "bundler/gem_tasks" require "rspec/core/rake_task" spec_task = RSpec::Core::RakeTask.new(:spec) -spec_task.pattern = 'spec/abide_dev_utils_spec.rb,spec/abide_dev_utils/**/*_spec.rb' +spec_task.pattern = ['spec/abide_dev_utils_spec.rb', + 'spec/abide_dev_utils/**/*_spec.rb'] require "rubocop/rake_task" @@ -13,7 +14,7 @@ RuboCop::RakeTask.new task default: %i[spec rubocop] -MODULES = %w[puppetlabs-cem_linux puppetlabs-sce_linux puppetlabs-cem_windows puppetlabs-sce_windows].freeze +MODULES = %w[puppetlabs-sce_linux puppetlabs-sce_windows].freeze def modules_with_repos @modules_with_repos ||= MODULES.select do |mod| diff --git a/abide_dev_utils.gemspec b/abide_dev_utils.gemspec index 6a8bc51..bb50995 100644 --- a/abide_dev_utils.gemspec +++ b/abide_dev_utils.gemspec @@ -41,8 +41,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'selenium-webdriver', '~> 4.0.0.beta4' spec.add_dependency 'google-cloud-storage', '~> 1.34' spec.add_dependency 'hashdiff', '~> 1.0' - spec.add_dependency 'facterdb', '~> 2.1.0' spec.add_dependency 'metadata-json-lint', '~> 4.0' + spec.add_dependency 'puppet-lint', '~> 4.0' + spec.add_dependency 'facterdb', '~> 4.1.0' # Since we're no longer using Ruby 2.7, pinning to the latest version of Facterdb which has support for Ruby 3.0 and above. # Dev dependencies spec.add_development_dependency 'bundler' diff --git a/lib/abide_dev_utils/ppt/score_module.rb b/lib/abide_dev_utils/ppt/score_module.rb index 14155c1..ca173cc 100644 --- a/lib/abide_dev_utils/ppt/score_module.rb +++ b/lib/abide_dev_utils/ppt/score_module.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'pathname' -require 'metadata-json-lint' +require 'metadata_json_lint' require 'puppet-lint' require 'json' diff --git a/lib/abide_dev_utils/sce/benchmark.rb b/lib/abide_dev_utils/sce/benchmark.rb index 44cbf66..5fe09a7 100644 --- a/lib/abide_dev_utils/sce/benchmark.rb +++ b/lib/abide_dev_utils/sce/benchmark.rb @@ -341,10 +341,7 @@ class Benchmark def initialize(osname, major_version, hiera_conf, module_name, framework: 'cis') @osname = osname @major_version = major_version - @os_facts = AbideDevUtils::Ppt::FacterUtils::FactSets.new.find_by_fact_value_tuples(['os.name', @osname], - ['os.release.major', - @major_version]) - @osfamily = @os_facts['os']['family'] + @osfamily = os_family_for(@osname, @major_version) @hiera_conf = hiera_conf @module_name = module_name @framework = framework @@ -416,6 +413,35 @@ def inspect private + OS_FAMILY_MAP = { + 'redhat' => 'RedHat', + 'oraclelinux' => 'RedHat', + 'almalinux' => 'RedHat', + 'rocky' => 'RedHat', + 'ubuntu' => 'Debian', + 'windows' => 'Windows', + }.freeze + + SUPPORT_OS_MAJ_VER_MAP = { + "redhat" => ['7', '8', '9'], + "oraclelinux" => ['7', '8', '9'], + "almalinux" => ['8', '9'], + "rocky" => ['8', '9'], + "ubuntu" => ['20.04', '22.04', '24.04'], + "windows" => ['2016', '10', '2019', '2022', '2025'] + } + + def os_family_for(osname, os_maj_version) + key = osname.to_s.downcase + family = OS_FAMILY_MAP[key] + supported_maj_vers = SUPPORT_OS_MAJ_VER_MAP[key] + if family && supported_maj_vers.include?(os_maj_version) + return family + end + + raise "Unsupported OS name '#{osname}' or version '#{os_maj_version}' for SCE benchmark" + end + def load_mapping_data files = case module_name when /_windows$/ @@ -433,6 +459,17 @@ def load_mapping_data def sce_linux_mapping_files facts = [['os.name', osname], ['os.release.major', major_version]] mapping_files = hiera_conf.local_hiera_files_with_facts(*facts, hierarchy_name: 'Mapping Data') + # If we can't find the mapping files through using facts, then manually check for files in the Mapping Data directory that match the os name and major version. + if (mapping_files.nil? || mapping_files.empty?) + dir_exist = File.directory?(hiera_conf.default_datadir + "/mapping/cis/#{osname}/#{major_version}") + # If the directory for the os name and major version exists, we know there are mapping files. Mock EntryPathLocalFile objects for each of the files in that directory and use those as the mapping files. + if dir_exist + mapping_files = Dir.glob(File.join(hiera_conf.default_datadir, "mapping/cis/#{osname}/#{major_version}/*.yaml")).map do |f| + trimmed_path = f.split(hiera_conf.default_datadir).last + AbideDevUtils::Ppt::Hiera::EntryPathLocalFile.new(trimmed_path, ['os.name', 'os.release.major'], [osname, major_version]) + end + end + end raise AbideDevUtils::Errors::MappingFilesNotFoundError, facts if mapping_files.nil? || mapping_files.empty? mapping_files @@ -441,6 +478,21 @@ def sce_linux_mapping_files def sce_windows_mapping_files facts = ['os.release.major', major_version] mapping_files = hiera_conf.local_hiera_files_with_fact(facts[0], facts[1], hierarchy_name: 'Mapping Data') + # If we can't find the mapping files through using facts, then manually check for files in the Mapping Data directory that match the major version. + # This is necessary because Facterdb may not have facter data for os.release.major, but sce_windows may still have mapping data files that can be used to load benchmarks. + if (mapping_files.nil? || mapping_files.empty?) + # Take a look at all the files in the Mapping Data directory and see if any of them match the major version. If they do, use those as the mapping files. + dir_exist = File.directory?(hiera_conf.default_datadir + "/mapping/cis/#{major_version}") + # Create EntryPathLocalFile objects for each of the files in that directory and use those as the mapping files. + if dir_exist + mapping_files = Dir.glob(File.join(hiera_conf.default_datadir, "mapping/cis/#{major_version}/*.yaml")).map do |f| + # A bit of a hack fix but, we only need the part 'mapping/cis/major_version/filename.yaml' of the path for the EntryPathLocalFile object to work correctly. + # Trim the path down to just the part we need by splitting on the default datadir and taking the last part, then creating the EntryPathLocalFile object with that trimmed path. + trimmed_path = f.split(hiera_conf.default_datadir).last + AbideDevUtils::Ppt::Hiera::EntryPathLocalFile.new(trimmed_path, ['os.release.major'], [major_version]) + end + end + end raise AbideDevUtils::Errors::MappingFilesNotFoundError, facts if mapping_files.nil? || mapping_files.empty? mapping_files @@ -458,6 +510,28 @@ def validate_mapping_files_framework(files) def load_resource_data facts = [['os.family', osfamily], ['os.name', osname], ['os.release.major', major_version]] rdata_files = hiera_conf.local_hiera_files_with_facts(*facts, hierarchy_name: 'Resource Data') + # Same as getting mapping files, if we can't find the resource data files through using facts, then manually check for files in the Resource Data directory that match the os family, name, and major version. + # This is necessary because Facterdb may not have facter data for os.family, os.name, or os.release.major, but there may still be resource data files that can be used to load benchmarks. + if (rdata_files.nil? || rdata_files.empty?) + # Filter the name since on the Windows side, everything is lowered case. + if osfamily == 'Windows' + osfamily_filtered = osfamily.downcase + osname_filtered = osname.downcase + else + osfamily_filtered = osfamily + osname_filtered = osname + end + + dir_exist = File.directory?(hiera_conf.default_datadir + "/#{osfamily_filtered}/#{osname_filtered}") + if dir_exist + rdata_files = Dir.glob(File.join(hiera_conf.default_datadir, "/#{osfamily_filtered}/#{osname_filtered}/#{major_version}.yaml")).map do |f| + trimmed_path = f.split(hiera_conf.default_datadir).last + AbideDevUtils::Ppt::Hiera::EntryPathLocalFile.new(trimmed_path, ['os.family', 'os.name', 'os.release.major'], [osfamily, osname, major_version]) + end + else + end + end + raise AbideDevUtils::Errors::ResourceDataNotFoundError, facts if rdata_files.nil? || rdata_files.empty? YAML.load_file(rdata_files[0].path) diff --git a/lib/abide_dev_utils/version.rb b/lib/abide_dev_utils/version.rb index 37e4e6b..42e7719 100644 --- a/lib/abide_dev_utils/version.rb +++ b/lib/abide_dev_utils/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module AbideDevUtils - VERSION = "0.18.4" + VERSION = "0.18.5" end