Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-check may return error saying "director does not exist" when it actually just lack permissions #4294

Closed
jpasqualetto opened this issue Aug 17, 2023 · 1 comment

Comments

@jpasqualetto
Copy link
Contributor

Endpoint /pulp/api/v3/importers/core/pulp/import-check/ returns error saying "Directory does not exist" when pulp user lack permissions to read said directory.

To Reproduce

Try importing content from a directory where pulp user doesn't have read access.

Expected behavior
Error returned should indicate the permission error.

Additional context

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

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

@pulpbot
Copy link
Member

pulpbot commented Aug 17, 2023

@dralley dralley added the BZ label Aug 17, 2023
patchback bot pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
patchback bot pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
patchback bot pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
patchback bot pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
patchback bot pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
dralley pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
dralley pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
dralley pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
dralley pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
dralley pushed a commit that referenced this issue Aug 21, 2023
Use os.stat to ensure directory exists and pulp has read-access
return any errors received from os.stat to the user

(cherry picked from commit b552eed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants