Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8746

Improve time_metrics in report generation to use existing statuses

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.10.11, PUP 5.5.1
    • Fix Version/s: PUP 5.5.2
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      • All existing tests pass
      • Reports for a typical manifest are identical before and after the change
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Simplify logic for resolving resources' types in reports
    • QA Risk Assessment:
      Needs Assessment

      Description

      While looking for ways to influence report generation (to manipulate the types being reported by resources in MODULES-5970), a problematic line was discovered inside the metric calculation at https://github.com/puppetlabs/puppet/blob/5c092467789093d87228c1f471a469d314e3ae4f/lib/puppet/transaction/report.rb#L462:

       

       type = Puppet::Resource.new(name).type

       

      A new resource is being created solely to resolve its type name, which is already available inside the status object.

      That code originated in Feb 27, 2010 from lak at https://github.com/puppetlabs/puppet/commit/9919b14f262c994a58eb202cda408f1b90d728e0

       

      At that point in time, resource_type was not part of the status object - https://github.com/puppetlabs/puppet/blob/9919b14f262c994a58eb202cda408f1b90d728e0/lib/puppet/resource/status.rb

      resource_type was later added in https://github.com/puppetlabs/puppet/commit/1f72c31f9e0223e71e2729da96e0e98ebea5417e for Puppet 1.5.2 in Dec 30, 2010, at which point the code above could have been refactored, but never was

       

      The fix here should be a simple replacement of the call to generate a new resource with use of the already reported type.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support