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.
Bug 2232625 - Incorrect error message presented in relation to content-import * on disconnected satellite server
Summary: Incorrect error message presented in relation to content-import * on disconne...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.11.5
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: 6.15.0
Assignee: satellite6-bugs
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-17 15:32 UTC by Benjamin Kielhold
Modified: 2024-04-23 17:12 UTC (History)
8 users (show)

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:
Clone Of:
Environment:
Last Closed: 2024-04-23 17:12:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pulp pulpcore issues 4294 0 None closed Import-check may return error saying "director does not exist" when it actually just lack permissions 2023-08-21 21:05:13 UTC
Red Hat Issue Tracker SAT-19655 0 None None None 2023-08-21 12:38:00 UTC
Red Hat Knowledge Base (Solution) 7029206 0 None None None 2023-08-17 18:56:58 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:12:15 UTC

Description Benjamin Kielhold 2023-08-17 15:32:32 UTC
Description of problem:
-----
Attempting to import a content view version on a disconnected satellite server with the incorrect user/group permissions results in an error output that describes the "directory <dir> does not exist". The actual issue is due to lack of permissions.


Version-Release number of selected component (if applicable):
-----
Satellite Versions Tested
 - 6.13.0 
 - 6.12
 - 6.11.5.4


How reproducible:
-----
100%

Steps to Reproduce:
1. Create a Content View as per the documentation for the specified version of Satellite. Verifying that the `Import_Only` value is set to True.
2. Verify that repositories to be added are set to `Immediate` download policy.
3. Sync repositories to be added to the Content View.
4. Add the repositories to the Content View and Publish version.
5. Export the CV version

6. When importing the CV, do not change the user/group permissions to pulp:pulp (In testing, I used root:root)
7. Attempt to import the CV version


Actual results:
-----
[root@sat613 ~]# hammer content-import version --path /var/lib/pulp/imports/Org/CVDiscTesting/1.0/2023-08-17T10-59-50-04-00/ --organization-id 1
Could not import the archive.:
  directory /var/lib/pulp/imports/Org/CVDiscTesting/1.0/2023-08-17T10-59-50-04-00 does not exist

Verifying content present:
[root@sat613 ~]# ls -l /var/lib/pulp/imports/Org/CVDiscTesting/1.0/2023-08-17T10-59-50-04-00/
total 483444
-rw-r--r--. 1 root root 495035182 Aug 17 11:04 export-739832e8-8163-481e-85d4-244beab02bc5-20230817_1459.tar.gz
-rw-r--r--. 1 root root       333 Aug 17 11:04 export-739832e8-8163-481e-85d4-244beab02bc5-20230817_1459-toc.json
-rw-r--r--. 1 root root      1129 Aug 17 11:04 metadata.json


Expected results:
-----
[root@sat613 ~]# hammer content-import version --path /var/lib/pulp/imports/Org/CVDiscTesting/1.0/2023-08-17T10-59-50-04-00/ --organization-id 1

  The above command should notify via an output that the user/group permissions are not set correctly (as in pulp:pulp) and that the user should verify.


Regards,
Benjamin

Comment 1 Joniel Pasqualetto 2023-08-17 16:07:42 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?

Comment 2 Joniel Pasqualetto 2023-08-17 18:11:43 UTC
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.

Comment 5 Grant Gainey 2023-08-21 13:36:51 UTC
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)

Comment 6 Robin Chan 2023-08-21 21:05:14 UTC
The Pulp upstream bug status is at closed. Updating the external tracker on this bug.

Comment 9 Brad Buckingham 2023-10-30 11:29:29 UTC
Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set.

Comment 11 Vladimír Sedmík 2024-01-05 09:11:40 UTC
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'.

Comment 14 errata-xmlrpc 2024-04-23 17:12:14 UTC
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


Note You need to log in before you can comment on or make changes to this bug.