Description of problem: Sat 6.10 APIdoc at https://your-sat610/apidoc/v2/repositories/import_uploads.html say that uploads[checksum] uploads[name] are optional. BUT both are mandatory. Please either update the APIdoc or fix the product per APIdoc (fixing the product is imho better - why the API insists on filename or its checksum, if we uniquely identified it via upload_url? Well, checksum *can* be required for the sake of ensuring integrity/validity of uploaded content, but filename..?) Version-Release number of selected component (if applicable): Sat 6.10.3 How reproducible: 100% Steps to Reproduce: 1. Use below script with customized Sat credentials to upload a package to a repository. It is a *fixed* procedure per https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html-single/api_guide/index#sect-API_Guide-Uploading_Content_to_the_Satellite_Server (fixed: see relevant BZ) Usage: ./upload_package_to_repo.sh REPOID /path/to/package.rpm -----8<----- if [ $# -lt 2 ]; then echo "too few arguments" exit fi repoid=${1} package=${2} pkgname=${package##*/} creds=admin:redhat saturl=$(hostname -f) size=$(wc -c $package | awk '{ print $1}') checksum=$(sha256sum $package | awk '{ print $1}') upload_url=$(curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --insecure --user $creds \ --data "{\"size\": ${size}}" \ https://${saturl}/katello/api/repositories/${repoid}/content_uploads | cut -d\" -f4 ) curl --header "Accept:application/json" \ --header "Content-Type:multipart/form-data" \ --request PUT --insecure --user $creds \ --data-urlencode "content@${package}" \ --data-urlencode offset=0 \ --data-urlencode size=${size} \ https://${saturl}/katello/api/repositories/${repoid}/content_uploads/${upload_url} curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request PUT --insecure \ --user $creds \ --data "{\"uploads\":[{\"id\": \"${upload_url}\", \"checksum\": \"${checksum}\", \"name\": \"${pkgname}\"}]}" \ https://${saturl}/katello/api/repositories/${repoid}/import_uploads -----8<----- 2. Use the script to upload a package 3. From the latest curl method, remove either \"checksum\": \"${checksum}\" or \"name\": \"${pkgname}\" attributes and retry. Actual results: 2. Package upload succeeds. 3. Removing checksum, Sat raises Katello::HttpErrors::BadRequest: no implicit conversion of nil into String and removing name, Sat raises ArgumentError: Missing the required parameter 'relative_path' when calling ContentPackagesApi.create error and upload fails. Expected results: Align APIdoc mandatory parameters with reality. Additional info:
See related doc bug https://bugzilla.redhat.com/show_bug.cgi?id=2068453 (as a "superset issue" of this APIdoc/product bug).
Hi Adam and Justin, raising needinfo on you for your awareness due to the customer escallation behind / tight schedule for Sat upgrade. Not sure if the problem is in repositories (Justin) or API (Adam), hence raising the needinfo to both.
API is too generic of a component, most bugs should not go there, so moved to repositories. I'll dig a little big.
I agree, these parameters look required, we should mark them as such.
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34729 has been resolved.
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 (Important: Satellite 6.12 Release), 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-2022:8506