Project

General

Profile

Bug #20579

hammer order option has no effect

Added by Brad Buckingham almost 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

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

Description of problem:
hammer erratum list order option has no effect

Version-Release number of selected component (if applicable):
  • candlepin-2.0.40-1.el7.noarch
  • candlepin-selinux-2.0.40-1.el7.noarch
  • foreman-1.15.2-1.el7sat.noarch
  • foreman-cli-1.15.2-1.el7sat.noarch
  • foreman-compute-1.15.2-1.el7sat.noarch
  • foreman-debug-1.15.2-1.el7sat.noarch
  • foreman-discovery-image-3.1.1-22.el7sat.noarch
  • foreman-ec2-1.15.2-1.el7sat.noarch
  • foreman-gce-1.15.2-1.el7sat.noarch
  • foreman-installer-1.15.2-1.el7sat.noarch
  • foreman-installer-katello-3.4.4-1.el7sat.noarch
  • foreman-libvirt-1.15.2-1.el7sat.noarch
  • foreman-openstack-1.15.2-1.el7sat.noarch
  • foreman-ovirt-1.15.2-1.el7sat.noarch
  • foreman-postgresql-1.15.2-1.el7sat.noarch
  • foreman-proxy-1.15.2-1.el7sat.noarch
  • foreman-rackspace-1.15.2-1.el7sat.noarch
  • foreman-selinux-1.15.2-1.el7sat.noarch
  • foreman-vmware-1.15.2-1.el7sat.noarch
  • katello-3.4.4-2.el7sat.noarch
  • katello-ca-consumer-sat-r220-02.lab.eng.rdu2.redhat.com-1.0-4.noarch
  • katello-certs-tools-2.4.0-1.el7sat.noarch
  • katello-client-bootstrap-1.4.0-1.el7sat.noarch
  • katello-common-3.4.4-2.el7sat.noarch
  • katello-debug-3.4.4-2.el7sat.noarch
  • katello-default-ca-1.0-1.noarch
  • katello-installer-base-3.4.4-1.el7sat.noarch
  • katello-selinux-3.0.2-1.el7sat.noarch
  • katello-server-ca-1.0-1.noarch
  • katello-service-3.4.4-2.el7sat.noarch
  • openldap-2.4.44-5.el7.x86_64
  • pulp-client-1.0-1.noarch
  • pulp-docker-plugins-2.3.0-1.el7sat.noarch
  • pulp-katello-1.0.2-1.el7sat.noarch
  • pulp-ostree-plugins-1.2.1-1.el7sat.noarch
  • pulp-puppet-plugins-2.12.2-1.el7sat.noarch
  • pulp-puppet-tools-2.12.2-1.el7sat.noarch
  • pulp-rpm-plugins-2.12.2-2.el7sat.noarch
  • pulp-selinux-2.12.2-2.el7sat.noarch
  • pulp-server-2.12.2-2.el7sat.noarch
  • python-ldap-2.4.15-2.el7.x86_64
  • tfm-rubygem-ldap_fluff-0.4.6-1.el7sat.noarch
  • tfm-rubygem-net-ldap-0.15.0-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create an organization
2. Create product and a yum repository with errata
3. Type erratum list --order="issued ASC" --organization-id="38" --per-page="10"

Actual results:
the output is not sorted issue date

Expected results:
the output sorted by issue date

Additional info:
in automation we use repo https://jlsherrill.fedorapeople.org/fake-repos/needed-errata/

hammer -v -output=csv erratum list --order="issued ASC" --organization-id="38" --per-page="10"

<<<
bbc1dec7-8a38-4b3e-9eaf-b8dd31c4dfca,RHEA-2012:0057,security,Bear_ErratumPARTHA
a8955a57-0b90-4bca-8636-ff130be3fb6a,RHEA-2012:0056,security,Bird_Erratum
575d38d0-1876-420b-9bd7-b22eb1631b0e,RHEA-2012:0058,enhancement,Gorilla_Erratum
58101520-5807-4428-95f5-9f54296d3c90,RHEA-2012:0055,security,Sea_Erratum

getting the info of the first one

hammer --output=json erratum info --id="bbc1dec7-8a38-4b3e-9eaf-b8dd31c4dfca"

<<<{
"ID": "bbc1dec7-8a38-4b3e-9eaf-b8dd31c4dfca",
"Errata ID": "RHEA-2012:0057",
"Title": "Bear_ErratumPARTHA",
"Type": "security",
"Severity": "",
"Issued": "2013-01-27",
"Updated": "2013-01-27",
"Description": "Bear_Erratum",
"Summary": "",
"Solution": ""
}

getting the info of the last one

hammer --output=json erratum info --id="58101520-5807-4428-95f5-9f54296d3c90"

<<<{
"ID": "58101520-5807-4428-95f5-9f54296d3c90",
"Errata ID": "RHEA-2012:0055",
"Title": "Sea_Erratum",
"Type": "security",
"Severity": "",
"Issued": "2012-01-27",
"Updated": "2012-01-27",
"Description": "Sea_Erratum",
"Summary": "",
"Solution": ""
}

Associated revisions

Revision 3605d81f (diff)
Added by Partha Aji almost 5 years ago

Fixes #20579 - Made hammer ordering work for list

When we fullly moved to scoped search and
removed traces of elastic search as part of Issue 5334
PR# 5578
We removed logic that processed the "order" parameter

This caused hammer .. --order=".." to break in future versions.

This commit remedies that issue.

History

#1 Updated by Brad Buckingham almost 5 years ago

  • Subject changed from hammer erratum list order option has no effect to hammer erratum list order option has no effect
  • Target version set to 208

#2 Updated by Samir Jha almost 5 years ago

  • Subject changed from hammer erratum list order option has no effect to hammer order option has no effect
  • Category changed from Errata Management to API

Initial Findings:

The order option of hammer is broken right now. That is because of improper parameter construction in the API call being made.

Current call params from Hammer are: {
"organization_id" => 1,
"page" => 1,
"per_page" => 10,
"order" => "issued ASC",
"sort" => {
"order" => "issued ASC"
}
}

The UI on the other hand has the order and sort params in the below format: {
organization_id:1
page:1
paged:true
per_page:20
search:
sort_by:issued
sort_order:ASC
}

Note the difference in parameter construction of the sort attributes. A possible quick fix is to modify the scoped_search method in the api_controller to respect both formats.

We could also make the UI and Hammer API calls consistent, not very sure of the history behind this inconsistency in the formats.

#3 Updated by Eric Helms almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 250

#4 Updated by Partha Aji almost 5 years ago

  • Assignee set to Partha Aji

#5 Updated by Brad Buckingham almost 5 years ago

  • Target version changed from 208 to 213

#6 Updated by The Foreman Bot almost 5 years ago

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

#7 Updated by Partha Aji almost 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF