Bug 1004850 - Pulp does not return an error when uploading an ISO named PULP_MANIFEST
Summary: Pulp does not return an error when uploading an ISO named PULP_MANIFEST
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: Master
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-05 15:32 UTC by Randy Barlow
Modified: 2015-02-28 21:58 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-28 21:58:21 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 369 0 None None None Never

Description Randy Barlow 2013-09-05 15:32:12 UTC
The ISOImporter performs some validation checks on uploaded ISOs, and if those validation checks fail, it raises a ValueError. Unfortunately, Pulp doesn't offer any way for Importers to indicate that they don't wish to accept an upload due to such problems, and the ValueError is not handled gracefully leading to a poor user experience.

For example, if a user tries to upload an ISO called PULP_MANIFEST (which is disallowed as of bug #973678), the upload will be unsuccessful, but the user will not see the error message that indicates why at the client.

$ pulp-admin iso repo uploads upload --repo-id test -f PULP_MANIFEST 
+----------------------------------------------------------------------+
                              Unit Upload
+----------------------------------------------------------------------+

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: PULP_MANIFEST
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: PULP_MANIFEST
... completed

Starting upload of selected units. If this process is stopped through ctrl+c,
the uploads will be paused and may be resumed later using the resume command or
cancelled entirely using the cancel command.

Uploading: PULP_MANIFEST
... completed

Importing into the repository...
The web server reported an error trying to access the Pulp application. The
likely cause is that the pulp-manage-db script has not been run prior to
starting the server. More information can be found in Apache's error log file on
the server itself.

It is also unhelpful that our default error message for unhandled exceptions tells the user that they probably need to run pulp-manage-db. From our pulp.log:

2013-09-05 11:31:23,073 pulp.server.managers.content.upload:ERROR: Error from the importer while importing uploaded unit to repository [test]
Traceback (most recent call last):
  File "/home/rbarlow/devel/pulp/server/pulp/server/managers/content/upload.py", line 227, in import_uploaded_unit
    importer_instance.upload_unit(transfer_repo, unit_type_id, unit_key, unit_metadata, file_path, conduit, call_config)
  File "/home/rbarlow/devel/pulp_rpm/pulp_rpm/src/pulp_rpm/plugins/importers/iso_importer/importer.py", line 129, in upload_unit
    iso.validate(full_validation=validate)
  File "/home/rbarlow/devel/pulp_rpm/pulp_rpm/src/pulp_rpm/common/models.py", line 409, in validate
    raise ValueError(msg)
ValueError: An ISO may not be named PULP_MANIFEST, as it conflicts with the name of the manifest during publishing.

It would be nice to provide that error message to the end user.

Comment 1 Chris Duryee 2014-11-07 22:51:26 UTC
I attempted this on 2.5.0. pulp-admin let me upload a file named PULP_MANIFEST and a directory was created under /var/lib/pulp/content for it. However, the directory was empty, and a new unit was not created.

Comment 2 Brian Bouterse 2015-02-28 21:58:21 UTC
Moved to https://pulp.plan.io/issues/369


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