Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

validate_legacy fails catalog compilation under Puppet 8 strict deprecation handling #1478

Copy link
Copy link

Description

@alex-harvey-z3q
Issue body actions

validate_legacy fails catalog compilation under Puppet 8 strict deprecation handling

Summary

validate_legacy() still calls stdlib's deprecation() helper directly. Under Puppet 8 / OpenVox 8, where strict=error is the default behaviour, this deprecation call can raise a hard evaluation error before validate_legacy() performs its actual type assertion.

This appears to be an uncovered validate_legacy() instance of the deprecation/Puppet 8 compatibility issue tracked in #1391.

Related issues and PRs:

The previous fixes addressed namespaced/non-namespaced function shims, but validate_legacy() still has a direct deprecation() call and can still fail.

Affected Code

Current validate_legacy() calls deprecation() before doing the assertion:

def validate_legacy(_scope, target_type, _function_name, value, *_prev_args)
  call_function('deprecation', 'validate_legacy', 'This method is deprecated, please use Puppet data types to validate parameters')
  if assert_type(target_type, value)
    # "Silently" passes
  else
    inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value)
    error_msg = Puppet::Pops::Types::TypeMismatchDescriber.new.describe_mismatch("validate_legacy(#{target_type}, ...)", target_type, inferred_type)
    call_function('fail', error_msg)
  end
end

Expected Behaviour

validate_legacy() should preserve its legacy compatibility behaviour:

  • valid values should pass silently
  • invalid values should fail with the existing type mismatch error
  • the fact that validate_legacy() is deprecated should not itself make catalog compilation fail under Puppet 8

Actual Behaviour

The direct call to stdlib deprecation() can raise under Puppet 8 strict deprecation handling, so otherwise valid catalogs fail before validate_legacy() evaluates the supplied value.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.