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

dsc_lite: (SPIKE) Determine if Puppet can emit better change_to_s messages that include actual resource information

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Won't Do
    • None
    • None
    • dsc_lite
    • Hide

      TIMEBOX: 2 days

      OUTPUT: tickets for the 1.0.0 epic, subject to future grooming.

      Show
      TIMEBOX: 2 days OUTPUT: tickets for the 1.0.0 epic, subject to future grooming.
    • Windows
    • 1
    • Needs Assessment

    Description

      During MODULES-5970 it was found that the messages created when dsc_lite resources are created/removed/updated were very brief

      Current behaviour:

      Given a manifest of;

      dsc {'FooFile':
        dsc_resource_name        => 'File',
        dsc_resource_module      => 'PSDesiredStateConfiguration',
        dsc_resource_properties  => {
          ensure          => 'present',
          destinationpath => 'C:\\temp\\dscfile.txt',
          contents        => 'TestFile',
        }
      }
       
      dsc {'FooFile2':
        dsc_resource_name        => 'File',
        dsc_resource_module      => 'PSDesiredStateConfiguration',
        dsc_resource_properties  => {
          ensure          => 'present',
          destinationpath => 'C:\\temp\\dscfile2.txt',
          contents        => 'TestFile',
        }
      }
      

      And the files C:\Temp\dscfile.txt and C:\Temp\dscfile2.txt already exist but with empty content

      Puppet outputs;

      ...
      Notice: Compiled catalog for glenn.sarti-c7s9ph2 in environment workstation_production in 9.23 seconds
      Notice: /Stage[main]/Main/Dsc[FooFile]/ensure: created
      Notice: /Stage[main]/Main/Dsc[FooFile2]/ensure: created
      Notice: Applied catalog in 6.42 seconds
      

       

      The "created" message may be misleading / inaccurate and should better reflect that we invoked a DSC resource, but don't know what it did. Doing this should require implementing the change_to_s method for the ensure property. See the https://github.com/puppetlabs/puppet/blob/5aef613f148ff19435cb48ab76c6b9b72b2d9143/lib/puppet/property/ensure.rb#L50-L64 definition.

       

       

      This spike ticket will investigate would it be possible to modify those messages and what those messages would look like.

       

      Last run report;

      ...
      resource_statuses:
        Dsc[FooFile]:
          title: FooFile
          file: C:/source/tmp/puppetlabs-dsc_lite/tmp/test.pp
          line: 1
          resource: Dsc[FooFile]
          resource_type: Dsc
          provider_used: powershell
          containment_path:
          - Stage[main]
          - Main
          - Dsc[FooFile]
          evaluation_time: 4.28734
          tags:
          - dsc
          - foofile
          - class
          time: '2018-05-16T11:28:07.507692000+08:00'
          failed: false
          changed: true
          out_of_sync: true
          skipped: false
          change_count: 1
          out_of_sync_count: 1
          events:
          - audited: false
            property: ensure
            previous_value: absent
            desired_value: present
            historical_value: 
            message: created
            name: dsc_created
            status: success
            time: '2018-05-16T11:28:10.882992000+08:00'
            redacted: 
            corrective_change: false
          corrective_change: false
        Dsc[FooFile2]:
          title: FooFile2
          file: C:/source/tmp/puppetlabs-dsc_lite/tmp/test.pp
          line: 11
          resource: Dsc[FooFile2]
          resource_type: Dsc
          provider_used: powershell
          containment_path:
          - Stage[main]
          - Main
          - Dsc[FooFile2]
          evaluation_time: 1.828023
          tags:
          - dsc
          - foofile2
          - class
          time: '2018-05-16T11:28:11.795032000+08:00'
          failed: false
          changed: true
          out_of_sync: true
          skipped: false
          change_count: 1
          out_of_sync_count: 1
          events:
          - audited: false
            property: ensure
            previous_value: absent
            desired_value: present
            historical_value: 
            message: created
            name: dsc_created
            status: success
            time: '2018-05-16T11:28:12.708053000+08:00'
            redacted: 
            corrective_change: false
          corrective_change: false
      ...
      

      Ideally the message would be more verbose. Not sure if this is possible from DSC

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ethan Ethan Brown
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support