Bug #9870
closed[hammer] Auto-provisioning a host, when no rule is defined, should raise proper error
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1202251
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: