Feature #22593
openProvide better feedback for Puppet class import, especially for broken classes
Description
Description of problem:
Foreman offers three possibilities to refresh the internal list of Puppet classes:
- Button on https://foreman.example.com/puppetclasses
- hammer proxy import-classes --id $CAPSULE --environment $ENV
- POST /api/environments/$ENV/smart_proxies/$CAPSULE/import_puppetclasses
The syntax of the Puppet modules is checked, but not reported back to the user. Even worse the classes are silently removed from all associated hosts and hostgroups.
Steps to Reproduce:
- cd /etc/puppet
- mkdir rubis
- cd rubis/
- mkdir modules
- cd modules/
- git clone https://github.com/puppetlabs/helloworld
- hammer environment create --name rubis --locations LAB --organizations "BRubisch LAB"
- hammer proxy import-classes --id 1 --environment rubis
-> class is visible in https://foreman.example.com/puppetclasses, Foreman's production log:
2017-11-28 13:51:26 b768c46b [app] [I] Started POST "/api/environments/8/smart_proxies/1/import_puppetclasses" for ::1 at 2017-11-28 13:51:26 +0100
2017-11-28 13:51:26 b768c46b [app] [I] Processing by Api::V2::SmartProxiesController#import_puppetclasses as JSON
2017-11-28 13:51:26 b768c46b [app] [I] Parameters: {"dryrun"=>false, "apiv"=>"v2", "environment_id"=>"8", "id"=>"1", "smart_proxy"=>{}}
2017-11-28 13:51:26 b768c46b [app] [I] Authorized user admin(Admin User)
2017-11-28 13:51:27 b768c46b [app] [I] Rendered api/v1/import_puppetclasses/show.json.rabl within api/layouts/import_puppetclasses_layout (1.8ms)
2017-11-28 13:51:27 b768c46b [app] [I] Completed 200 OK in 834ms (Views: 6.6ms | ActiveRecord: 26.5ms)
- vi helloworld/manifests/init.pp
Add a curly bracket at the end of the file - hammer proxy import-classes --id 1 --environment rubis
-> class is gone from in https://foreman.example.com/puppetclasses, neither hammer nor the Foreman's production log shows any errors:
2017-11-28 13:51:39 0582f668 [app] [I] Started POST "/api/environments/8/smart_proxies/1/import_puppetclasses" for ::1 at 2017-11-28 13:51:39 +0100
2017-11-28 13:51:39 0582f668 [app] [I] Processing by Api::V2::SmartProxiesController#import_puppetclasses as JSON
2017-11-28 13:51:39 0582f668 [app] [I] Parameters: {"dryrun"=>false, "apiv"=>"v2", "environment_id"=>"8", "id"=>"1", "smart_proxy"=>{}}
2017-11-28 13:51:39 0582f668 [app] [I] Authorized user admin(Admin User)
2017-11-28 13:51:40 0582f668 [app] [I] Rendered api/v1/import_puppetclasses/show.json.rabl within api/layouts/import_puppetclasses_layout (1.6ms)
2017-11-28 13:51:40 0582f668 [app] [I] Completed 200 OK in 813ms (Views: 2.5ms | ActiveRecord: 31.0ms)
Actual results:
No notification about the broken Puppet class
Expected results:
User is alerted about the error
Additional info:
Ideally we would keep the linkage from hosts and hostgroups to the Puppet class, even it's temporary unusable.
Updated by Ondřej Pražák about 7 years ago
- Subject changed from Provide better feedback for Puppet class import, especially for broken classes to Provide better feedback for Puppet class import, especially for broken classes
- Category changed from PuppetCA to Puppet integration