Skip to content

crypto_policy: validate_policy parameter is declared but never used #107

Description

@hcaballero2

Summary

The crypto_policy class declares a validate_policy parameter that is never used. Documenting the module for AGENTS.md (#105) surfaced this, and @silug asked for a follow-up issue.

Details

validate_policy is declared and documented as controlling $ensure validation:

  • manifests/init.pp:28# @param validate_policy / "Disables validation of the $ensure parameter prior to application"
  • manifests/init.pp:52Boolean $validate_policy = true,

But nothing in the module references it. The only other match in the whole repo is the declaration itself:

$ grep -rn validate_policy . --include='*.pp' --include='*.rb' --include='*.erb' --include='*.epp'
manifests/init.pp:28:# @param validate_policy
manifests/init.pp:52:  Boolean       $validate_policy     = true,

The validation block at manifests/init.pp:113 is actually gated on the fact being populated, not on $validate_policy:

if $_ensure and $global_policies_available and $sub_policies_available {

So setting validate_policy => false has no effect — validation stays on (gated by the fact) regardless.

Suggested resolution

Decide the intent:

  • If validation-toggling is wanted: wire $validate_policy into the init.pp:113 guard (e.g. skip the fail() checks when false).
  • If it's intentionally unused: add a deprecation warning now so the parameter can be removed in a future major release (per @silug's suggestion on Add AGENTS.md AI-assistant configuration #105).

Either way the @param docstring should be brought in line with actual behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions