Bug 2109810
Summary: | Search for string in n-v-r.a format fails for custom packages but not for Red Hat packages | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Eric Nothen <enothen> |
Component: | Repositories | Assignee: | Pavel Moravec <pmoravec> |
Status: | CLOSED ERRATA | QA Contact: | Cole Higgins <chiggins> |
Severity: | medium | Docs Contact: | |
Priority: | urgent | ||
Version: | 6.10.7 | CC: | afeferku, ahumbe, apatel, fratto, kgaikwad, mhulan, pmoravec, zhunting |
Target Milestone: | 6.12.0 | Keywords: | EasyFix, Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2022-11-16 13:34:44 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
Eric Nothen
2022-07-22 08:06:39 UTC
Is this a regression from Satellite 6.9? I can not reproduce it on my satellite-6.10.7-1.el7sat.noarch : # curl -u admin:$PASS "https://$(hostname -f)/katello/api/v2/packages?per_page=10000&page=1&repository_id=9294&search=google-chrome-stable-103.0.5060.134-1.x86_64" {"total":2,"subtotal":1,"page":"1","per_page":"10000","error":null,"search":"google-chrome-stable-103.0.5060.134-1.x86_64","sort":{"by":null,"order":null},"results":[{"id":305245,"pulp_id":"/pulp/api/v3/content/rpm/packages/4ca2bb56-e889-4b55-b7c4-3f4c59f9f701/","name":"google-chrome-stable","version":"103.0.5060.134","release":"1","arch":"x86_64","epoch":"0","summary":"Google Chrome","modular":false,"filename":"google-chrome-stable-103.0.5060.134-1.x86_64.rpm","sourcerpm":"google-chrome-stable-103.0.5060.134-1.src.rpm","checksum":"0cb17f6ed4f421fe2c61e66d6db28dd442c3a5f4fed07629f23cc070d19165ea","nvrea":"google-chrome-stable-103.0.5060.134-1.x86_64","nvra":"google-chrome-stable-103.0.5060.134-1.x86_64","uuid":"/pulp/api/v3/content/rpm/packages/4ca2bb56-e889-4b55-b7c4-3f4c59f9f701/","hosts_available_count":0,"hosts_applicable_count":0}]} # curl -u admin:$PASS "https://$(hostname -f)/katello/api/v2/packages?per_page=10000&page=1&repository_id=9294&search=google-chrome-stable-103.0.5060.134-1" {"total":2,"subtotal":1,"page":"1","per_page":"10000","error":null,"search":"google-chrome-stable-103.0.5060.134-1","sort":{"by":null,"order":null},"results":[{"id":305245,"pulp_id":"/pulp/api/v3/content/rpm/packages/4ca2bb56-e889-4b55-b7c4-3f4c59f9f701/","name":"google-chrome-stable","version":"103.0.5060.134","release":"1","arch":"x86_64","epoch":"0","summary":"Google Chrome","modular":false,"filename":"google-chrome-stable-103.0.5060.134-1.x86_64.rpm","sourcerpm":"google-chrome-stable-103.0.5060.134-1.src.rpm","checksum":"0cb17f6ed4f421fe2c61e66d6db28dd442c3a5f4fed07629f23cc070d19165ea","nvrea":"google-chrome-stable-103.0.5060.134-1.x86_64","nvra":"google-chrome-stable-103.0.5060.134-1.x86_64","uuid":"/pulp/api/v3/content/rpm/packages/4ca2bb56-e889-4b55-b7c4-3f4c59f9f701/","hosts_available_count":0,"hosts_applicable_count":0}]} The repo 9294 is a custom repo with a few other packages (from Red Hat, but still..) I will diagnose more via the support case. Here is the cause: If RPM filename does not follow NVRA pattern, but source RPM filename follows NVR pattern, then we get this issue. Since this is the key search done: # search="google-chrome-stable-103.0.5060.134-1" # su - postgres -c "psql foreman -c \"SELECT name,version,release,arch,epoch,filename,sourcerpm,checksum FROM katello_rpms WHERE ((katello_rpms.name ILIKE '%${search}%' OR katello_rpms.version = '${search}' OR katello_rpms.release = '${search}' OR katello_rpms.arch ILIKE '%${search}%' OR katello_rpms.epoch ILIKE '%${search}%' OR katello_rpms.filename ILIKE '%${search}%' OR katello_rpms.sourcerpm ILIKE '%${search}%' OR katello_rpms.checksum ILIKE '%${search}%'));\"" name | version | release | arch | epoch | filename | sourcerpm | chec ksum ----------------------+----------------+---------+--------+-------+-----------------------------------------+-----------------------------------------------+--------------------------------- --------------------------------- google-chrome-stable | 103.0.5060.134 | 1 | x86_64 | 0 | google-chrome-stable_current_x86_64.rpm | google-chrome-stable-103.0.5060.134-1.src.rpm | 0cb17f6ed4f421fe2c61e66d6db28dd4 42c3a5f4fed07629f23cc070d19165ea (1 row) # but: # search="google-chrome-stable-103.0.5060.134-1.x86_64" # su - postgres -c "psql foreman -c \"SELECT name,version,release,arch,epoch,filename,sourcerpm,checksum FROM katello_rpms WHERE ((katello_rpms.name ILIKE '%${search}%' OR katello_rpms.version = '${search}' OR katello_rpms.release = '${search}' OR katello_rpms.arch ILIKE '%${search}%' OR katello_rpms.epoch ILIKE '%${search}%' OR katello_rpms.filename ILIKE '%${search}%' OR katello_rpms.sourcerpm ILIKE '%${search}%' OR katello_rpms.checksum ILIKE '%${search}%'));\"" name | version | release | arch | epoch | filename | sourcerpm | checksum ------+---------+---------+------+-------+----------+-----------+---------- (0 rows) # Katello matches the search (sub)string against: - name - version - release - arch - epoch - filename - sourcerpm We shall extend the search to "nvra" attribute, then the search would succeed: # search="google-chrome-stable-103.0.5060.134-1.x86_64" # su - postgres -c "psql foreman -c \"SELECT name,version,release,arch,epoch,filename,sourcerpm,checksum FROM katello_rpms WHERE ((katello_rpms.name ILIKE '%${search}%' OR katello_rpms.version = '${search}' OR katello_rpms.release = '${search}' OR katello_rpms.arch ILIKE '%${search}%' OR katello_rpms.epoch ILIKE '%${search}%' OR katello_rpms.filename ILIKE '%${search}%' OR katello_rpms.sourcerpm ILIKE '%${search}%' OR katello_rpms.checksum ILIKE '%${search}%' OR katello_rpms.nvra ILIKE '%${search}%'));\"" name | version | release | arch | epoch | filename | sourcerpm | chec ksum ----------------------+----------------+---------+--------+-------+-----------------------------------------+-----------------------------------------------+--------------------------------- --------------------------------- google-chrome-stable | 103.0.5060.134 | 1 | x86_64 | 0 | google-chrome-stable_current_x86_64.rpm | google-chrome-stable-103.0.5060.134-1.src.rpm | 0cb17f6ed4f421fe2c61e66d6db28dd4 42c3a5f4fed07629f23cc070d19165ea (1 row) # This should be a trivial fix, I would say. .. and here is the patch (for Satellite, aply in /opt/theforeman/tfm/root/usr/share/gems/gems/katello-* directory): --- a/app/models/katello/rpm.rb +++ b/app/models/katello/rpm.rb @@ -16,6 +16,7 @@ module Katello scoped_search :on => :evr, :ext_method => :scoped_search_evr, :only_explicit => true scoped_search :on => :filename, :complete_value => true scoped_search :on => :sourcerpm, :complete_value => true + scoped_search :on => :nvra, :complete_value => true scoped_search :on => :modular, :complete_value => true, :only_explicit => true scoped_search :on => :checksum Upstream bug assigned to pmoravec Upstream bug assigned to pmoravec (In reply to Brad Buckingham from comment #1) > Is this a regression from Satellite 6.9? I don't have a running Satellite 6.9, but looking at tfm-rubygem-katello-3.18.1.53-1.el7sat.noarch.rpm, it doesn't look like, as it's the same as Pavel fixed on latest: ~~~ $ egrep -n "scoped_search :on" opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.53/app/models/katello/rpm.rb 11: scoped_search :on => :name, :complete_value => true 12: scoped_search :on => :version, :complete_value => true, :ext_method => :scoped_search_version 13: scoped_search :on => :release, :complete_value => true, :ext_method => :scoped_search_release 14: scoped_search :on => :arch, :complete_value => true 15: scoped_search :on => :epoch, :complete_value => true 16: scoped_search :on => :evr, :ext_method => :scoped_search_evr, :only_explicit => true 17: scoped_search :on => :filename, :complete_value => true 18: scoped_search :on => :sourcerpm, :complete_value => true 19: scoped_search :on => :modular, :complete_value => true, :only_explicit => true 20: scoped_search :on => :checksum ~~~ Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35290 has been resolved. 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.12 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-2022:8506 |