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 2164997 - hammer repository reclaim-space raises "undefined local variable or method `repositories'" exception
Summary: hammer repository reclaim-space raises "undefined local variable or method `r...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.12.0
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: 6.15.0
Assignee: wclark
QA Contact: Sam Bible
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-27 09:55 UTC by Pavel Moravec
Modified: 2024-04-23 17:13 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-04-23 17:13:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36142 0 High New hammer repository reclaim-space raises "undefined local variable or method `repositories'" exception 2023-02-23 21:31:13 UTC
Red Hat Issue Tracker SAT-15298 0 None None None 2023-01-30 14:22:28 UTC
Red Hat Knowledge Base (Solution) 6995654 0 None None None 2023-01-27 10:38:30 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:13:17 UTC

Description Pavel Moravec 2023-01-27 09:55:36 UTC
Description of problem:
hammer repository reclaim-space (for any On Demand repo) fails:

hammer> repository reclaim-space --id 1 --organization-id 1
Could not reclaim the repository:
  undefined local variable or method `repositories' for #<Actions::Pulp3::Repository::ReclaimSpace:0x0000564031cede08>
  Did you mean?  repository_hrefs
hammer> 

https://github.com/Katello/katello/blob/master/app/lib/actions/pulp3/repository/reclaim_space.rb#L7 has a left-over from https://github.com/Katello/katello/commit/5b8426e20f4b5812375ed416180f2181ec94312a

The line should be like:

repository_hrefs = ::Katello::Pulp3::RepositoryReference.default_cv_repository_hrefs([repo], Organization.current || repo.organization)

(this does work)

but I think the 2nd argument should rather be directly "repo.organization", or maybe "repo.organization || Organization.current" to have a fallback - as we should be scoped in the _repository_ organization, no..?


Version-Release number of selected component (if applicable):
Sat 6.11
Sat 6.12
upcoming 6.13 almost surely as well


How reproducible:
100%


Steps to Reproduce:
1. Enable and sync a repo with On Demand download policy
2. try to reclaim space via hammer:

hammer repository reclaim-space --id REPOID --organization-id ORGID


Actual results:
Could not reclaim the repository:
  undefined local variable or method `repositories' for #<Actions::Pulp3::Repository::ReclaimSpace:0x0000564031cede08>
  Did you mean?  repository_hrefs


Expected results:
It works well


Additional info:
The same action via WebUI does work well. "just" hammer fails. (but the bug is in katello)

Comment 2 wclark 2023-02-23 21:31:12 UTC
Created redmine issue https://projects.theforeman.org/issues/36142 from this bug

Comment 3 Bryan Kearney 2023-02-28 20:03:21 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36142 has been resolved.

Comment 4 Bryan Kearney 2023-02-28 20:03:33 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36142 has been resolved.

Comment 7 Sam Bible 2024-01-18 22:51:29 UTC
Verified on 6.15 - Snap 5

Steps to Verify:
1. Enable and Sync a repo with On Demand repository
2. Run this hammer command:
  - hammer repository reclaim-space --id REPOID --organization-id ORGID

Expected Results:
Command works as expected.

Actual Results:
Command works as expected.

Comment 10 errata-xmlrpc 2024-04-23 17:13:15 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.