uyuni-project / uyuni

Source code for Uyuni
https://www.uyuni-project.org/
GNU General Public License v2.0
431 stars 180 forks source link

dateTime.iso8601 is not accepted for API endpoint errata.setDetails #8269

Closed SvenC56 closed 1 week ago

SvenC56 commented 8 months ago

Problem description

Hi all,

I'm trying to update an errata over the HTTP/JSON API (/rhn/manager/api/errata/setDetails) like this:

{
    "advisoryName": "USN-3515-1",
    "details": {
        "issue_date": "2018-01-04T00:00:00Z",
        "update_date": "2018-01-04T00:00:00Z",
        "cves": [
            "CVE-2017-17405"
        ]
    }
}

which results in:

{
    "success": false,
    "message": "Wrong 'issue_date' format."
}

Any advice? I already tried different formats, as well as the format used internally in the db. Nothing gets accepted.

Edit: The API Doc states it requires: dateTime.iso8601 "issue_date"

Thank you!

Steps to reproduce

  1. Login via /auth/login Method
  2. Call /errata/setDetails with the provided payload

Uyuni version

Repository         : uyuni-server-stable
Name               : Uyuni-Server-release
Version            : 2024.01-230900.212.1.uyuni3
Arch               : x86_64
Anbieter           : obs://build.opensuse.org/systemsmanagement:Uyuni
Support Level      : Stufe 3
Installierte Größe : 1,4 KiB
Installiert        : Ja
Status             : veraltet (Version 2023.12-230900.210.2.uyuni3 installiert)
Quellpaket         : Uyuni-Server-release-2024.01-230900.212.1.uyuni3.src
Zusammenfassung    : Uyuni Server
Beschreibung       : 
    Uyuni lets you efficiently manage physical, virtual,
    and cloud-based Linux systems. It provides automated and cost-effective
    configuration and software management, asset management, and system
    provisioning.

Uyuni proxy version (if used)

N/A

Useful logs

N/A

Additional information

No response

avshiliaev commented 7 months ago

Hey @SvenC56 thanks for the report. It seems like a valid issue, or at least I'm getting the same result as you do.

fockarty commented 3 months ago

i have the same issue, a date as Jun 18, 2024, 09:00:00 PM works for me

SvenC56 commented 3 months ago

i have the same issue, a date as Jun 18, 2024, 09:00:00 PM works for me

I cannot confirm this @fockarty. The error persists. image

fockarty commented 1 month ago

i ran it like this: requests.post(MANAGER_URL + '/system/scheduleApplyStates', cookies=cookies, json = data, verify=SSLVERIFY)

data = {} data['sids'] = system['id'] data['earliestOccurrence'] = "Sep 16, 2024, 01:00:00 PM" data['stateNames'] = 'up2date' data['test'] = True

and get response:

{'sids': 1000010004, 'earliestOccurrence': 'Sep 16, 2024, 01:00:00 PM', 'stateNames': 'up2date', 'test': True} {'success': True, 'result': 54}

which makes Uyuni incorrect because is8601 has different format: https://www.iso.org/iso-8601-date-and-time-format.html#:~:text=Therefore%2C%20the%20order%20of%20the,27%2018%3A00%3A00.000.

cbbayburt commented 1 month ago

Hi all, thanks for the report. I can confirm that the issue is valid specifically for errata.setDetails endpoint.

Most endpoints are quite forgiving in accepting different types of date formats, even though the docs specify ISO8601, so any unambiguous date format should work.

However, this specific endpoint uses a different legacy method to parse dates and fails (both in HTTP and XMLRPC).

I need to check if there are any other overlooked endpoints like this and fix them all at once.