Bug 1497641

Summary: Not able to set user's public key.
Product: [oVirt] ovirt-engine Reporter: Vitalii Yerys <vyerys>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: bugs, jbelka, tjelinek
Target Milestone: ovirt-4.2.0Keywords: Reopened
Target Release: ---Flags: rule-engine: ovirt-4.2+
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: 2017-12-20 11:36:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vitalii Yerys 2017-10-02 10:21:46 UTC
Description of problem:
Not able to set user's public key via rest api call.

Version-Release number of selected component (if applicable):

4.2.0-0.0.master.20170927183005.git49790b2.el7.centos

How reproducible:

100%


Steps to Reproduce:
1. Compose and send a api request:
Method:
    POST
URL:
    https://engine-fqdn/ovirt-engine/api/users/{user_uuid}/sshpublickeys
Headers:
    Content-Type: application/xml
Body:
<ssh_public_key>
    <content>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC04CrBCpZ5ZQfGncgsr61TV727loTHQWx9KlAyNLgxKsnOnsDFQFhStg8vTZm8t4e2NyIkjjBQ/iiOBOH/9NdBrOToOF0brmMHFq3gq55nziM3hlgo8eJm0Ia9cs8yaWBllaTbtYM7rLIy56ih9tfSeKtkyAU97im24gTzOqcLaswVWD7qjeXZkLpYJDKDLWDgwygqVMN+9j/3OcHzWxScfscnjfmbBtxTS/F37ISgpjGEVu6VtmXsB1Z4qTAQ4YrDsvFQCq5mnuvVDT3GVAM3UrSDFJt02HWYd5Mzdvi0XeJaSwOlSNljXEg5PYOCkA1pUdp8yZhsYUUc9kv6OHYp root@rh-test-serv
    </content>
</ssh_public_key>


Actual results:

Response headers:

    Status Code: 400 Bad Request
    Connection: close
    Content-Encoding: gzip
    Content-Length: 179
    Content-Type: application/xml;charset=UTF-8
    Correlation-Id: 25f32521-5cc5-4ab5-8aa6-c7be8dc4bbf9
    Date: Mon, 02 Oct 2017 09:57:33 GMT
    Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips

Response body:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <fault>
        <detail>Parameters 'key.id' or 'key.name' are mandatory but both were not provided.</detail>
        <reason>Input validation failed.</reason>
    </fault>

Expected results:

Request should return 200 response and set users key.

Additional info:

Comment 1 Tomas Jelinek 2017-10-03 07:47:42 UTC
well, it complains that it is missing the key.id or key.name. So, when you set it, it will work. 

Please feel free to reopen if it does not help.

Comment 2 Juan Hernández 2017-10-19 12:48:24 UTC
I am moving back to POST because the engine still needs to be modified to use the version of the model where this is fixed.

Comment 3 Jiri Belka 2017-11-02 09:34:35 UTC
ok, ovirt-engine-restapi-4.2.0-0.0.master.20171029154613.git19686f3.el7.centos.noarch

curl \
--insecure \
--user 'admin@internal:xxxxxx' \
-X POST \
-H 'Version: 4' \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \
--data '
<ssh_public_key>
    <content>ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17cG03EgF+NVbmhHzZmeqWQOEs6icbrVvnkIGLlSmHSbUQn2PV61UnZrv/yZpgEZWE1sNWpQFJhiACr4qQbQyFmlNj+vkkas0xaJqc7TuHI+kgA34YbLzXn6X+pBKqTp1KyTBDtSZ5Lm013G4FYy0x1XapFFnhprVPF3bHlB8bnnYjjRACfgzqvLpRGorL7+wdyj59bD4R47ZZuieovKQEVfccABxbb2/2M4kXxdBR+yqhcKjOl2hpou8Yt0sp+P0SyTPZOO45oAZ50tV6jcKZ5JBtRfBzNjEaqMukcpu0pisdR6UFwfKnPWc7n1qMFrtYd1P7AyJJXXr0mXI+SaJQ==</content>
</ssh_public_key>
' \
https://www.example.com/ovirt-engine/api/users/59e0bb6a-03fa-0217-03c9-000000000118/sshpublickeys

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <status>complete</status>
</action>

Comment 4 Sandro Bonazzola 2017-12-20 11:36:16 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.