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
#39891 makes "legacy style" module.run states incompatible with future versions #53504
Comments
Thanks, @dkfsalt, I completely agree. |
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. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Thank you for updating this issue. It is no longer marked as stale. |
I also recommend keeping old behavior always ON. Also, I have to do more checks to find the real cause, but one of the formulas did NOT gave me any error but also did not do ANYTHING. After a couple of hours trying to figure out what was the issue, when I changed the formula to use the new module.run call style, it worked :-( |
@cr1st1p So I'll be handling these changes and I've been updating myself on all the issues/PR's open for this... and want to make sure we're on the same page (please correct me if my thinking is wrong
Sound like a plan? |
First, strategically speaking, you guys have to decide what you want long term with the way of
A. Anyway, you need to support BOTH ways of calling module.run. Either indefinitely, or until you deprecate it, based on Because you need to support both, as per A, automatically, there is no reason for the existence of the setting Task wise, then: 3 wrap the current 2 versions of I think you could start with 2 and 3 and maybe even release, until you get the decision in place. Regards. |
IMO, the new There are open-source project examples (e.g., Django) that manage deprecations fairly well (again, IMO). It is worth placing some nudges in the right direction:
Finally, choose the deprecation date and deprecate the old style. |
Thanks for the detailed response guys - the current view point from the core team is to not deprecate the old style at all. This is because we don't wish to break any states. I agree, @max-arnold that we'll probably emphasis in the docs the new style so it becomes more apparent which style is favored, while also having the old style present. I will probably swing this by the core team and see what is the most appropriate moving forward. |
I wanted to ask you @max-arnold and @cr1st1p for a little bit of clarity on this, as I may be missing something here. So I have a state file like so...
And inside
and upon applying the state file, without having my minion configured with |
The fact that your simple module worked for you... Code wise, the flag is consumed via a decorator. 221 @with_deprecated(globals(), "Sodium", policy=with_deprecated.OPT_IN)
222 def run(**kwargs): This is the new style function. |
@xeacott See the https://github.com/saltstack/salt/blob/master/salt/utils/decorators/__init__.py#L536-L537 This is the new-style https://github.com/saltstack/salt/blob/master/salt/states/module.py#L349 And this is the old-style implementation: https://github.com/saltstack/salt/blob/master/salt/states/module.py#L459 One of the differences is how args/kwargs are passed: old_style:
module.run:
- name: test.arg
- args:
- arg1
- arg2
- kwargs:
kw1: kwarg1
kw2: kwarg2
new_style:
module.run:
- test.arg:
- arg1
- arg2
- kw1: kwarg1
- kw2: kwarg2 The expected return should be:
|
|
The best way to get people to migrate away from deprecated constructions is to provide migration tools that do it for them. See e.g. Python (though unfortunately once you start using It should be easy to script migration of plain yaml, and that could even be used as an sls filter (i.e. |
A module that can automatically handle the differences between the |
Resolved by #58763 |
dkfsalt commentedJun 17, 2019
•
edited
Description of Issue
GH-39891 creates a "legacy style XOR new style" situation where all old style states in the wild will no longer work, This means that there is a lot of community content that will simply fail to work once sodium is shipped.
This creates unnecessary work for anyone with states that work (if it ain't broke, don't fix it). It also means that anyone that's already chosen to use "new style" syntax can't use old style states without modifying them.
This is just a barrier to entry/usage of the system and I can foresee a situation where some people's production workloads will just stop working because of this when folks upgrade to sodium.
re: the warning that this is happening in Sodium - I was using the product for five months before I'd hit this issue - and if I'd not decided to "opt in" to the new syntax, I wouldn't have seen the issue until I'd upgraded to sodium. And it fails in a non-obvious way.
The module.run should be changed such that it can parse both the old and new style states.
Steps to Reproduce Issue
Run a new-style on a default pre-sodium system or run a legacy style state on a minion with the module.run set to superceded.
The text was updated successfully, but these errors were encountered: