Bug 1202240
| Summary: | provisioning a discovered host via hammer should show all mandatory options, otherwise user gets 500 ISE | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Sachin Ghai <sghai> |
| Component: | Hammer | Assignee: | orabin |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Sachin Ghai <sghai> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.1.0 | CC: | bkearney, lzap, mmccune |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://projects.theforeman.org/issues/9634 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-08-12 13:55:55 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | 1197975 | ||
| Bug Blocks: | 1193977 | ||
Please note that provisioning started when I tried provisioning by providing hostgroup id. ~]# hammer --username admin --password changeme discovery provision --id 6 --hostgroup-id 1 /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT Host created We are rebasing to discovery CLI 0.0.2 this week, if this is not fixed Ori will add required fields. But I think this was alrady fixed. this is related to: https://bugzilla.redhat.com/show_bug.cgi?id=1197975 so they should be resolved together 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 provision --id 3
Could not create the host:
Error: 500 Internal Server Error
[
production.log:
===============
2015-04-28 07:48:02 [I] Processing by Api::V2::DiscoveredHostsController#update as JSON
2015-04-28 07:48:02 [I] Parameters: {"discovered_host"=>{}, "apiv"=>"v2", "id"=>"3"}
2015-04-28 07:48:02 [I] Expire fragment views/tabs_and_title_records-3 (0.1ms)
2015-04-28 07:48:02 [I] Authorized user admin(Admin User)
2015-04-28 07:48:02 [E] undefined method `boot_filename' for nil:NilClass (NoMethodError)
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:60:in `dhcp_attrs'
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:16:in `dhcp_record'
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:140:in `dhcp_conflict_detected?'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:504:in `_run__3475909079161435654__validation__3659363730053100342__callbacks'
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. Reproducible with snap2: -- # hammer --username admin --password changeme discovery provision --id 6 Could not create the host: Error: 500 Internal Server Error -- [root@dhcp201-172 ~]# hammer -u admin -p changeme discovery info --name mac525400c75a5eID: 6 Name: mac525400c75a5e MAC: 52:54:00:c7:5a:5e Last report: 2015/05/05 06:39:30 CPUs: 1 Memory: 995 Disk count: 1 Disks size: 8192 Subnet: libvirt Last Report: 2015/05/05 06:39:30 IP: 192.168.100.17 Model: Organization: Default Organization Location: Default Location The error is a result of 1197975. Installed packages where the issue is reproducible: ruby193-rubygem-foreman_discovery-2.0.0.12-1.el7sat.noarch rubygem-smart_proxy_discovery-1.0.2.1-1.el7sat.noarch rubygem-hammer_cli_foreman_discovery-0.0.1.8-1.el7sat.noarch foreman-discovery-image-2.1.0-20.el7sat.noarch foreman-1.7.2.18-1.el7sat.noarch Reproducible with snap4 c2. -- ]# hammer --username admin --password changeme discovery provision --id 3 Could not create the host: undefined method `boot_filename' for nil:NilClass -- Moving to post since this was merged into upstream today Verified sat6.1 GA snap5 The reported issue has been fixed. Now I didn't get 500 ISE on provisioning a discovered host via hammer. Now hammer throws: # hammer --username admin --password changeme discovery provision --id 2 Could not create the host: Environment can't be blank Architecture can't be blank Operatingsystem can't be blank Domain can't be blank Root password should be 8 characters or more Root password should not be blank - consider setting a global or host group default Partition Table can't be blank unless a custom partition has been defined Medium can't be blank I think this can be improved if we throw the options to user like other cases. For example: [root@i]# hammer --username admin --password changeme host create Could not create the host: Error: Options --environment-id, --architecture-id, --domain-id, --puppet-proxy-id, --operatingsystem-id, --partition-table-id are required I'll file another bz for this. Also as soon as I pass the hostgroup-id to discovered host, provisioning starts perfectly: [root]# hammer --username admin --password changeme discovery provision --id 2 --hostgroup-id 1 Host created And discovered host removed from the list: ]# hammer --username admin --password changeme discovery list ---|------|-----|-------------|------|--------|------------|------------|--------|------------ ID | NAME | MAC | LAST REPORT | CPUS | MEMORY | DISK COUNT | DISKS SIZE | SUBNET | LAST REPORT ---|------|-----|-------------|------|--------|------------|------------|--------|------------ This bug is slated to be released with Satellite 6.1. This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015. |
Description of problem: I was trying to provision a discovered host via hammer cli but wasn't sure about the mandatory options.. so I tried: # hammer --username admin --password changeme discovery provision Could not create the host: Error: Could not find discovered_host, please set one of options --name, --id. Here error says please set discovered_host name or ID. fetch id: ========== ]# hammer --username admin --password changeme discovery list ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- ID | NAME | MAC | LAST REPORT | CPUS | MEMORY | DISK COUNT | DISKS SIZE | SUBNET | LAST REPORT ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- 6 | mac525400167941 | 52:54:00:16:79:41 | 2015/03/16 01:48:12 | 1 | 995 | 1 | 8192 | libvirt | 2015/03/16 01:48:12 ---|-----------------|-------------------|---------------------|------|--------|------------|------------|---------|-------------------- ]# hammer --username admin --password changeme discovery provision --id 6 Could not create the host: Error: 500 Internal Server Error production.log says: =================== 2015-03-16 07:47:24 [I] Processing by Api::V2::DiscoveredHostsController#update as JSON 2015-03-16 07:47:24 [I] Parameters: {"discovered_host"=>{}, "apiv"=>"v2", "id"=>"6"} 2015-03-16 07:47:24 [I] Authorized user admin(Admin User) 2015-03-16 07:47:24 [E] undefined method `boot_filename' for nil:NilClass (NoMethodError) /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:60:in `dhcp_attrs' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:16:in `dhcp_record' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:140:in `dhcp_conflict_detected?' /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:504:in `_run__368707488151697265__validation__15510762665 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: As per hammer error message, I provided the discovered host id, but got 500 ISE Expected results: if user didn't specify any option to "hammer discovery provision" then hammer should throw message with all mandatory options like: Could not create the host: Error: Could not find discovered_host, please set one of options --name, --id along with <other_options> OR when user provides "hammer discovery provision --id 6" then it should throw the proper error instead of 500 internal server error. Additional info: similar bz (https://bugzilla.redhat.com/show_bug.cgi?id=1197975) is already filed for the error but that's for rest API. This bz is for improving the error and required mandatory options for provisioning via CLI.