-
Notifications
You must be signed in to change notification settings - Fork 85
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
WIP: feat(unsupported): prevent formula running on unsupported minions #91
base: master
Are you sure you want to change the base?
WIP: feat(unsupported): prevent formula running on unsupported minions #91
Conversation
b05814e
to
e4173a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@myii, nice Idea. I like it because it makes it clear which parts of the formula could use work, or explain why the formula won't work with a certain OS
@aboe76 Thanks for the review. One thought I'm having is whether to use a string instead of a dict for
Basically, is it more important to see all of the reasons why the formula won't run for a particular minion or is it more important to be able to enable/disable in a more powerful way? I guess there is also the option of doing both but that's a lot more maintenance. |
e4173a9
to
6ccceb7
Compare
Tried writing some test for local:
----------
ID: template-unsupported-test-fail
Function: test.fail_without_changes
Name:
#######################################
# Unsupported minion for this formula #
#######################################
* osfinger: CentOS 6 (does not use `systemd`).
Result: False
Comment: Failure!
Started: 09:46:44.150860
Duration: 14.228 ms
Changes:
Summary for local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 14.228 ms
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Converge failed on instance <v2017-7-py2-bootstrap-centos-6>. Please see .kitchen/logs/v2017-7-py2-bootstrap-centos-6.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
The command "bundle exec kitchen verify ${INSTANCE}" exited with 20.
There is an open issue on the Is there any sensible way to test this without having to write another state for the test run? |
@myii I would opt for the I don't know enough about |
@aboe76 OK, glad we're in agreement. When I get a chance, I'll rebase it to use a strings instead. |
bab4a82
to
423c01a
Compare
@aboe76 Done and tested. Now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @myii !
I absolutely love an idea of having defined list of platforms which are explicitly supported.
Regarding your implementation, I think including the unsupported.sls
in each other SLS file is not the best option.
Because some formulas (at least for PosgreSQL I know for sure) has SLS file completely dedicated to some operating system, say Mac OS. But other files does not support the system which a formula could support in general.
I would like to suggest making a check for compatibility (put the include) only in the top init.sls
file which serve as an entry point for full provisioning for a piece of software.
This way we could avoid lots of unnecessary duplications and also enable reuse of individual states.
For example, the user would be able hack Pillar configuration to make some parts of the formula actually usable on certain OS, and craft his/her own top file to reference needed states.
@vutny Beautiful, that's what I needed. I did look at So reading what you've written, I believe this may be a little compromise, since I'm speaking about using this in all all of the |
423c01a
to
9fed933
Compare
I've removed the draft status from this PR because it is meeting general approval and it's time for the CI tests to run from here. I've switched to using |
Nice job. As always, we need to confront pros and cons of this way of doing things:
Also I wonder if finally what people'll do is grep for all I'm not against the idea but I'm not sure it's worth implementing it everywhere. |
* https://freenode.logbot.info/saltstack-formulas/20190421#c2129159 * Use `failhard` to prevent execution if `unsupported` has been set * Show reason why minion is `unsupported` * Allow `unsupported` to be overridden at each level within the map
9fed933
to
7414fa0
Compare
Thanks for the feedback, @daks.
Actually, the plan is to reduce the cognitive load overall. Very simple to add a line to an
Unfortunately, we're unlikely to ever get to a stage where our Kitchen/Travis setup will cover all of the types of minions that a formula supports. So it's not enough to direct users to that.
If this is done properly, it could be well worth implementing everywhere. However, let's get it working in one or two places first, to see if it really makes a significant difference. |
Sorry for jumping late here, adding a few comments:
we can perhaps set a dict like:
example
and in the states do a In the example, the whole formula will be unsupported for Debian-8, the |
I think so. My 2 cents. |
We're also unlikely to maintain this 'unsupported'-OS list...
Let's do that then, and see if it's maintained in the future (months, years...). |
Okay I like the idea. The consensus is to roll out slowly. We could select a small subset of formulas to implement and showcase features where a universal solution/answer/consensus is unclear. I'm in agreement on these points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix th conflict.
@noelmcloughlin Thanks for the review. This PR stagnated a bit since it wasn't conclusive which method would serve us best. I'll rebase when we reach the point of merging this PR. |
Thanks no bother. Just an off topic comment - on the challenge of deciding how to handle "go-slow" features. One of the motivations of the template-formula is to provide a "reference solution" or go-to repo for beginners, and for experienced salters who want to follow current conventions evolved by the community. This motivation suggests the template-formula should have some degree of stability - a stable branch I guess, or master. I was thinking we could fork template-formula to a incubator-formula so features we are not sure about - or want to soak test - stay there before being promoted to template-formula (stable entity) or being rejected and PR\ed out. We could direct beginners to template-formula and redirect more experienced community members to the incubator formula (template-formula + other stuff). |
@noelmcloughlin I'm not really a fan of having lots of template-style repos out there. Keeping those synchronised (for the common bits) will be painful. I'd much rather we do most of these things here, in separate branches. For example, after the little sub-discussion that culminated in #21 (comment), @javierbertoli has provided Another suggestion is having
This will be easier to maintain as separate branches in one repo. As @javierbertoli mentioned, we could easily use Where there is a kind of template that varies significantly from this common core, then that will require a separate repo for sure. |
@noelmcloughlin After all of that, I didn't mention where the "go-slow" would go! The |
@myii thanks for the info, appreciated. I will look into branching further. |
failhard
to prevent execution ifunsupported
has been setunsupported
Notes
Rationale
Had this idea when discussing this
stunnel-formula
PR, where it appears that Debian Jessie cannot be supported. When looking at the.yaml
files, it became apparent that the formula was only configured forDebian
andFreeBSD
. How would someone know if it was supported for their minions? Rather than relying solely on documentation, if the formula would refuse to run for unsupported minions, with reasons why it isn't supported, that would be advantageous. This draft PR is a suggested approach, to open up the discussion.Use of
test.fail_without_changes
This doesn't have to use
test.fail_without_changes
. If there is a better option, that can be used instead. I used it since it was readily available for the task.Output
An example of the output:
osfinger
explanation being displayed.unsupported
were to be set inosfamilymap
andosmap
, then it would show all of the reasons that have been provided.failhard: True
.Leading to:
unsupported
set explicitlyAll of the
.yaml
files could contain a standardised list (within reason). Thenunsupported
could be explicitly set wherever necessary. Provides protection from rogue execution of formulas as well as serving as documentation about which platforms are (not) supported.Leading to: improved CI
With this, can always keep all platforms in the testing matrix, such as
centos-6
, which is currently commented out for this formula. Tests can be included to ensure that the formula doesn't run where it's not supposed to.Final comment
This PR probably isn't quite right. I'm not expecting it to be merged as-is -- or maybe not at all. But it serves as a useful mechanism to stimulate the discussion about how this feature could be implemented instead. I believe that is what is important here.