Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-2512

DSC - Cannot Ensure "absent" on Service Resource

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: dsc
    • Labels:
    • Environment:

      Module Version: 0.8.0-b20081-a2b62b3e
      Puppet Agent Version: 1.2.2 (Gold)
      Agent: Windows 2012 R2 x64

    • Template:
    • Story Points:
      1
    • Sprint:
      Windows 2015-10-07, Windows 2015-10-21, Windows 2015-11-04, Windows 2015-12-30

      Description

      Description

      If a user specifies the DSC "Service" with ensure set to "absent" the service will fail to be removed:

      Notice: Compiled catalog for xdvjheke8ard32h.delivery.puppetlabs.net in environment production in 0.45 seconds
      Notice: Applied catalog in 2.05 seconds

      However, you can successfully remove a service by using Invoke-DscResource directly:

      PS C:\Users\Administrator> Invoke-DscResource -Name Service -Method Set -Verbose -Property @{Ensure="Absent";Name="puppe
      t"}
      VERBOSE: Performing the operation "Invoke-CimMethod: ResourceSet" on target "MSFT_DSCLocalConfigurationManager".
      VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ResourceSet,'className' =
      MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
      VERBOSE: An LCM method call arrived from computer W2012R2 with user sid S-1-5-21-21471022-4190806042-1792990002-500.
      VERBOSE: [W2012R2]: LCM:  [ Start  Set      ]  [[Service]DirectResourceAccess]
      VERBOSE: [W2012R2]:                            [[Service]DirectResourceAccess] Service 'puppet' already stopped, no
      action required.
      VERBOSE: [W2012R2]:                            [[Service]DirectResourceAccess] Service 'puppet' Deleted Successfully
      VERBOSE: [W2012R2]: LCM:  [ End    Set      ]  [[Service]DirectResourceAccess]  in 0.2190 seconds.
      VERBOSE: [W2012R2]: LCM:  [ End    Set      ]    in  0.6400 seconds.
      VERBOSE: Operation 'Invoke CimMethod' complete.
       
      RebootRequired
      --------------
      False
       
       
      PS C:\Users\Administrator> Invoke-DscResource -Name Service -Method Test -Verbose -Property @{Ensure="Absent";Name="pupp
      et"}
      VERBOSE: Performing the operation "Invoke-CimMethod: ResourceTest" on target "MSFT_DSCLocalConfigurationManager".
      VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ResourceTest,'className' =
      MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
      VERBOSE: An LCM method call arrived from computer W2012R2 with user sid S-1-5-21-21471022-4190806042-1792990002-500.
      VERBOSE: [W2012R2]: LCM:  [ Start  Test     ]  [[Service]DirectResourceAccess]
      VERBOSE: [W2012R2]: LCM:  [ End    Test     ]  [[Service]DirectResourceAccess] True in 0.1410 seconds.
      VERBOSE: [W2012R2]: LCM:  [ End    Set      ]    in  0.5320 seconds.
      VERBOSE: Operation 'Invoke CimMethod' complete.
       
      InDesiredState
      --------------
      True

      Attachments

      • None

      Repro Steps

      1. Install Puppet Agent on the Windows agent nodes.
      2. Install DSC module from the modules staging Forge on the agent nodes:

        puppet module install puppetlabs-dsc --module_repository https://api-module-staging.puppetlabs.com

      3. Configure LCM refresh mode:

        puppet apply -e "dsc::lcm_config { 'disable_lcm': refresh_mode => 'Disabled' }"

      4. Apply the following manifest on the SUT:

        puppet apply -e "dsc_service { 'remove_service': dsc_ensure => 'absent', dsc_name => 'puppet' }"

      Expect

      The Puppet apply should complete successfully and remove the "puppet" service.

      Actual

      The DSC module fails to remove the service:

      Notice: Compiled catalog for xdvjheke8ard32h.delivery.puppetlabs.net in environment production in 0.45 seconds
      Notice: Applied catalog in 2.05 seconds

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ethan Ethan Brown
              Reporter:
              ryan.gard Ryan Gard
              QA Contact:
              Ryan Gard
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support