Fix pkg.install salt-minion using salt-call#42861
Fix pkg.install salt-minion using salt-call#42861cachedout merged 1 commit intosaltstack:2016.11from
Conversation
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`.
|
@twangboy, thanks for your PR! By analyzing the history of the files in this pull request, we identified @alexproca, @morganwillcock and @dnd to be potential reviewers. |
|
Suggest you consider increase these, so that there is less chance of python being terminated vs salt-minion exiting cleanly (assuming salt-minion waits for current states to complete before exiting). Windows timeout for stopping a service is 30secs, so best if all termination steps are completed within 30 seconds. If it goes beyond 30 seconds windows indicates the service failed to stop. (even if the service stopped after 35 seconds). Suggest: Hopefully python will have a better chance of exiting cleanly if given 24 seconds to exit. |
|
@twangboy Making sure you saw the comments from @damon-atkins on this PR. |
|
@garethgreenaway A new PR created to address the issue described. |
| if pkginfo[version_num].get('allusers', True): | ||
| cmd.append('ALLUSERS="1"') | ||
| # Special handling for installing salt | ||
| if pkg_name in ['salt-minion', 'salt-minion-py3']: |
There was a problem hiding this comment.
Late thought....
Suggest pkg-name is change to an re.search('salt[\s-]*minion', pkg_name, flags=re.IGNORECASE+re.UNICODE) is not None
This will allow people to create their own sls files for salt-minion upgrade
e.g.
my org salt minion:
installer: http://internal web site etc
And it will not name clash with the github sls version and still work

What does this PR do?
When executing
pkg.install salt-minionusing salt-call there is still a Python process running maintaining locks on files that the installer is trying to overwrite. This is because theinstallfunction is usingtask.run_waitwhich waits for the task to finish before returning success. This is fine for standard programs that install using the scheduler, but bad for salt.This change will use
task.runand check that the task is actually running and then return that the task was started, not waiting for it to finish. This will apply only if the task was scheduled forsalt-minionorsalt-minion-py3.What issues does this PR fix or reference?
#40947
Previous Behavior
When installing salt using
salt-call pkg.install salt-minionthe installation was left in an unknown state due to issues with locked files.New Behavior
All Python processes related to the
salt-callnow close, allowing the installation to complete successfully.Tests written?
No