Description of problem: In hammer, we have auto-provision cmd under discovery. --- ]# hammer --username admin --password changeme discovery auto-provision --help Usage: hammer discovery auto-provision [OPTIONS] Options: --id ID --name NAME Name to search by -h, --help print help -- I tried auto-provision via hammer and neither discovery rule was defined nor any rule was defined. But hammer says 'host created' Its seems to be misleading. Hammer should throw an error like: no discovery rule match with discovered host here is the output: ---- # hammer --username admin --password changeme discovery auto-provision --name mac5254003ea9d9 Host created ---- production.log: 2015-03-16 08:38:18 [I] Processing by Api::V2::DiscoveredHostsController#auto_provision as JSON 2015-03-16 08:38:18 [I] Parameters: {"apiv"=>"v2", "id"=>"7", "discovered_host"=>{}} 2015-03-16 08:38:18 [I] Authorized user admin(Admin User) 2015-03-16 08:38:18 [I] Rendered /opt/rh/ruby193/root/usr/share/gems/gems/foreman_discovery-2.0.0.6/app/views/api/v2/discovered_hosts/auto_provision.json.rabl (9.5ms) 2015-03-16 08:38:18 [I] Completed 200 OK in 49ms (Views: 9.2ms | ActiveRecord: 16.8ms) Version-Release number of selected component (if applicable): sat6.1 beta snap6 compose2 (Satellite-6.1.0-RHEL-6-20150311.1). How reproducible: always Steps to Reproduce: 1. 2. 3. Actual results: on executing auto-provision via hammer, hammer throws "host created" and nothing happens.. It looks misleading.. Expected results: auto-provisioning via hammer should throw proper error when no discovery rule defined for discovered host Hammer should throw error like: no matching rule found for discovered host? Additional info:
Please note that auto-provisioning via hammer works if user define a matching discovery rule. I think we should throw an error when no rule is defined or no matching rule available for discovered host
Valid bug, Ori can you squeeze this in 0.0.2?
Created redmine issue http://projects.theforeman.org/issues/9870 from this bug
Moving to POST since upstream bug http://projects.theforeman.org/issues/9870 has been closed ------------- Ori Rabin Applied in changeset commit:foreman_discovery|5188cf125376dd783653a82040e24a4b3e294cb5.
Reported issue is still reproducible with: sat6.1 GA snap1 compose 2 (Satellite-6.1.0-RHEL-7-20150424.0) [root@cloud-qe-9 ~]# hammer --username admin --password changeme discovery list ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- ID | NAME | MAC | LAST REPORT | CPUS | MEMORY | DISK COUNT | DISKS SIZE | SUBNET | LAST REPORT ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- 3 | mac525400c6b527 | 52:54:00:c6:b5:27 | 2015/04/27 12:24:38 | 1 | 995 | 1 | 8192 | libvirt | 2015/04/27 12:24:38 ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- [root@cloud-qe-9 ~]# hammer --username admin --password changeme discovery auto-provision --name mac525400c6b527 Host created [root@cloud-qe-9 ~]#
The compose is using a version of discovery prior to Bryan's merge. The package needs to be rebuilt with the changes and then tested. Moving to post until there is a new package.
Issue is still reproducible with sat6.1 GA Snap2 (Satellite-6.1.0-RHEL-7-20150429.2) when no rule is defined, hammer still throwing 'Host created'. # hammer --username admin --password changeme discovery auto-provision --name mac525400c75a5e Host created
upstream bug is closed
verified with sat6.1 GA snap7. now I get this error on auto-provisioning a discovered host when no rule is defined: ~]# hammer --username admin --password changeme discovery auto-provision --name mac52540038a98e Could not create the host 2015-06-05 07:16:16 [I] Processing by Api::V2::DiscoveredHostsController#auto_provision as JSON 2015-06-05 07:16:16 [I] Parameters: {"apiv"=>"v2", "id"=>"3", "discovered_host"=>{}} 2015-06-05 07:16:16 [I] Authorized user admin(Admin User) 2015-06-05 07:16:16 [I] Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (0.3ms) 2015-06-05 07:16:16 [I] Completed 422 Unprocessable Entity in 29ms (Views: 0.9ms | ActiveRecord: 14.2ms) "Could not create the host" is very generalized error message. Error message should be friendly enough for user to know what's going wrong. I think as per bug description, if we can change the error like below would be more appropriate. "No matching rule found for discovered host"
Thanks Orabin. Assigning back.
Moving to POST since this was merged upstream
Delivered with Snap12.
Verified with sat6.1.1 GA snap12. Now I'm getting proper error message. Thanks Orabin for fixing it. [root@cloud-qe-17 ~]# hammer --username admin --password changeme discovery auto-provision --name mac52540063d7a2 Could not create the host: No rule found for host mac52540063d7a2 [root@cloud-qe-17 ~]#
This bug was fixed in Satellite 6.1.1 which was delivered on 12 August, 2015.