Repository navigation
Conversation
Module reload performed by salt.state.State produces new instance of context injection into the state module. This makes the retcode set set at the end of states execution invisible for upstream module caller (minion). This passes current context instance to State to keep it on module reload.
|
@jacksontj could you please provide your opinion? |
|
Might also be related to #30674 |
|
Need this in 2016.3 as well |
…dcode Issues/29643 fix invalid redcode
|
LGTM :) |
|
@jacksontj great! Thanks! |
|
I have a patch that does the same thing that I've been using with 2015.8 for several months. Unfortunately the same patch does not work with the new tornado code that resets |
|
This is the patch I've been using since October/November 2015: |
|
@plastikos I've just tested again with |
|
@DmitryKuzmenko, I'm pretty certain. This is the whole reason I didn't submit my patch above because it wasn't a general fix anymore with tornado. |
|
The |
Fixes: #29643
Relates to: #28569
Problem:
Salt highstate is executed. One of states failed. Result retcode is 0.
Expected result retcode: 2.
Explanation:
The problem is the following: minion instance have
functionsLazyLoaderinstance keepingcontextinside. It callsmodules.state.highstate()that is loaded by the loader and injected with thecontextinstance. Thisstatemodule function createsstate.Stateinstance that creates it's ownLazyLoaderinstance with anothercontext'instance and executes states. Some states uses modules and during modules loading the newcontext'instance is injected into the modules instead of the old one. By theLazyLoaderdesign it searches a module to load by matching file names. If no exact nor partial match found it loads modules one-by-one and checks does the module registered the desired name with it's__virtual__function. So loading using virtual modules suchpkgcould produce loading of the state module with the new loader and injecting the newcontext'into it.When states execution is finished
modules.state.highstate()function writesretcodevalue into the modulecontext'dict that was updated by loader. But when it returns minon reads the value from itscontextdict it keeps in the old loader.Fix:
I've changed
statemodule to pass it's__context__object toStateobject that is uses it when it creates the newLazyLoaderinstance. This keeps thecontextinstance in all modules called indirectly from thestatemodule.