-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if updates weren't installed to not hard fail #56256
Conversation
@xeacott last change was made 3 weeks ago. Is it still WIP? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving in assumption there would be a test.
@xeacott any updates on this? |
Yes sorry, have not been able to focus on Open PRs for quite some time now - anyways, this needs an entire test suite written for the module and I haven't had a chance yet ... but I'll add that to my list for this week. |
There exists this PR #56637 that includes additions to unit and integration tests that I will utilize in this PR, so I will wait for that PR to be merged and then tests will be written. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 2 minor performance related change requests.
salt/states/win_wua.py
Outdated
updates_not_installed = [item for item in install.list() if item not in post_info] | ||
|
||
# Verify the installation | ||
for item in install.list(): | ||
if not salt.utils.data.is_true(post_info[item]["Installed"]): | ||
ret["changes"]["failed"] = { | ||
item: { | ||
"Title": post_info[item]["Title"][:40] + "...", | ||
"KBs": post_info[item]["KBs"], | ||
# Only check for items that were installed | ||
if item not in updates_not_installed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two loops are iterating the same list so could be one:
updates_not_installed = []
for item in install.list():
if item not in post_info:
updates_not_installd.append(item)
else:
the next line is the if below.
salt/states/win_wua.py
Outdated
|
||
# Add the list of updates not installed to the return | ||
if len(updates_not_installed) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder lint said you nothing about his. Please change to if updates_not_installed:
What does this PR do?
Corrects the list of updates that were actually installed by the WUA and returns a list of updates that
were not installed on the box due to various reasons, superseded, cumulative update, etc.
What issues does this PR fix or reference?
#52387
Tests written?
Needs tests
Commits signed with GPG?
No