Bug 1367136
Summary: | Hostgroup environment isn't inherited by Host via model API | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Shimon Shtein <sshtein> | ||||||
Component: | Hosts | Assignee: | Ondřej Pražák <oprazak> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Jitendra Yejare <jyejare> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 6.2.0 | CC: | bkearney, jyejare, lzap, mburgerh, mmccune, oprazak, orabin, sghai, sthirugn | ||||||
Target Milestone: | Unspecified | ||||||||
Target Release: | Unused | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | foreman-1.11.0.55-1 | Doc Type: | If docs needed, set a value | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 1394364 (view as bug list) | Environment: | |||||||
Last Closed: | 2016-12-12 17:12:44 UTC | Type: | --- | ||||||
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: | |||||||||
Bug Blocks: | 1319283, 1394363, 1394364 | ||||||||
Attachments: |
|
Description
Shimon Shtein
2016-08-15 16:54:05 UTC
Created from redmine issue http://projects.theforeman.org/issues/12936 Upstream bug assigned to oprazak Moving to POST since upstream bug http://projects.theforeman.org/issues/12936 has been closed QA notes: To test this, make sure that discovery auto provisioning sets Puppet Master/CA flags from hostgroup, symptoms of this bug was that it was left blank. HOTFIX FOR 6.2.2 AVAILABLE AT: http://people.redhat.com/~lzapleta/hotfix/hostgroup-autoprovisioning-satellite-6.2.2-1367136/ Customers should not upgrade to 6.2.3-6.2.4 as the official fix is scheduled for 6.2.5. *** Bug 1393449 has been marked as a duplicate of this bug. *** HOTFIX FOR 6.2.4 AVAILABLE AT: http://people.redhat.com/~mmccune/hotfix/1367136/foreman-BZ1367136.tar This is still on track to be delivered in 6.2.5 So What would be the steps for QE to verify this: I assume Steps as below: 1. Create Hostgroup(using API, CLI or UI modules) and select some puppet environment. 2. From API attempt to create a host without passing puppet environment and choose step 1 hostgroup. Assert: 1. Host should fetch puppet environment from Hostgroup. 2. Host should be created successfully. Please Confirm !! As per comment3 followed steps to validate the fix with sat6.2.5 snap1: 1 created a hostgroup with Puppet Master/CA fields associated to hostgroup 2 later defined a discovery rule and associated the hg created in above step1 3. Enabled auto-provisioning 4. discovered a host and auto-provisioning started. Once host is provisioned, I see that both fields are correctly associated to provisioned host (checked from edit host page). Please see the attachment. Also, I can see puppet correctly installed when I reviewed the provisioning template. Please see the attachment. Please advice if above steps are correct to validate the bz or something else needs to be validated. Created attachment 1227343 [details]
puppet Master/CA fileds are inherited for discovered host via auto-prov
Created attachment 1227344 [details]
on reviewing provisioning template of provisioned discovered host, it correctly renders the puppet
Steps in comment #15 should verify this fix works. While verifying this bug, I have found an error as below: Steps: 1. I created a hostgroup with all the fields required for libvirt provisioning. 2. I was attempting to create a Host using this above Hostgroup as follows: Command: #curl -X POST -d '{"host":{"name":"host1","organization_ids":[1],"location_ids":[2],"ptable_id":[61],"compute_resource_id":[1],"root_pass":"somepass","hostgroup_id":[1],"build":true,"enabled":true}}' --header "Content-Type:application/json" https://qeblade36.rhq.lab.eng.bos.redhat.com/api/hosts/ --insecure Executing this, the error message has been thrown: { "error": {"message":"undefined method `inherited_puppet_proxy_id' for #<Array:0x007fddee7d3ad8>" } May I know If any parameter is missing or is it a real Bug ? Please help. This one is on me, I did not notice you were passing an array in "hostgroup_id". Try changing it to "hostgroup_id": "1". There will be additional validation requirements on host, but it will not fail with error. This verifies the inheritance works, however the issue refers to how objects inherit the attributes internally. If you want to be thorough, you could do something like the following in the console (tfm-rake console): hg = Hostgroup.find 1 h = Host.new(:name => "myhost", :hostgroup => hg) h.environment # should be environment inherited from hg see the corresponding test for reference: https://github.com/theforeman/foreman/pull/3243/files#diff-88c8d0302188366e58cfd358acf05756R2645 Thanks for the reply Ondrej, I tried your suggestion of passing hostgroup_id as string and that works perfectly. I am not getting error mentioned in comment 20 at all. But, I am facing something new now, I am creating host on libvirt compute resource which id is '1' in my case. And so I am passing that parameter 'compute_resource_id':"1". Following is the curl command: # curl -X POST -d '{"host":{"name":"host1","organization_id":"1","location_id":"2","ptable_id":"61","compute_resource_id":1,"root_pass":"somepass","hostgroup_id":"1","build":true,"enabled":true}}' --header "Content-Type:application/json" https://hostname.domain.com/api/hosts/ --insecure But I am getting the following error: { "error": {"id":null,"errors":{"interfaces.mac":["can't be blank"]},"full_messages":["Mac can't be blank"]} } I believe this error message should appear only when provisioning on bare metal without providing the mac address. But this message is appearing for libvirt compute resource which is strange. Is this a bug or am I missing any parameters ? I found a solution: -d '{"host":{"name":"host1","organization_id":"1", "location_id":"2", "ptable_id":"61", "compute_resource_id": "1", "root_pass": "changeme", "hostgroup_id": "4", "build": "true","enabled": "true","interfaces_attributes": [{"primary": "true", "network": "default", "provision": "true", "compute_attributes": {"type": "network", "network": "default", "bridge": "virbr1", "model": "virtio"} }], "medium_id":"9"}}' passed the validations and created a host record on libvirt for me. 'interface_attributes' may need a little tweaking based on your actual setup. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:2940 |