Bug 2232625
| Summary: | Incorrect error message presented in relation to content-import * on disconnected satellite server | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Benjamin Kielhold <bkielhol> |
| Component: | Pulp | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED ERRATA | QA Contact: | Vladimír Sedmík <vsedmik> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.11.5 | CC: | ahumbe, dalley, dkliban, ggainey, jpasqual, rchan, rlavi, vsedmik |
| Target Milestone: | 6.15.0 | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | pulpcore-3.18.26, pulpcore-3.21.16, pulpcore-3.22.13, pulpcore-3.28.12 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2024-04-23 17:12:14 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Benjamin Kielhold
2023-08-17 15:32:32 UTC
I think this is actually a pulp issue. Katello receives the error from pulp api and simply forwards it to the user: https://github.com/Katello/katello/blob/master/app/services/katello/pulp3/content_view_version/import_validator.rb#L44-L51 Pulp is using os.path.exists() method to verify if the directory exists: https://github.com/pulp/pulpcore/blob/main/pulpcore/app/views/importer.py#L44-L45 However, the method can return false if permission is not granted to access the directory even if the directory exists, which is exactly what happens here. ~~~ os.path.exists(path) Return True if path refers to an existing path or an open file descriptor. Returns False for broken symbolic links. On some platforms, this function may return False if permission is not granted to execute os.stat() on the requested file, even if the path physically exists. ~~~ os.path method documentation -> https://docs.python.org/3/library/os.path.html Maybe let's use another method to do these verifications? I'm proposing a different approach for this verification here: https://github.com/pulp/pulpcore/pull/4296 Linking the PR to this BZ for visibility. Can't be in POST yet, it's not merged/backported. Also, only the issue needs a link, not the PR (PR links can confuse the BZ/github automation) The Pulp upstream bug status is at closed. Updating the external tracker on this bug. Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set. Verified in 6.15.0 snap 4.0 (python3.11-pulpcore-3.39.2-2.el8pc.noarch): The error message received on import in case of insufficient permissions looks correct, in case of missing directory I would expect something like 'No such file or directory', but the received 'Unable to find' does the job too. With correct permissions the import succeeded (checked automation for snap 5.0 where the 0 chunk-size issue was fixed). [root@satellite ~]# ll /var/lib/pulp/imports/sjmntUJd/QaTiSrwnHt/1.0/2024-01-05T03-38-45-05-00/ total 260 -rw-r--r--. 1 root root 256000 Jan 5 03:38 export-018cd8c6-5503-7dea-a167-edfbcb73ae64-20240105_0838.tar -rw-r--r--. 1 root root 241 Jan 5 03:38 export-018cd8c6-5503-7dea-a167-edfbcb73ae64-20240105_0838-toc.json -rw-r--r--. 1 root root 975 Jan 5 03:38 metadata.json [root@satellite ~]# hammer content-import version --organization-id 4 --path /var/lib/pulp/imports/sjmntUJd/QaTiSrwnHt/1.0/2024-01-05T03-38-45-05-00/ Could not import the archive.: [Errno 13] Permission denied: '/var/lib/pulp/imports/sjmntUJd/QaTiSrwnHt/1.0/2024-01-05T03-38-45-05-00' [root@satellite ~]# rm -rf /var/lib/pulp/imports/* [root@satellite ~]# hammer content-import version --organization-id 4 --path /var/lib/pulp/imports/sjmntUJd/QaTiSrwnHt/1.0/2024-01-05T03-38-45-05-00/ Could not import the archive.: Error: Unable to find '/var/lib/pulp/imports/sjmntUJd/QaTiSrwnHt/1.0/2024-01-05T03-38-45-05-00/metadata.json'. If the metadata.json file is at a different location provide it to the --metadata-file option See: 'hammer content-import version --help'. 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.15.0 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-2024:2010 |