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

Improve extraction of available updates #181

Merged
merged 1 commit into from
Jun 27, 2020

Conversation

smortex
Copy link
Member

@smortex smortex commented Jun 5, 2020

Pull Request (PR) description

The yum list updates command outputs diagnostic messages and then the actual available updates both on stdout. Depending on the installed yum plugins, a variable number of diagnostic lines are emitted, and the output is always formatted for humans, making it non-trivial to distinguish useless and relevant lines.

Instead of ignoring the first line, match each line with a pattern matching the following fields:

  • package: The name of the package for which an update is available, they are in the format <package-name>.<architecture>;
  • available_version: The version of the package available for update, ensure it starts with a digit;
  • repository: The repository containing the update

These fields are separated by a variable amount of space. When a line match this pattern, consider the package as relevant for update.

This Pull Request (PR) fixes the following issues

Fixes #180

@smortex
Copy link
Member Author

smortex commented Jun 5, 2020

@vchepkov, can you please confirm that this fix your problem?

Copy link

@vchepkov vchepkov left a comment

Choose a reason for hiding this comment

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

Yes, it does solve the problem, I tested with and without updates available, works as expected, thank you

@bastelfreak
Copy link
Member

thanks for the PR. can you add an acceptance test that verifies your changes are correct? The regex is quite hard to read :)

The `yum list updates` command outputs diagnostic messages and then the
actual available updates both on stdout.  Depending on the installed yum
plugins, a variable number of diagnostic lines are emitted, and the
output is always formatted for humans, making it non-trivial to
distinguish useless and relevant lines.

Instead of ignoring the first line, match each line with a pattern
matching the following fields:
  - package: The name of the package for which an update is available,
    they are in the format <package-name>.<architecture>;
  - available_version: The version of the package available for update,
    ensure it starts with a digit;
  - repository: The repository containing the update

These fields are separated by a variable amount of space.  When a line
match this pattern, consider the package as relevant for update.
@smortex
Copy link
Member Author

smortex commented Jun 25, 2020

I could finally managed to get some time for this. I added a few unit test and rebased the fix on top of master. Thanks!

@bastelfreak bastelfreak added the enhancement New feature or request label Jun 27, 2020
@bastelfreak bastelfreak merged commit 45e8f58 into voxpupuli:master Jun 27, 2020
@smortex smortex deleted the improve-list-updates branch June 27, 2020 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

yum_package_updates fact misinterprets output
3 participants