Skip to content
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

xWindowsUpdateAgent: Added Retry Logic for Known Transient Errors (#24) #92

Merged
merged 4 commits into from
Mar 18, 2020

Conversation

pyrostew
Copy link
Contributor

@pyrostew pyrostew commented Feb 5, 2020

Pull Request (PR) description

Within the Get-WuaWrapper which was already handling some errors, added logic to perform retries on some of the errors that are likely to be transient.

This Pull Request (PR) fixes the following issues

Fixes #24

Task list

  • Added an entry under the Unreleased section of the change log in the README.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

This change is Reviewable

@codecov
Copy link

codecov bot commented Feb 5, 2020

Codecov Report

Merging #92 into dev will increase coverage by 1%.
The diff coverage is 91%.

Impacted file tree graph

@@        Coverage Diff        @@
##           dev   #92   +/-   ##
=================================
+ Coverage   62%   63%   +1%     
=================================
  Files        2     2           
  Lines      307   338   +31     
=================================
+ Hits       191   215   +24     
- Misses     116   123    +7

@pyrostew
Copy link
Contributor Author

pyrostew commented Feb 5, 2020

@TravisEz13 As requested, here is the PR!

return $ExceptionReturnValue
}
# 0x8024402c -2145107924 WU_E_PT_WINHTTP_NAME_NOT_RESOLVED Same as ERROR_WINHTTP_NAME_NOT_RESOLVED - the proxy server or target server name cannot be resolved. wuerror.h
-2145107924
Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking, but it might be good to refactor this into a function that takes an structure of the errorcode, if it's retryable and warning and iterates over them and does the right thing.

It would reduce code duplication and hopefully make the code easier to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made this change you suggested.

Copy link
Contributor

@TravisEz13 TravisEz13 left a comment

Choose a reason for hiding this comment

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

I don't see anything blocking.

I recommend submitting a PR to update formatting first. It makes things much easier to review.

@codecov-io
Copy link

codecov-io commented Feb 7, 2020

Codecov Report

Merging #92 into dev will increase coverage by 1%.
The diff coverage is 92%.

Impacted file tree graph

@@        Coverage Diff        @@
##           dev   #92   +/-   ##
=================================
+ Coverage   62%   64%   +1%     
=================================
  Files        2     2           
  Lines      307   342   +35     
=================================
+ Hits       191   219   +28     
- Misses     116   123    +7     

@pyrostew
Copy link
Contributor Author

pyrostew commented Feb 7, 2020

While I don't disagree that having a separate PR for the formatting changes would be sensible, at this point I would have to faff to separate the changes to do that. I will bare it in mind for future changes however.
Who needs prodding to merge this PR and get a Nuget package released?

@TravisEz13
Copy link
Contributor

I'm not a maintainer in the repo anymore....

@TravisEz13
Copy link
Contributor

cc @johlju

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

@pyrostew a few comments. This repo must be converted to the continuous delivery pipeline for us to be able to release a new version (see https://dsccommunity.org/blog/convert-a-module-for-continuous-delivery/). While you look at the review comments I can help convert this repo, but it will take me a week or so due to bandwidth.

Reviewed 3 of 4 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @pyrostew and @TravisEz13)


DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 128 at r2 (raw file):

function Check-Retry

We are not testing if this function actually retries? 🤔


DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 240 at r2 (raw file):

Quoted 4 lines of code…
            if(-not (Check-Retry $errorObj))
            {
                return $ExceptionReturnValue
            }

Not sure we actually unti test this function so that it is actually retrying?


DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1, line 723 at r2 (raw file):

Quoted 8 lines of code…
    if ($RetryAttempts -ge 0)
    {
        $script:retryAttempts = $RetryAttempts
    }
    if ($RetryDelay -ge 0)
    {
        $script:retryDelay = $RetryAttempts
    }

Not seeing this code is needed since it does not call any function that uses them from this function? 🤔

@johlju
Copy link
Member

johlju commented Feb 8, 2020

@pyrostew btw thank you for fixing style issues (formatting). There were still issues, but did not comment on that this time since whole repo still need fixing. 🙂

@pyrostew
Copy link
Contributor Author

Right sorry the delay in replying.
@johlju I can't seem to login to reviewable to respond directly to your comments, so I will respond to them here.

Relating to the first 2 comments about not testing, I have added a some test code in the first revision between lines 1395 and 1420, that I think suitably tests the retry logic, it certainly helped with creating the logic in revision 1 then refactoring it for revision 2.

Your 3rd comment is quite right, there is no need for that code in the Test-TargetResource, I will remove that and push a new revision.

@johlju johlju added the needs review The pull request needs a code review. label Mar 18, 2020
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TravisEz13)

@johlju johlju changed the title MSFT_xWindowsUpdateAgent: Added Retry Logic for Known Transisent Errors (#24) xWindowsUpdateAgent: Added Retry Logic for Known Transient Errors (#24) Mar 18, 2020
@johlju johlju merged commit 406c00c into dsccommunity:dev Mar 18, 2020
@johlju johlju removed the needs review The pull request needs a code review. label Mar 18, 2020
@johlju
Copy link
Member

johlju commented Mar 18, 2020

@pyrostew thank you for this contribution!

@johlju
Copy link
Member

johlju commented Mar 18, 2020

I took longer than expected to convert another repo, but finished with that so I will look into converting this one next, unless someone beat me to it.

johlju pushed a commit that referenced this pull request Mar 21, 2020
- Added Retry logic to known transient errors (issue #24).
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.

xWindowsUpdateAgent should handle 0x80244022
4 participants