Skip to content

Missing nil check for placement field in Policy health check #22060

@dhaiducek

Description

@dhaiducek

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When a Policy (from policy.open-cluster-management.io) has a status that is empty and non-nil (i.e. {}), the check for the status.placement field is throwing an error because it's doing a length check on a nil field:

<string>:10: __len undefined stack traceback: <string>:10: in main chunk [G]: ?

To Reproduce

Deploy a policy unattached to any placement.

Expected behavior

Health check does not throw an error.

Screenshots

--

Version

(Version is the version tied to the PR where the code was updated in #21297 )

2.14.0

Logs

--

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingversion:2.14Latest confirmed affected version is 2.14

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions