Bug 1396551 - error when PUTing a numeric id to /api/v2/hosts/:id for any *_id attributes
Summary: error when PUTing a numeric id to /api/v2/hosts/:id for any *_id attributes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Marek Hulan
URL:
Whiteboard:
Depends On:
Blocks: 1479962
TreeView+ depends on / blocked
 
Reported: 2016-11-18 15:38 UTC by Rob Marti
Modified: 2021-06-10 11:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 13670 0 None None None 2016-11-21 07:04:55 UTC

Description Rob Marti 2016-11-18 15:38:58 UTC
JSON provided:

{
    "architecture_id": 1
}

Response:

{
  "error": {
    "message": "ERROR:  operator does not exist: character varying = integer\nLINE 1: ...architectures\".\"id\" = 1 OR \"architectures\".\"name\" = 1))  ORD...\n                                                             ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.\n" 
  }
}

Ultimately, one should be able to provide the exact same JSON received from a GET on /api/v2/hosts/:id back as a PUT without errors.

From http://projects.theforeman.org/issues/13670

Customer is running into this.  If he typecasts it as a string there are no errors.

Comment 3 hprakash 2017-03-30 07:12:40 UTC
While this ticket is being worked, can we amend the API doc- https://<satellite-fqdn>/apidoc/v2/hosts/create.html for passing the hostgroupd_id as string?

Comment 6 Satellite Program 2018-02-21 16:54:17 UTC
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/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.