Error persists even after removing puppet class from hostgroup
Environment
Satellite 6.4
Capsule 6.4
Issue
Getting this error on the capsule server this activity was performed on:
# /usr/bin/puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Stdlib::Stages] is already declared; cannot redeclare (file: /usr/share/puppet/modules/stdlib/manifests/init.pp, line: 18) (file: /usr/share/puppet/modules/stdlib/manifests/init.pp, line: 18, column: 3) on node capsule.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Tried this possible solution - however, that does not seem to fix this issue this time.
Resolution
Search for enabled puppet classes in hostgroups:
# hammer hostgroup list --organization-id 1 --puppet-class access_insights_client
-
ID | NAME | TITLE | OPERATING SYSTEM | PUPPET ENVIRONMENT | MODEL
-|-|-|-|-|-
2 | sub_test_dev | test_dev/sub_test_dev | Red Hat Enterprise Linux Atomic Host 7 | development |
-|-|-|-|-
Once found, use the WebUI to remove the puppet classes:
1 Access the Satellite Web GUI
2 Navigate to Configure > Host groups
3 Select a hostgroup from the listed groups in hammer
4 Navigate to Puppet Classes
5 If there is a stdlib::stages class under Included Classes column, just click the dash (-) icon to remove it
6 Repeat the same steps for each hostgroup in the puppet environment
7 Run puppet agent to check if the error was resolved
For more KB articles/solutions related to Red Hat Satellite 6.x Puppet Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Puppet Issues
Root Cause
Nested hostgroups were overriding other top-level hostgroups.
Diagnostic Steps
Check for puppet-classes within hostgroups via hammer:
# hammer hostgroup list --organization-id 1
-
ID | NAME | TITLE | OPERATING SYSTEM | PUPPET ENVIRONMENT | MODEL
-|-|-|-|-|-
1 | test_dev | test_dev | Red Hat Enterprise Linux Atomic Host 7 | development |
2 | sub_test_dev | test_dev/sub_test_dev | Red Hat Enterprise Linux Atomic Host 7 | development |
-|-|-|-|-
However, puppet classes or puppet class id's can be specified:
# hammer hostgroup list -h
Usage:
hammer hostgroup list [OPTIONS]
Options:
--location LOCATION_NAME Location name
--location-id LOCATION_ID
--location-title LOCATION_TITLE Location title
--order ORDER Sort results
--organization ORGANIZATION_NAME Organization name
--organization-id ORGANIZATION_ID Organization ID
--organization-title ORGANIZATION_TITLE Organization title
--page PAGE Paginate results
--per-page PER_PAGE Number of entries per request
--puppet-class PUPPET_CLASS_NAME Puppet class name
--puppet-class-id PUPPET_CLASS_ID ID of Puppet class
--search SEARCH Filter results
-h, --help Print help
Should be able to search for hostgroups that have a specific puppet class enabled.
# hammer hostgroup list --organization-id 1 --puppet-class access_insights_client
-
ID | NAME | TITLE | OPERATING SYSTEM | PUPPET ENVIRONMENT | MODEL
-|-|-|-|-|-
2 | sub_test_dev | test_dev/sub_test_dev | Red Hat Enterprise Linux Atomic Host 7 | development |
-|-|-|-|-
Checking in the WebUI, and 'test_dev' did not have that puppet class enabled, while 'sub_test_dev' did.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.