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

Fix package task for yum when passing version #237

Merged
merged 1 commit into from Feb 19, 2021

Conversation

cliveweir
Copy link
Contributor

@cliveweir cliveweir commented Feb 19, 2021

This fixes issue #236

Summary

If the (optional) version parameter is passed the package $name variable is overwritten with "name-version". This format is required by yum when installing/uninstalling/upgrading a specific package version but it is not compatible when calling rpm -q --whatprovides $name - which requires the name only.

Solution

Don't overwrite $name with name-version, use a new variable instead.

Testing

❯ bolt task run package -t 'fiendish-sister.delivery.puppetlabs.net' --params '{"action":"install", "name":"vim-enhanced", "version":"2:8.0.1763-15.el8"}'

Started on fiendish-sister.delivery.puppetlabs.net...
Finished on fiendish-sister.delivery.puppetlabs.net:
  {
    "status": "installed",
    "version": "8.0.1763-15.el8"
  }
Successful on 1 target: fiendish-sister.delivery.puppetlabs.net
Ran on 1 target in 18.03 sec
❯ bolt task run package -t 'fiendish-sister.delivery.puppetlabs.net' --params '{"action":"upgrade", "name":"openldap", "version":"2.4.46-15.el8"}'

Started on fiendish-sister.delivery.puppetlabs.net...
Finished on fiendish-sister.delivery.puppetlabs.net:
  {
    "old_version": "2.4.46-9.el8",
    "version": "2.4.46-15.el8"
  }
Successful on 1 target: fiendish-sister.delivery.puppetlabs.net
Ran on 1 target in 13.87 sec
❯ bolt task run package -t 'fiendish-sister.delivery.puppetlabs.net' --params '{"action":"uninstall", "name":"vim-enhanced", "version":"2:8.0.1763-15.el8"}'

Started on fiendish-sister.delivery.puppetlabs.net...
Finished on fiendish-sister.delivery.puppetlabs.net:
  {
    "status": "uninstalled"
  }
Successful on 1 target: fiendish-sister.delivery.puppetlabs.net
Ran on 1 target in 12.82 sec

Affected Area

Package task (for yum only)

@cliveweir cliveweir requested a review from a team as a code owner February 19, 2021 09:28
@cliveweir cliveweir linked an issue Feb 19, 2021 that may be closed by this pull request
Copy link
Contributor

@carabasdaniel carabasdaniel left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@carabasdaniel carabasdaniel merged commit fe685d9 into main Feb 19, 2021
@david22swan david22swan deleted the fix_package_task_on_yum branch March 2, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package task output is misleading when using yum
2 participants