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

Multiversion package support #181

Merged
merged 2 commits into from
Feb 13, 2023
Merged

Conversation

nelsonkopliku
Copy link
Member

@nelsonkopliku nelsonkopliku commented Feb 9, 2023

This PR follows up discussion trento-project/wanda#150 and adds support for multiversion package detection.

Gatherer now returns a list representing the installed versions for the specific package

Only one version installed detected

$ trento-agent facts gather --gatherer package_version --argument sbd
...
[
  #{
    "version": "1.5.1+20221128.8ec8e01"
  }
]

Many versions installed detected for the package (sbd in the example)
As agreed, versions are ordered by installation time desc - latest installed first.

$ trento-agent facts gather --gatherer package_version --argument sbd
...
[
  #{
    "version": "1.5.1+20221128.8ec8e01"
  },
  #{
    "version": "1.5.1+20211116.6bb085f"
  }
]

With this we should be able to unlock trento-project/wanda#124 and relevant premium checks.
Doc update here trento-project/wanda#182

@nelsonkopliku nelsonkopliku marked this pull request as ready for review February 9, 2023 16:07
@nelsonkopliku nelsonkopliku force-pushed the multiversion-package-support branch from 487a335 to 02f4f4b Compare February 10, 2023 07:31
@nelsonkopliku nelsonkopliku self-assigned this Feb 10, 2023
@nelsonkopliku nelsonkopliku added the enhancement New feature or request label Feb 10, 2023
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

Hey @nelsonkopliku ,
Good job!
I find the some of the code ultra defensive, for scenarios that I don't know even know can really happen, but no harm I guess. The installedVersions[0].Version is the one that could worry me, but maybe it cannot even happen to not have any value there

PD: I would never imagine of doing this with env parsing hehe
But good call

internal/factsengine/gatherers/packageversion.go Outdated Show resolved Hide resolved
internal/factsengine/gatherers/packageversion.go Outdated Show resolved Hide resolved
@nelsonkopliku nelsonkopliku force-pushed the multiversion-package-support branch from 02f4f4b to 3a46886 Compare February 13, 2023 09:05
@nelsonkopliku nelsonkopliku force-pushed the multiversion-package-support branch from 3a46886 to a7cbeff Compare February 13, 2023 09:09
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

@nelsonkopliku nelsonkopliku merged commit 05a0ed3 into main Feb 13, 2023
@nelsonkopliku nelsonkopliku deleted the multiversion-package-support branch February 13, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants