Bug 1097275

Summary: Uploading rpm fails with error: Invalid unit type for repository
Product: [Retired] Pulp Reporter: Jason <ashbyj>
Component: user-experienceAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: pulp-qe-list
Severity: low Docs Contact:
Priority: medium    
Version: 2.3CC: mhrivnak, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:06:16 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 Jason 2014-05-13 13:15:23 UTC
Description of problem:

When uploading an rpm file to a pulp repo, it fails with:  Invalid unit type for repository

I have two pulp servers: a parent and a child node.  This only happens when uploading to repository "foo" on the child node.   I *think* this is because Repository "foo" on the child has "yum_importer" as the Importer type, whereas the parent has "nodes_http_importer". 

It is not clear in the documentation what these various importer plugins are or how to update an existing repo to change which importer is used.

The better solution for me is to upload to the parent and sync the repo to the child node, but that takes forever since I have so many repositories, and in 2.3 it seems I cannot specify a single repository (i.e. --repo-id) in the sync.  Looks like that feature has been added in 2.4.


Version-Release number of selected component (if applicable):
pulp 2.3.1
CentOS 6.5

How reproducible:
every time

Steps to Reproduce:
1.  

me@child:~> pulp-admin rpm repo uploads rpm --repo-id=foo --file=serf-custom-1.3.5-1.x86_64.rpm

+----------------------------------------------------------------------+
                              Unit Upload
+----------------------------------------------------------------------+

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: serf-custom-1.3.5-1.x86_64.rpm
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: serf-custom-1.3.5-1.x86_64.rpm
... 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: serf-custom-1.3.5-1.x86_64.rpm
[==================================================] 100%
825314/825314 bytes
... completed

Importing into the repository...
The server indicated one or more values were incorrect. The server provided the
following error message:

   Invalid unit type for repository

More information can be found in the client log file ~/.pulp/admin.log.

#
# ~/.pulp/admin.log
#
2014-05-13 08:53:08,734 - ERROR - Exception occurred:
        href:      /pulp/api/v2/repositories/foo/actions/import_upload/
        method:    POST
        status:    400
        error:     Invalid unit type for repository
        traceback: None
        data:      {u'args': [u'Invalid unit type for repository']}


Actual results:
Invalid unit type for repository

Expected results:
Successful upload of rpm to repository.

Additional info:
Here are the repo details for the parent and child pulp servers per "pulp-admin repo list --details":


# Parent pulp server
#
Id:                  foo
Display Name:         Custom packages for EL6 - Development
Description:          Custom Packages for EL6 - x86_64
Content Unit Counts:
  Rpm: 96
Notes:
Importers:
  Config:
    Manifest URL: https://pulp.example.com/pulp/nodes/https/repos/foo/
                  manifest.json
    Strategy:     additive
  Id:               nodes_http_importer
  Importer Type Id: nodes_http_importer
  Last Sync:        2014-05-12T23:23:08-04:00
  Repo Id:          foo
  Scheduled Syncs:
Distributors:
  Auto Publish:        True
  Config:
    Http:         False
    Https:        True
    Relative URL: foo
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        2014-05-13T08:12:14-04:00
  Repo Id:             foo
  Scheduled Publishes:
  Auto Publish:        False
  Config:
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             foo
  Scheduled Publishes:

# Child pulp node
#
Id:                  foo
Display Name:         Custom packages for EL6 - Development
Description:          Custom Packages for EL6 - x86_64
Content Unit Counts:
  Rpm: 97
Notes:
Importers:
  Config:
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        None
  Repo Id:          foo
  Scheduled Syncs:
Distributors:
  Auto Publish:        True
  Config:
    Http:         False
    Https:        True
    Relative URL: foo
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        2014-05-13T08:11:09-04:00
  Repo Id:             foo
  Scheduled Publishes:
  Auto Publish:        True
  Config:
  Distributor Type Id: nodes_http_distributor
  Id:                  nodes_http_distributor
  Last Publish:        2014-05-09T11:37:17-04:00
  Repo Id:             foo
  Scheduled Publishes:
  Auto Publish:        False
  Config:
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             foo
  Scheduled Publishes:

Comment 1 Michael Hrivnak 2014-05-14 16:37:15 UTC
When you sync a repo to a child node, you cannot upload content to that repo on the child.

That said, pulp should have a better error message. We are leaving this bug report open pending an improved user experience.

Comment 2 Jason 2014-05-14 17:08:45 UTC
(In reply to Michael Hrivnak from comment #1)
> When you sync a repo to a child node, you cannot upload content to that repo
> on the child.


Good to know.  I would expect that to be the case.  This sentence made me think I could do such a thing:

    It is important to understand that a child node is a complete and fully functional Pulp server capable of operating autonomously.  (per https://pulp-user-guide.readthedocs.org/en/pulp-2.3/nodes.html)


An improved error message in this case would be perfect though, thanks.

Comment 3 Brian Bouterse 2015-02-28 22:06:16 UTC
Moved to https://pulp.plan.io/issues/429