Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37072 - Made package update choose the correct version #11213

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

parthaa
Copy link
Contributor

@parthaa parthaa commented Nov 8, 2024

What are the changes introduced in this pull request?

Package Update now correctly picks the package to update when you chose from a drop down on the host packages tab.

Considerations taken when implementing this change?

When we choose a specific version of package a to update on the host - we try to infer the name and arch of the package to be upgraded. This information is then used to determine how the update command should look. The changes here use the pre-existing Katello::Util::Package.parse_nvrea to figure out the package provided in the template instead of the magical potentially fault regex

What are the testing steps for this pull request?

  1. Create a RHEL 9.2 machine with crypto-policies-20221215-1.git9a18988.el9.noarch
  2. Sync RHEL 9 appstream + baseos
  3. Try to upgrade to crypto-policies-scripts-20221215-1.git9a18988.el9_2.1.noarch via the dropdown on the right side of the upgradable RPM

Check the template preview of the job created

Before PR

#!/bin/bash
.......

# Action
  yum -y  update crypto-policies-scripts
RETVAL=$?
[ $RETVAL -eq 0 ] || exit_with_message "Package action failed" $RETVAL

After PR

#!/bin/bash
....
# Action
  yum -y  update crypto-policies-scripts-20221215-1.git9a18988.el9_2.1.noarch
RETVAL=$?
[ $RETVAL -eq 0 ] || exit_with_message "Package action failed" $RETVAL

Feel free to try other rpms to upgrade.

@@ -534,10 +534,16 @@ def yum_names_for_job_template(action:, search:, versions: nil)
versions_by_name_arch = {}
if versions.present?
JSON.parse(versions).each do |nvra|
nvra =~ /([^.]*)-[-.\w]*\.(\w+)/
versions_by_name_arch[[Regexp.last_match(1), Regexp.last_match(2)]] = nvra
package_info = ::Katello::Util::Package.parse_nvrea(nvra)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More reliable 👍🏻

@lfu
Copy link
Member

lfu commented Nov 12, 2024

Before
job1

After
job2

Copy link
Member

@lfu lfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@parthaa parthaa merged commit d07494f into Katello:master Nov 12, 2024
26 of 27 checks passed
@parthaa parthaa deleted the my-changes branch November 12, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants