chef: dsc_script idempotence not working?

Description

I cannot get dsc_script to correctly work with idempotence. Always reporting resources are changing, even though they are not. If I code the same functionality in a powershell_script resources with a not_if guard, idempotence works correctly.

Chef Version

12.16.42

Platform Version

Server2012R2

Replication Case

#resource definition
dsc_script 'NetFramework35Core_dscScript' do
  code <<-EOH
    WindowsFeature NetFramework35Core
    {
      Name = "Net-Framework-Core"
      Ensure = "Present"
      Source = 'C:\\Windows\\WinSxS'
    }
  EOH
end

run_status.updated_resources shows the above as always updated.

Client Output

myhost.mydomain.com [2016-11-28T12:49:18-08:00] INFO: Processing dsc
_script[NetFramework35Core_dscScript] action run (Troubleshooting::default line
15)
myhost.mydomain.com [2016-11-28T12:49:21-08:00] WARN: Could not pars
e LCM output: Could not parse:
myhost.mydomain.com WARNING: Whatif is deprecated in this cmdlet. Pl
ease remove Whatif and try
myhost.mydomain.com again.
myhost.mydomain.com
myhost.mydomain.com [2016-11-28T12:49:26-08:00] INFO: DSC resource c
onfiguration completed successfully
myhost.mydomain.com [2016-11-28T12:49:26-08:00] INFO: Chef Run compl
ete in 13.517764 seconds
myhost.mydomain.com [2016-11-28T12:49:26-08:00] INFO: Running report
 handlers
myhost.mydomain.com https://myreportingnode.mydomain.com:444/Chef/chefCh
eckin.php?node=myhost.mydomain.com&status=0&runlist=recipe[POPBase],
recipe[Troubleshooting]&totalresources=11&updatedresources=3&elapsedtime=13.5177
64&updatedresourcestext=chef_handler[POPLogging::LogChefRuns],chef_handler[POPLo
gging::SendEmail],dsc_script[NetFramework35Core_dscScript]
myhost.mydomain.com [2016-11-28T12:49:26-08:00] INFO: Report handler
s complete

Stacktrace

Please include the stacktrace.out output or link to a gist of it, if there is one.

NOTE: CHEF CLIENT BUGS ONLY

This issue tracker is for the code contained within this repo – chef-client, base knife functionality (not plugins), chef-apply, chef-solo, chef-client -z, etc.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

No worries @rayterrill - it’s still a bug, but the primary use case for DSC when WMF 5 is present is via dsc_resource.

There are a couple of dsc_script/wmf 5 bugs out there - https://github.com/chef/chef/issues/5044 and https://github.com/chef/chef/issues/4999

This is in 12.21.11+ (promoted to stable in 12.21.12)

It is also in 13.4.20+ (13.4.24 was recently promoted)

@smurawski 👍

Also as dsc_script heavily rely on output it doesn’t work on systems with codepage other than 437 by design. As opposite to dsc_resource which works great.