Class based DSC resource intermittently fails

Welcome Forums DSC (Desired State Configuration) Class based DSC resource intermittently fails

Viewing 4 reply threads
  • Author
    Posts
    • #47345
      Participant
      Topics: 1
      Replies: 54
      Points: 202
      Helping Hand
      Rank: Participant

      While working on Class based DSC resource I encountered some issues and inconsistencies I can’t explain.
      I’ve created a small ‘project‘ help to troubleshooting: https://github.com/gaelcolas/env_refresh

      The issue is, if I run the configuration in the example/ folder: https://github.com/gaelcolas/Env_Refresh/blob/master/examples/dsc_configuration.ps1

      It fails the first time, works the second, and then it’s like ‘works’,’fails’ | Get-Random for subsequent attempts.

      The class is meant to be very simple:
      https://gist.github.com/gaelcolas/42f283727435c641a83419c764203ee3

      So is the configuration:
      https://gist.github.com/gaelcolas/6f485856dcfcbf4be0bcd0c8f1ac8a2e

      I’ll add a gif of the output I get when I run it in the git repo’s readme.

      It’s worth noting that on my laptop (Win 10 TP Fast ring), it works every time:

      Any idea of what I might be doing wrong? Or does it sound like an issue with the WMF5 on Win2012r2?

    • #47355
      Member
      Topics: 9
      Replies: 2322
      Points: 0
      Rank: Member

      There were definitely some pain points with class-based resources at first, and so far, I still haven’t used them in production. What do you mean by “fails”, though? What error message are you seeing?

    • #47370
      Participant
      Topics: 1
      Replies: 54
      Points: 202
      Helping Hand
      Rank: Participant

      Thanks Dave.
      Here’s what I get:

      It errors less often when I don’t have another configuration entry AFTER my Env_Refresh TESTVAR {…}.

      Also added a gif on my repo’s readme:
      https://github.com/gaelcolas/Env_Refresh/blob/master/README.md

      It took 4 tries before actually raising the error.

    • #47373
      Member
      Topics: 9
      Replies: 2322
      Points: 0
      Rank: Member

      I’ve seen some people report that same error on the MVP mailing list as well. If Microsoft has fixed it in the latest Fast Ring builds, great (once that version of PowerShell hits general release on the downlevel operating systems.)

      I don’t know if this will help, but in the email thread I’m looking at, they mention that the error was only happening if they had the LCM’s DebugMode set to something other than ‘None’. (ForceModuleImport, etc).

    • #47427
      Participant
      Topics: 1
      Replies: 54
      Points: 202
      Helping Hand
      Rank: Participant

      This was spot on, the problem exist only when the Debug mode is set to something else than NONE.
      On my Test-Kitchen configuration file .kitchen.yml I had

      Changing with debug_mode: None fixed my issue. (or amending the LCM via Set-DscLocalConfigurationManager)

      After that I tested on my laptop with the debug_mode: All, and it still worked.
      I suspect that bug has been fixed in WMF 5.1 (PSVersion 5.1.14390.0), but confirmation would be great (we may have to wait for WMF5.1 release and its release notes).

      I have opened a UserVoice for this as I could not find any: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/15273825-dsc-class-resource-fails-intermittently-when-debug

Viewing 4 reply threads
  • The topic ‘Class based DSC resource intermittently fails’ is closed to new replies.