Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-18135

GRC policytools dryrun breaks if resources contains a policy

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • ACM 2.13.2
    • ACM 2.13.0
    • GRC
    • 2
    • False
    • None
    • False
    • GRC Sprint 2025-05
    • Low
    • None

      Description of problem:

      I can pass in a directory of resources used as input to the policy dryrun command.  If that directory happens to contain an ACM Policy resource, I would think we could ignore or handle it nicely.  Instead I get an error:

      Error: the resource version was not found for kind Policy: if this is a custom resource, it may need an entry in the mappings file

      Version-Release number of selected component (if applicable):

      2.13.0-SNAPSHOT-2025-02-26-09-53-17

      How reproducible:

      Easy to reproduce

      Steps to Reproduce:

      1. Start with a working dryrun scenario where the resources used are contained in a directory
      2. Copy a valid ACM Policy into your resources folder
      3. Run the same dryrun command that was previously working.  The following error is returned:
      Error: the resource version was not found for kind Policy: if this is a custom resource, it may need an entry in the mappings file

      Actual results:

      $ policytools dryrun -p policies/policy-limitmemory.yaml resources

      1. Diffs:
      2. Compliance messages:
        NonCompliant; violation - namespaced object mem-limit-range of kind LimitRange has no namespace specified from the policy namespaceSelector nor the object metadata
        Error: policy is NonCompliant
        $ cp policies/policy-limitmemory.yaml resources/
        $ policytools dryrun -p policies/policy-limitmemory.yaml resources
        Error: the resource version was not found for kind Policy: if this is a custom resource, it may need an entry in the mappings file

        Expected results:

      The two dryrun commands above should have both worked I think

      Additional info:

              yikim@redhat.com Yi Rae Kim
              gparvin-redhat Gus Parvin
              Derek Ho Derek Ho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: