Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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:
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.
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