Puppet Function: ora_secured::validate_cis_versions
- Defined in:
- lib/puppet/functions/ora_secured/validate_cis_versions.rb
- Function type:
- Ruby 4.x API
Summary
Validate if the specified product_version and doc_version is an existing combination.Overview
If not give a readable error message that shows available versions
See the file “LICENSE” for the full license governing this code.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet/functions/ora_secured/validate_cis_versions.rb', line 10 Puppet::Functions.create_function('ora_secured::validate_cis_versions') do dispatch :validate_cis_versions do param 'String', :product_version param 'String', :doc_version end def validate_cis_versions(product_version, doc_version) valid_doc_versions = valid_combinations[product_version] raise Puppet::Error, "product_version '#{product_version}' is not known and/or supported.\n Valid versions are #{valid_product_versions}" if valid_doc_versions.nil? raise Puppet::Error, "doc_version '#{doc_version}' is not known and/or supported for product_version '#{product_version}'.\n Valid versions for product_version '#{product_version}' are #{valid_doc_versions.join(',')}" unless valid_doc_versions.include?(doc_version) end def valid_product_versions valid_combinations.keys.join(',') end def valid_combinations @valid_combinations ||= call_function('lookup', 'ora_secured::cis::valid_combinations', data_type('Hash'), 'first', nil) end def data_type(string) parser = Puppet::Pops::Types::TypeParser.singleton parser.parse(string) end end |