| Summary: | Duplicate host getting created every time during upload facts with API "POST /api/hosts/facts" | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | vijsingh |
| Component: | Puppet | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED WONTFIX | QA Contact: | Katello QA List <katello-qa-list> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.2.2 | CC: | gassmann, jcallaha, ktordeur, mhulan, vijsingh |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-09-04 17:58:19 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: | |
|
Description
vijsingh
2016-11-29 12:36:10 UTC
Duplicated hosts are only created, when uploading the facts for a new host using a restricted user with only upload_facts permissions. When uploading the facts with with the admin user, it will correctly update the existing host. When uploading facts to an existing host with the restricted user, it will throw the following error: ~~~ # curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u reporter:Password -d @/tmp/upload_facts.json https://satellite/api/hosts/facts { "error": {"message":"Resource host not found by id ''"} } ~~~ It looks like there's an implicitly required permission to upload facts correctly. What permissions does the user with login "user" has? Can you reproduce it with admin user? What's the value of "Use short name for VMs" setting? (In reply to Marek Hulan from comment #3) > What permissions does the user with login "user" has? Can you reproduce it > with admin user? Permission for restricted user is `upload_facts` and same is reproduce by restricted user only not by admin user. > What's the value of "Use short name for VMs" setting? Would you please provide some brief on above question. Could you please also retry if you give the user view_hosts permission? You can find out the value of "Use short name for VMs" setting by navigating to Administer -> Settings -> Provisioning tab. See the value column for this setting. (In reply to Marek Hulan from comment #5) > Could you please also retry if you give the user view_hosts permission? You Tried with `view_hosts` permission however still getting the duplicate entries with restricted user. > can find out the value of "Use short name for VMs" setting by navigating to > Administer -> Settings -> Provisioning tab. See the value column for this > setting. It's `value = false`. Thanks for update. Could you please check what organization and location the newly created host is assigned to? Is the user also assigned to some of these? Could you please get the production.log with debug log level so we could see actual SQL queries? Also please upload your /var/tmp/myhost.json. It would greatly help if you had a reproducing environment. Strange thing is that it worked fine for me while I worked on BZ 1404968 which might be something that you might also hit. Hi Marek, I'm the customer who opened the originating case (01744905) for these issues. I give you the full context of these issues. Here are the steps that cover all issues: 1. register the host with new domain (myhost.foo.com) using activation key. 2. upload facts with restricted upload_facts user: Result: - fact upload is correctly associated with registered host - no Domain is created and no domain is shown in the host details 3. upload facts with admin user. Results: - Domain foo.com is created - host is associated with foo.com in the host details 4. upload facts with restricted user no longer works: Result: Resource host not found by id '' 5. Open Domain in GUI and Submit to save domain correctly 6. upload facts with restricted user works again 7. subscription-manager unregister 8. delete the host in Satellite 9. uploading facts with restricted user leads to duplicate entries. Details for the Domain part We never defined the domains manually. I just reproduced the implicit creation of the domain when uploading fact with the admin user. Steps to reproduce: 1. replace domain in upload_facts.json # sed -i 's/yourdomain.com/newdomain.ch/' /var/tmp/myhost.json 2. upload the json with admin user. curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:Password -d @/var/tmp/myhost.json https://localhost/api/hosts/facts --insecure 3. newdomain.ch is shown in GUI Infrastructure > Domains in context "Any Organization" - When editing the domain, the Location and Organization are displayed as selected. - The domain is not displayed when in context of the organisation. 4. After clicking submit without any changes, the domain is available in the Organisation context. Hello Philipp, thank you very much for more information. I'm sorry I could not get to this BZ earlier. I think I start to understand what's going on. It actually confirms my comment https://bugzilla.redhat.com/show_bug.cgi?id=1404968#c3 Let's move the discussion there, I'll keep this open to investigate if we could do something about duplicated records, but the cause is tracked under BZ 1404968 and should be fixed there as well. Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you. |