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

Ruby file gets loaded twice

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.15.0
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Night's Watch
    • Story Points:
      3
    • Sprint:
      NW - 2020-04-15
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      The 'gem' package provider's ruby file was getting loaded twice and causing undesired warnings at each puppet run. This was happening due to an unnecessary file requirement which is now removed.
    • QA Risk Assessment:
      Needs Assessment

      Description

      The provider/package/gem.rb file gets loaded twice. This prevents us from having constant variables without getting the following warnings at each run:
      /Users/luchi/repos/puppet/lib/puppet/provider/package/gem.rb:21: warning: already initialized constant MY_CONSTANT_VARIABLE
      /Users/luchi/repos/puppet/lib/puppet/provider/package/gem.rb:21: warning: previous definition of MY_CONSTANT_VARIABLE was here

      This happens due to the require done in provider/package/puppet_gem.rb and then loaded again in util/autoload.rb. This can be seen by putting a 'puts(caller)' in provider/package/gem.rb.

      After fixing the issue, a refactoring should be done inĀ provider/package/gem.rb to use (for better code readability):

      GEM_VERSION = Puppet::Util::Package::Version::Gem
      GEM_VERSION_RANGE = Puppet::Util::Package::Version::Range

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              luchian.nemes Luchian Nemes
              Reporter:
              luchian.nemes Luchian Nemes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support