Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent_state_summary: Properly handle nodes without reports/responses #246

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bastelfreak
Copy link
Contributor

previously, when running pe_status_check::agent_state_summary, the result didn't only contain the certnames, but also additional data:`

without this patch (one unresponsive node, one without reports at all):

{
  "noop": [

  ],
  "corrective_changes": [

  ],
  "used_cached_catalog": [

  ],
  "failed": [

  ],
  "changed": [

  ],
  "unresponsive": [
    {
      "certname": "pe.tim",
      "latest_report_noop": false,
      "latest_report_corrective_change": false,
      "cached_catalog_status": "not_used",
      "latest_report_status": "unchanged",
      "report_timestamp": "2024-12-05T13:41:55.483Z"
    }
  ],
  "no_report": [
    "agent.tim"
  ],
  "responsive": [
    "pe.tim"
  ],
  "unhealthy": [
    {
      "certname": "pe.tim",
      "latest_report_noop": false,
      "latest_report_corrective_change": false,
      "cached_catalog_status": "not_used",
      "latest_report_status": "unchanged",
      "report_timestamp": "2024-12-05T13:41:55.483Z"
    },
    "agent.tim"
  ],
  "unhealthy_counter": 2,
  "healthy_counter": 1,
  "total_counter": 2
}

To reproduce, do on the agent:

puppet ssl submit_request
puppet ssl download_cert
puppet facts upload

Now on the puppetserver:

puppet query nodes[certname,report_timestamp]{}

gives you:

[
  {
    "certname": "pe.tim",
    "report_timestamp": "2024-12-05T13:11:55.884Z"
  },
  {
    "certname": "agent.tim",
    "report_timestamp": null
  }
]

with this patch:

{
  "noop": [

  ],
  "corrective_changes": [

  ],
  "used_cached_catalog": [

  ],
  "failed": [

  ],
  "changed": [

  ],
  "unresponsive": [
    "pe.tim"
  ],
  "no_report": [
    "agent.tim"
  ],
  "responsive": [

  ],
  "unhealthy": [
    "pe.tim",
    "agent.tim"
  ],
  "unhealthy_counter": 2,
  "healthy_counter": 0,
  "total_counter": 2
}

Please check off the steps below as you complete each step

  • Put the Jira ticket or Github issue number in parentheses in the Title e.g. (SUP-XXXX) Add Super Duper State Check
  • Update the Jira ticket status to Ready for Review if there is one
  • Review any CI failures and fix issues

@bastelfreak bastelfreak requested a review from a team as a code owner December 5, 2024 14:07
@MartyEwings MartyEwings added the bug Something isn't working label Dec 5, 2024
previously, when running `pe_status_check::agent_state_summary`, the
result didn't only contain the certnames, but also additional data:`

without this patch (one unresponsive node, one without reports at all):

```json
{
  "noop": [

  ],
  "corrective_changes": [

  ],
  "used_cached_catalog": [

  ],
  "failed": [

  ],
  "changed": [

  ],
  "unresponsive": [
    {
      "certname": "pe.tim",
      "latest_report_noop": false,
      "latest_report_corrective_change": false,
      "cached_catalog_status": "not_used",
      "latest_report_status": "unchanged",
      "report_timestamp": "2024-12-05T13:41:55.483Z"
    }
  ],
  "no_report": [
    "agent.tim"
  ],
  "responsive": [
    "pe.tim"
  ],
  "unhealthy": [
    {
      "certname": "pe.tim",
      "latest_report_noop": false,
      "latest_report_corrective_change": false,
      "cached_catalog_status": "not_used",
      "latest_report_status": "unchanged",
      "report_timestamp": "2024-12-05T13:41:55.483Z"
    },
    "agent.tim"
  ],
  "unhealthy_counter": 2,
  "healthy_counter": 1,
  "total_counter": 2
}
```

To reproduce, do on the agent:

```
puppet ssl submit_request
puppet ssl download_cert
puppet facts upload
```

Now on the puppetserver:

```
puppet query nodes[certname,report_timestamp]{}
```

gives you:

```json
[
  {
    "certname": "pe.tim",
    "report_timestamp": "2024-12-05T13:11:55.884Z"
  },
  {
    "certname": "agent.tim",
    "report_timestamp": null
  }
]
```

with this patch:

```json
{
  "noop": [

  ],
  "corrective_changes": [

  ],
  "used_cached_catalog": [

  ],
  "failed": [

  ],
  "changed": [

  ],
  "unresponsive": [
    "pe.tim"
  ],
  "no_report": [
    "agent.tim"
  ],
  "responsive": [

  ],
  "unhealthy": [
    "pe.tim",
    "agent.tim"
  ],
  "unhealthy_counter": 2,
  "healthy_counter": 0,
  "total_counter": 2
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants