-
Notifications
You must be signed in to change notification settings - Fork 421
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
feat(formula): add metastate per community convention #421
Conversation
2b981ac
to
e307583
Compare
@noelmcloughlin just out of curiosity, what's the advantage of the syntax you used here over this one? It's the first time I see the one you propose used in a state file. |
None. I presume the vpn formula works with every OS so it is nice and clean. The salt-formula has technical debt which results in, at best, state failures, at worst exceptions-
This implementation respects the technical debt, but that does not mean we approve of it. I can clean it up if you want. |
I'm surprised too by the syntax, not the Jinja "if" included, but
instead of
This syntax is the one generally used for |
@noelmcloughlin Just a bit busy at the current time. If you could deal with the concerns raised above in the meantime, that would be great. |
e307583
to
3866507
Compare
Hi @myii, @javierbertoli thanks for reviewing. Other PR will need to tidy up FreeBSD/MacOS failed states & exceptions. |
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.
Actually looking at this, there's just too many ifs and buts at the moment, which is probably why it hasn't already been done. Other than development/testing, I can't think of a situation where you'd want to run all of the states. So perhaps a way around this is to do the core state(s). But even that's difficult, because that would probably be:
pkgrepo
+- one of the other states (
master
,minion
,ssh
or evensyndic
) + formulas
(maybe)
Perhaps best to leave this to top.sls
matching? Or introduce new variables into the map and then use Jinja if
blocks here (but how does this improve upon top.sls
?).
In the general scheme, the expectation is that each formula should try to include So the question is what will work even if no states run. On GNU/Linux I use:
On MacOS I use this (to avoid all the exceptions).
What's acceptable here? Having no |
As said by @myii I'm not sure it makes sense, even if the majority of formulas do it. At work, we use
for every server, and only
Not sure I agree with that. The README explicits tell which states exists. If you want we can add a mention explicitely stating that there is no salt metastate. If we really want a metastate, I think it should call |
04b2e79
to
81cbbba
Compare
I like the init states that include the other states based on pillar. If salt:master is defined, then include salt.master, etc. So if you manage the master and the minions with salt, you could have the top file call just salt for all of your systems and it would manage the master and minions appropriately. |
And I like the suggestion because it makes |
@getSurreal This crossed my mind earlier but there are default values for some of these coming through to the map (i.e. we can't do this implicitly). I'm not keen on using |
For sure, that why I doubt the need for a metastate :) But installing salt.master in it is clearly not a solution. |
@myii Doesn't map only get called from the individual states? Only the init would need to have 'pillar.get'. If someone called 'salt.master' state, it would still load up the defaults and execute even if there was no pillar defined, but if only the 'salt' state got called it would not execute unless 'salt:master' existed in pillar (and similarly for the other states). |
@getSurreal Looks like I'm going to have to get over my distaste of inline |
Untested, but here's the basic layout. Order can be changed for dependencies. I know salt.formulas is needed before salt.master, but I'm unsure of any other order requirements.
|
@getSurreal Thanks for that starting point. I think we've got an issue with some of these, since
Hence, we may not be able to achieve this implicitly and definitely not in a consistent fashion. New explicit values are probably required, at least in some cases. As you mentioned, the ordering will need to be looked at as well. |
81cbbba
to
685056d
Compare
Thanks @getSurreal for the detailed suggestions. I'm open to incorporating your solution. A question on implementation. (1) Do we prefer the conditional logic at top-level
|
a823da6
to
8ad297d
Compare
@getSurreal @myii @daks |
Instead of the "extra_init_states:", I would do something like
and add to pillar.example something like
|
Just some initial feedback on the new changes and ideas. @noelmcloughlin Could we use @getSurreal Taking the example of |
Furthermore, these would need to be checked in the state files as well, unless we're using them purely for this meta-state and then would need to be named accordingly. Not that I'm recommending that as what should be done, it doesn't really make sense. Another angle is that the main meta-state doesn't have to do everything. Covering the main options is probably good enough. |
@myii @getSurreal
If someone introduces new feature for Guys ... |
e3be427
to
2afa724
Compare
Is this okay? |
Haven't checked the very latest changes but the |
Yamllint is fixed now. Suse Travis CI job failure is unrelated to this PR.
|
@myii are you happy with this? |
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.
@noelmcloughlin A couple of inline comments for you. Would you mind rebasing this on the latest version of the formula, so that all of the linters can run?
f272f84
to
e8211ab
Compare
@myii that was done. the commits giving lint problems are not part of my PR. |
@noelmcloughlin The issue has come via. the merge commits, where the old commit messages are triggering the commitlint violations. That can be avoided via. a clean rebase or using Can I get any final approvals from anyone else involved on this thread? Or I can see that @aboe76 or @sticky-note haven't been involved so far -- any thoughts? |
e8211ab
to
fbaa456
Compare
Okay, I have rebased and tests are passing again. thanks. |
@noelmcloughlin Thanks for doing that. We'll allow for any final reviews and then get on with merging this soon -- thanks for your patience. |
@noelmcloughlin Merged (finally!). |
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
i met a new problem with using config, if use pillar i can override a new value in command line when i use salt-ssh to install minion like this
how can i init a salt.config value in command line option when i use salt-ssh to apply salt formula to install minion? |
remind that salt.pillar.get('salt:api') return a function call object when salt'pillar.get' return the exactly value of pillar salt:api |
Hello. I'm resurrecting the discussion since I'm working on refactoring the formula according to current standards in #529. Using the top level metastate is good, all the But there is an issue when calling I see 3 options:
I personally advocate for the third option, it's always better to fail. This breaks only for people running states on non compatible minions and the actual If there are no strong argument against the Regards. |
Resolves #410 and helps #352. Using this metastate is optional.
In particular, this metastate avoids having developers reinvent the wheel, i.e. https://github.com/opensds/opensds-installer/blob/c3e8b45a75b3ce1589f0d2ae680e8302ec9c4dd2/salt/srv/salt/install/salt.sls#L1