Project

General

Profile

Actions

Bug #36142

closed

hammer repository reclaim-space raises "undefined local variable or method `repositories'" exception

Added by William Clark about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2164997

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)

Actions #1

Updated by The Foreman Bot about 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/10466 added
Actions #2

Updated by The Foreman Bot about 1 year ago

  • Fixed in Releases Katello 4.8.0 added
Actions #3

Updated by William Clark about 1 year ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by Partha Aji about 1 year ago

  • Target version set to Katello 4.8.0
  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF