Skip to content

Fix pkg.install salt-minion using salt-call#42861

Merged
cachedout merged 1 commit intosaltstack:2016.11from
twangboy:win_pkg_install_salt
Aug 14, 2017
Merged

Fix pkg.install salt-minion using salt-call#42861
cachedout merged 1 commit intosaltstack:2016.11from
twangboy:win_pkg_install_salt

Conversation

@twangboy
Copy link
Copy Markdown
Contributor

What does this PR do?

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 scheduler, 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, not waiting for it to finish. This will apply only if the task was scheduled for salt-minion or salt-minion-py3.

What issues does this PR fix or reference?

#40947

Previous Behavior

When installing salt using salt-call pkg.install salt-minion the installation was left in an unknown state due to issues with locked files.

New Behavior

All Python processes related to the salt-call now close, allowing the installation to complete successfully.

Tests written?

No

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`.
@ghost
Copy link
Copy Markdown

ghost commented Aug 10, 2017

@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.

@damon-atkins
Copy link
Copy Markdown
Contributor

damon-atkins commented Aug 10, 2017

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).

image

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:
1 Generate Control-C 24000
2 Send WM_CLOSE 2000
3 Send WM_QUIT 1500
Total: 24 + 2 + 1.5 = 27.5 secs
4 Terminate left with 2.5 secs to force terminate

Hopefully python will have a better chance of exiting cleanly if given 24 seconds to exit.

@garethgreenaway
Copy link
Copy Markdown
Contributor

@twangboy Making sure you saw the comments from @damon-atkins on this PR.

@twangboy
Copy link
Copy Markdown
Contributor Author

@garethgreenaway A new PR created to address the issue described.
#42913

@cachedout cachedout merged commit 52bce32 into saltstack:2016.11 Aug 14, 2017
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']:
Copy link
Copy Markdown
Contributor

@damon-atkins damon-atkins Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@twangboy twangboy deleted the win_pkg_install_salt branch August 21, 2017 22:09
@twangboy twangboy mentioned this pull request Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants