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

metadata.json is parsed twice

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 4.10.0
    • None
    • None
    • Puppet Developer Experience
    • 1
    • PDE 2017-01-25, PDE 2017-02-08
    • Bug Fix
    • Hide
      The metadata.json in each module was parsed multiple times and the logic involved an extra check for existance of the metadata.json file. This is now changed. This will have a small positive impact on performance in large environments with many modules and in virtual environments as it reduces the number of calls to 'stat'.
      Show
      The metadata.json in each module was parsed multiple times and the logic involved an extra check for existance of the metadata.json file. This is now changed. This will have a small positive impact on performance in large environments with many modules and in virtual environments as it reduces the number of calls to 'stat'.
    • No Action
    • internal changes, covered by existing tests

    Description

      When an instance of class Puppet::Module is created, the initialize method will first call has_metadata? to check if the metadata.json file is present and valid. This method will do a full parse of the file to check its validity. Next, the initializer will call the method load_metadata. It parses the same file once again.

      Suggestion:

      1. Add a validity check to the load_metadata method by adding a begin/rescue around its PSON.parse
      2. Remove the call to has_metadata? from the initialize method

      Attachments

        Activity

          People

            Unassigned Unassigned
            thomas.hallgren Thomas Hallgren
            John Duarte John Duarte
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support