This modifies the "state" exec module to use __pillar__ as the pillar
data for the state run rather than compiling fresh pillar, unless the
pillarenv has been changed from the configured value, keeping salt-call
from unnecessarily compiling pillar a second time.
It also normalizes saltenv/pillarenv support in functions that should
have had it but did not.
This allows for salt.state.State() instances to have their initial
pillar data passed into them, rather than calling _gather_pillar() to
compile fresh pillar data. This allows for the __pillar__ dunder to be
used directly for salt-call (when the pillarenv is unchanged). Since the
__pillar__ is compiled at the beginning of a salt-call, this prevents
duplicate pillar rendering from happening when salt-call is invoked.
An explanation of why this fixes#41778 (which appeared after merging
PR #41436).
The following is true both before PR #41436 was merged and after it
was merged:
- On Tornado 4.2.1, `SyncWrapper.__del__` is sometimes invoked twice.
When this happens, `self.io_loop.close()` is also invoked twice.
- On Tornado 4.5.1, `SyncWrapper.__del__` is never invoked twice. Hence
this issue doesn't appear when using that version of Tornado.
Why did PR #41436 cause this issue?
- What that PR essentially did was ensure that there were no pending
I/O operations left in the I/O Loop before the I/O Loop was closed.
It essentially "drained out" the pending future that came from
`self._read_until_future` which let `SaltMessageClient._stream_return()`
complete. Tornado 4.2.1 seems to allow a call to close an I/O Loop
twice if it still has pending operations, but will throw the
`ValueError` exception if you attempt to close an empty I/O Loop twice.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
In PR #40543, the fingerprint_hash_type option was added to the state
function in salt/states/ssh_known_hosts.py, as well as the function in
the ssh execution module that the ssh_known_hosts states called out to.
This caused issue #40878 because the fingerprint_hash_type state setting
was not added to the salt/states/ssh_auth.py file. This PR adds this
setting to the ssh_auth file, as well as the functions that are used in
the ssh execution module. This allows the user to set the fingerprint_hash_type
option so avoid the warnings about the default changing.
Fixes#40878
If the remote side closes the connection (which could happen if its own
timeout is hit due to the master taking too long to respond or if it
is shutting down), it puts the salt-master in a bad state where further
minions cannot connect to it. This fixes the issue by absorbing the
`StreamClosedError` exception so that
`TCPReqServerChannel.handle_message` doesn't leak any exceptions
which would put the salt-master in a bad state. Absorb other
exceptions as well just in case.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
The automatic back-porting process did't work for this file since the
testing file has been renamed. I manually added the changes to
`timezone_test.py` that were present in PR #41615.