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

Allow users to overwrite default driver/type #539

Open
aelsabbahy opened this issue Jan 22, 2020 · 8 comments
Open

Allow users to overwrite default driver/type #539

aelsabbahy opened this issue Jan 22, 2020 · 8 comments

Comments

@aelsabbahy
Copy link
Member

Describe the feature:

Currently goss decides which package manager and service manager to use based on your OS. This feature is to allow users to overwrite this.

Describe the solution you'd like

Open to suggestions on this, two possibilities I'm debating:

  1. Use PKG_TYPE:PACKAGE_NAME syntax, this is consistent with the port checks.

Example:

package:
  rpm:coreutils:
    installed: true
    versions:
    - "8.27"
  1. Create a new attribute to control this, example "type" or "'driver"

Example:

package:
  coreutils:
    type: rpm
    installed: true
    versions:
    - "8.27"
@directionless
Copy link
Contributor

directionless commented Feb 22, 2020

Either seems fine. The attribute model feels slightly cleaner in go structs.

What happens if you want coreutils in both a deb and an rpm installed?

@pedroMMM
Copy link
Contributor

pedroMMM commented Feb 25, 2020

@aelsabbahy the 2nd option is cleaner for everyone, honestly I am not even a fan that the port checks use it.

I would also take it a step forwarder and allow the user to pass custom paths for the type binaries.

What happens if you want coreutils in both a deb and an rpm installed?

@directionless that is a weird setup but having 2 tests should just suffice.

@aelsabbahy
Copy link
Member Author

The attribute model does seem cleaner, but doesn't handle collisions or duplicates.

Another option is the ability to overwrite the key attribute, there's already work that's been done on this and new work is scheduled:

@directionless that is a weird setup but having 2 tests should just suffice.

I'm not a fan of forcing two tests.. Feels very limiting.

Another example of a resource that might benefit from this is the http one. GET vs PUT same URL.

Hopefully, we can come up with a consistent/flexible consensus on this and normalize everything in goss for it.

@pedroMMM
Copy link
Contributor

The attribute model does seem cleaner, but doesn't handle collisions or duplicates.

Another option is the ability to overwrite the key attribute, there's already work that's been done on this and new work is scheduled:

Oh yeah, I had forgotten about that! This a great feature even if newbies can get confused the first time they see it.

@directionless that is a weird setup but having 2 tests should just suffice.

I'm not a fan of forcing two tests.. Feels very limiting.

Another example of a resource that might benefit from this is the http one. GET vs PUT same URL.

Hopefully, we can come up with a consistent/flexible consensus on this and normalize everything in goss for it.

That is fair, introducing 2 tests should be avoided but that particular use case seems on the outside of the 80% of the use cases Goss aims for.

That said we could introduce a type and types attributes, they would be mutually exclusive and the plural version would just take in an array. This leaves a bit more work on the actual struct and code but leaves the API clean and intuitive. While is particular implementation might be skipped, we could still use this pattern in other places.

@aelsabbahy aelsabbahy added this to the v0.4.0 milestone May 3, 2020
@stale
Copy link

stale bot commented Jul 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 9, 2020
@aelsabbahy
Copy link
Member Author

This is still being discussed, not stale

@stale
Copy link

stale bot commented Sep 14, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used by https://probot.github.io/apps/stale/ label Sep 14, 2020
@stale stale bot closed this as completed Sep 21, 2020
@aelsabbahy
Copy link
Member Author

Going to just mark the 2nd approach as the approved one for now.

I'll work my way towards it a resource at a time, and will accept PRs that move the code in that direction. If anyone thinks it's a bad idea.. feel free to chime in here.

@aelsabbahy aelsabbahy reopened this Nov 14, 2020
@stale stale bot removed the stale Used by https://probot.github.io/apps/stale/ label Nov 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants