Project

Profile

Help

Issue #751

rpm repo list --details fails if a repo has 0 importers

Added by amacdona@redhat.com over 6 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

Description
If the importer is removed from a repo, listing the repos with the --details flag results in a traceback.

To reproduce
1. Create a new repo

$ pulp-admin rpm repo create --repo-id test
Successfully created repository [test]

[austin@localhost playpen]$ pulp-admin rpm repo list  --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                  test
Display Name:        test
Description:         None
Content Unit Counts: 
Notes:               
Importers:           
  Config:           
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        None
  Repo Id:          test
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: test
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             test
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             test
  Scheduled Publishes: 

2. List the importers

$ curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/test/importers/ | python -mjson.tool

[
    {
        "_id": {
            "$oid": "55009152e138233f6b25e4be"
        },
        "_ns": "repo_importers",
        "config": {},
        "id": "yum_importer",
        "importer_type_id": "yum_importer",
        "last_sync": null,
        "repo_id": "test",
        "scheduled_syncs": [],
        "scratchpad": null
    }
]

3. Delete the importer

$ curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X DELETE -k -u admin:admin https://localhost/pulp/api/v2/repositories/test/importers/yum_importer/ | python -mjson.tool

{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/7e1838df-6cc7-47f8-b35b-a34e6440caf5/",
            "task_id": "7e1838df-6cc7-47f8-b35b-a34e6440caf5"
        }
    ]
}

4. List the repos with details

$ pulp-admin -v rpm repo list  --details

+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

2015-03-11 15:10:04,441 - ERROR - Client-side exception occurred
Traceback (most recent call last):
  File "/home/austin/devel/pulp/client_lib/pulp/client/extensions/core.py", line 474, in run
    exit_code = Cli.run(self, args)
  File "/usr/lib/python2.7/site-packages/okaara/cli.py", line 974, in run
    exit_code = command_or_section.execute(self.prompt, remaining_args)
  File "/home/austin/devel/pulp/client_lib/pulp/client/extensions/extensions.py", line 211, in execute
    return self.method(*arg_list, **clean_kwargs)
  File "/home/austin/devel/pulp/client_lib/pulp/client/commands/repo/cudl.py", line 339, in run
    self.display_repositories(**kwargs)
  File "/home/austin/devel/pulp/client_lib/pulp/client/commands/repo/cudl.py", line 370, in display_repositories
    repo_list = self.get_repositories(query_params, **kwargs)
  File "/home/austin/devel/pulp_rpm/extensions_admin/pulp_rpm/extensions/admin/repo_list.py", line 38, in get_repositories
    imp_config = r['importers'][0]['config']  # there can only be one importer
IndexError: list index out of range
An unexpected error has occurred. More information may be found using the -v
flag.

Associated revisions

Revision c4bc5056 View on GitHub
Added by sbhawsin over 6 years ago

Fixed --details failure if no importers present

https://pulp.plan.io/issues/751

fixes #751

History

#1 Updated by dkliban@redhat.com over 6 years ago

  • Subject changed from rpm repo list --details fails if a repo has 0 distributors to rpm repo list --details fails if a repo has 0 importers
  • Priority changed from Normal to Low
  • Severity set to Medium
  • Triaged changed from No to Yes

#2 Updated by bmbouter over 6 years ago

  • Severity changed from Medium to 2. Medium

#3 Updated by sbhawsin over 6 years ago

  • Assignee set to sbhawsin
  • Version set to Master

#4 Updated by sbhawsin over 6 years ago

  • Status changed from NEW to POST

#5 Updated by sbhawsin over 6 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#6 Updated by sbhawsin over 6 years ago

  • Platform Release set to 2.7.0

#7 Updated by dkliban@redhat.com over 6 years ago

  • Status changed from MODIFIED to 5

#8 Updated by igulina@redhat.com over 6 years ago

  • Status changed from 5 to 6
>> rpm -qa pulp-server
pulp-server-2.7.0-0.3.beta.el7.noarch

>> pulp-admin rpm repo list  --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                  zoo_repo
Display Name:        zoo_repo
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              29
Notes:               
Importers:           
  Config:           
    Feed: https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        2015-06-26T17:12:29Z
  Repo Id:          zoo_repo
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Checksum Type: sha256
    Http:          False
    Https:         True
    Relative URL:  /repos/pulp/pulp/demo_repos/zoo/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        2015-06-26T17:12:40Z
  Repo Id:             zoo_repo
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             zoo_repo
  Scheduled Publishes: 

Id:                  funtik
Display Name:        funtik
Description:         None
Content Unit Counts: 
Notes:               
Importers:           
  Config:           
    Feed: ftp://ftp.es.kde.org/mirror/slc/updates/slc53/i386/RPMS/
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        None
  Repo Id:          funtik
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: /mirror/slc/updates/slc53/i386/RPMS/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 

>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X GET -k -u admin:admin https://localhost/pulp/api/v2/repositories/funtik/importers/ | python -mjson.tool
[
    {
        "_href": "/pulp/api/v2/repositories/funtik/importers/yum_importer/",
        "_id": {
            "$oid": "559261e0e512ed184258f302"
        },
        "_ns": "repo_importers",
        "config": {
            "feed": "ftp://ftp.es.kde.org/mirror/slc/updates/slc53/i386/RPMS/"
        },
        "id": "yum_importer",
        "importer_type_id": "yum_importer",
        "last_sync": null,
        "repo_id": "funtik",
        "scheduled_syncs": [],
        "scratchpad": null
    }
]

>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X DELETE -k -u admin:admin https://localhost/pulp/api/v2/repositories/funtik/importers/yum_importer/ | python -mjson.tool
{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/b9056382-3b20-461f-b39e-950f93b84757/",
            "task_id": "b9056382-3b20-461f-b39e-950f93b84757"
        }
    ]
}

>> pulp-admin -v rpm repo list  --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                  zoo_repo
Display Name:        zoo_repo
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              29
Notes:               
Importers:           
  Config:           
    Feed: https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        2015-06-26T17:12:29Z
  Repo Id:          zoo_repo
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Checksum Type: sha256
    Http:          False
    Https:         True
    Relative URL:  /repos/pulp/pulp/demo_repos/zoo/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        2015-06-26T17:12:40Z
  Repo Id:             zoo_repo
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             zoo_repo
  Scheduled Publishes: 

Id:                  funtik
Display Name:        funtik
Description:         None
Content Unit Counts: 
Notes:               
Importers:           
Distributors:        
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: /mirror/slc/updates/slc53/i386/RPMS/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 

--details on a single repo with deleted importers:

pulp-admin -v rpm repo list --repo-id funtik  --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                   funtik
Display Name:         funtik
Description:          None
Content Unit Counts:  
Notes:                
Importers:            
Distributors:         
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: /mirror/slc/updates/slc53/i386/RPMS/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             funtik
  Scheduled Publishes: 

A repo without feed:

pulp-admin -v rpm repo create --repo-id repka
Successfully created repository [repka]

>> pulp-admin -v rpm repo list --repo-id repka --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                   repka
Display Name:         repka
Description:          None
Content Unit Counts:  
Notes:                
Importers:            
  Config:           
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        None
  Repo Id:          repka
  Scheduled Syncs:  
Distributors:         
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: repka
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             repka
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             repka
  Scheduled Publishes: 

>> curl -s -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X DELETE -k -u admin:admin https://localhost/pulp/api/v2/repositories/repka/importers/yum_importer/ | python -mjson.tool
{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/b8c51cd9-1b3e-4a67-b65a-e94f19a671d9/",
            "task_id": "b8c51cd9-1b3e-4a67-b65a-e94f19a671d9"
        }
    ]
}
>> pulp-admin -v rpm repo list --repo-id repka --details
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                   repka
Display Name:         repka
Description:          None
Content Unit Counts:  
Notes:                
Importers:            
Distributors:         
  Auto Publish:        True
  Config:              
    Http:         False
    Https:        True
    Relative URL: repka
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        None
  Repo Id:             repka
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Http:  False
    Https: True
  Distributor Type Id: export_distributor
  Id:                  export_distributor
  Last Publish:        None
  Repo Id:             repka
  Scheduled Publishes: 

#9 Updated by amacdona@redhat.com almost 6 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#11 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF