When executing `pkg.install salt-minion` using salt-call there is still a
python process running maintaining locks on files that the installer is
trying to overwrite. This is because the `install` function is using
`task.run_wait` which waits for the task to finish before returning
success. This is fine for standard programs that install using the
schedular, but bad for salt.
This change will use `task.run` and check that the task is actually
running and then return that the task was started. This will apply only
if the task was scheduled for `salt-minion` or `salt-minion-py3`.
Callers of `hash_and_stat_file` expect a 2-tuple and an exception will
be raised if only a single value is returned.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
moto versions >= 1.0.0 have changed the way the mocked connections through
boto are handled with the @mock_ec2 decorator. They use the boto3 connection
method. However, since we are still using boto in many places, we need to use
the new @mock_ec2_deprecated decorator instead to handle the boto connection
functions for the unit tests.
Versions of moto < 1.0.0 are not Python 3 compatible, so salt-jenkins should
be installing newer versions of moto for those tests. Unfortunately, we cannot
install an older version of moto for Python2 that use the original @mock_ec2 call
and also import the @mock_ec2_deprecated function for newer versions of moto
simultaneously as the @mock_ec2_deprecated function doesn't exist in older
versions of moto.
In another case it will block minion execution if master is not
responding.
This is actual for MultiMaster configuration because blocks minion to
respond to the active master requests if another one is down.
Exception in function "create_cert_binding".
function fails with the following exception:
2017-08-09 00:23:32,096 [salt.state ][ERROR ][2948] An exception occurred in this state: Traceback (most recent call last):
File "c:\salt\bin\lib\site-packages\salt\state.py", line 1837, in call
**cdata['kwargs'])
File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "c:\salt\var\cache\salt\minion\extmods\states\win_iisV2.py", line 326, in create_cert_binding
ipaddress, port, sslflags)
File "c:\salt\var\cache\salt\minion\extmods\modules\win_iisV2.py", line 861, in create_cert_binding
if binding_info not in new_cert_bindings(site):
TypeError: 'dict' object is not callable
**This is the problematic code:
new_cert_bindings = list_cert_bindings(site)
if binding_info not in new_cert_bindings(site):
Just need to remove (site) from second line as follows and it's fixed:
new_cert_bindings = list_cert_bindings(site)
if binding_info not in new_cert_bindings:**
The following exception occasionally occurs when `master_type=disable`:
```
File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1989,
in handle_event
self._fire_master(data['data'], data['tag'], data['events'],
data['pretag'])
File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1261, in
_fire_master
'tok': self.tok}
AttributeError: 'Minion' object has no attribute 'tok'
```
This occurs because it tries to fire a master event when the minion
is not connected to the master, in this case due to an action from a
beacon.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>