Skip to content

puppet_agent::run plan doesn't recognize failed puppet run #737

@bastelfreak

Description

@bastelfreak

Describe the Bug

I've a node that doesn't receive a working catalog:

[root@elastic01 ~]# puppet agent -t
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Notice: Requesting catalog from puppet:8140 (10.0.1.1)
Notice: Catalog compiled by puppet
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Class[Elastic_stack::Repo]' for relationship on 'Class[Elasticsearch::Package]' on node elastic01
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
[root@elastic01 ~]#

When I run bolt plan run puppet_agent::run --targets elastic01

Starting: plan puppet_agent::run
Starting: Check for Puppet agent on elastic01
Finished: Check for Puppet agent with 0 failures in 2.6 sec
Starting: Run Puppet agent on elastic01
Finished: Run Puppet agent with 0 failures in 13.98 sec
Finished: plan puppet_agent::run in 16.59 sec
Finished on elastic01:
  Info: Using environment 'production'
  Info: Retrieving pluginfacts
  Info: Retrieving plugin
  Info: Loading facts
  Notice: Requesting catalog from puppet:8140 (10.0.1.1)
  Notice: Catalog compiled by puppet
  {
    "report": {
      "host": "elastic01",
      "time": "2024-11-01T18:33:25.278068282+01:00",
      "configuration_version": null,
      "transaction_uuid": "abd4b06e-4abb-4313-bfe0-2f4784d2e9ed",
      "report_format": 12,
      "puppet_version": "8.8.1",
      "status": "failed",
      "transaction_completed": false,
      "noop": false,
      "noop_pending": false,
      "environment": "production",
      "logs": [
        {
          "level": "info",
          "message": "Using environment 'production'",
          "source": "Puppet",
          "tags": [
            "info"
          ],
          "time": "2024-11-01T18:33:25.621086284+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "info",
          "message": "Retrieving pluginfacts",
          "source": "Puppet",
          "tags": [
            "info"
          ],
          "time": "2024-11-01T18:33:25.695307560+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "info",
          "message": "Retrieving plugin",
          "source": "Puppet",
          "tags": [
            "info"
          ],
          "time": "2024-11-01T18:33:25.754770248+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "info",
          "message": "Loading facts",
          "source": "Puppet",
          "tags": [
            "info"
          ],
          "time": "2024-11-01T18:33:28.769399749+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "notice",
          "message": "Requesting catalog from puppet:8140 (10.0.1.1)",
          "source": "Puppet",
          "tags": [
            "notice"
          ],
          "time": "2024-11-01T18:33:29.914082743+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "notice",
          "message": "Catalog compiled by puppet",
          "source": "Puppet",
          "tags": [
            "notice"
          ],
          "time": "2024-11-01T18:33:33.747198975+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "err",
          "message": "Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Class[Elastic_stack::Repo]' for relationship on 'Class[Elasticsearch::Package]' on node elastic01",
          "source": "Puppet",
          "tags": [
            "err"
          ],
          "time": "2024-11-01T18:33:33.748008863+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "warning",
          "message": "Not using cache on failed catalog",
          "source": "Puppet",
          "tags": [
            "warning"
          ],
          "time": "2024-11-01T18:33:33.748174011+01:00",
          "file": null,
          "line": null
        },
        {
          "level": "err",
          "message": "Could not retrieve catalog; skipping run",
          "source": "Puppet",
          "tags": [
            "err"
          ],
          "time": "2024-11-01T18:33:33.748301569+01:00",
          "file": null,
          "line": null
        }
      ],
      "metrics": {
        "resources": {
          "name": "resources",
          "label": "Resources",
          "values": [
            [
              "total",
              "Total",
              0
            ],
            [
              "skipped",
              "Skipped",
              0
            ],
            [
              "failed",
              "Failed",
              0
            ],
            [
              "failed_to_restart",
              "Failed to restart",
              0
            ],
            [
              "restarted",
              "Restarted",
              0
            ],
            [
              "changed",
              "Changed",
              0
            ],
            [
              "out_of_sync",
              "Out of sync",
              0
            ],
            [
              "scheduled",
              "Scheduled",
              0
            ],
            [
              "corrective_change",
              "Corrective change",
              0
            ]
          ]
        },
        "time": {
          "name": "time",
          "label": "Time",
          "values": [
            [
              "startup_time",
              "Startup time",
              0.342585476
            ],
            [
              "plugin_sync",
              "Plugin sync",
              3.0698982240000987
            ],
            [
              "fact_generation",
              "Fact generation",
              1.1442879470000662
            ],
            [
              "total",
              "Total",
              8.470369591
            ]
          ]
        },
        "changes": {
          "name": "changes",
          "label": "Changes",
          "values": [
            [
              "total",
              "Total",
              0
            ]
          ]
        },
        "events": {
          "name": "events",
          "label": "Events",
          "values": [
            [
              "total",
              "Total",
              0
            ],
            [
              "failure",
              "Failure",
              0
            ],
            [
              "success",
              "Success",
              0
            ]
          ]
        }
      },
      "resource_statuses": {
      },
      "corrective_change": false,
      "cached_catalog_status": "not_used"
    },
    "exitcode": 1
  }
Successful on 1 target: elastic01
Ran on 1 target

Expected Behavior

I expect that I see a proper error message.

Steps to Reproduce

  • create broken puppet code that doesn't compile
  • run the puppet_agent::run plan

Environment

  • puppetlabs-puppet_agent 4.21.0

Additional Context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions