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

Puppet::Type.type('yumrepo') wrongly reports enabled repo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 4.10.12
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Night's Watch
    • Story Points:
      1
    • Sprint:
      NW - 2019-10-02, NW - 2019-10-16, NW - 2019-10-30
    • Method Found:
      Needs Assessment
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 4.10.12
      Puppet Server Version: 2.8.1
      OS Name/Version: CentOS Linux release 7.6.1810

      I have weird behavior which occurs randomly where Puppet::Type.type('yumrepo') reports that a yum repo is enabled despite it is not.

      I'm using this fact:

      require 'puppet'
      def to_boolean(value)
        %w[absent yes true 1].include?(value.downcase)
      end
      Facter.add('enabled_repos') do
        setcode do
          repos = []
          Puppet::Type.type('yumrepo').instances.find_all do |repo|
            repo_value = repo.retrieve
            repos << repo.name if to_boolean(repo_value[repo.property(:enabled)].to_s.strip)
          end
          repos.sort
        end
      end
      

      I have a repo defined with enbled=0, ex: myrepo

      I run this loop to reproduce: 

      ( date; while :; do facter -p enabled_repos | grep -i myrepo && date && break; sleep 1; done ; yum repolist ) >enabled-repo.tmp 2>&1 &

      After few days I get:

      Mon Sep  2 03:48:12 UTC 2019
        "myrepo",
      Thu Sep  5 16:09:28 UTC 2019
      Loaded plugins: enabled_repos_upload, fastestmirror, langpacks, package_upload, product-id, search-
                    : disabled-repos, subscription-manager, tracer_upload, versionlock
      Loading mirror speeds from cached hostfile
      repo id                                              repo name                                 status
      !Centos_Centos_7_Base                             Centos_7 Base                             10,019
      !Centos_Centos_7_Extras                           Centos 7 Extras                              435
      !Centos_Centos_7_Opstools                         Centos 7 Opstools                            896
      !Centos_Centos_7_Updates                          Centos 7 Updates                           4,067
      !Centos_Centos_7_kvm-common                       Centos 7 kvm-common                           79
      !Centos_Centos_7_ovirt                            Centos 7 ovirt                               744
      !Centos_Centos_sclo                               Centos sclo                                  786
      !Centos_Centos_sclo-rh                            Centos sclo-rh                             8,444
      repolist: 25,470
      Uploading Enabled Repositories Report
      Loaded plugins: fastestmirror, langpacks, product-id, subscription-manager,
                    : versionlock
      

      myrepo is included in the fact enabled_repos but it is not enabled on the system.

      Desired Behavior:

      myrepo is not included in the fact enabled_repos. Only repos with enable=1 should be included.

      Actual Behavior:

      myrepo is included in the fact enabled_repos but it is not enabled on the system.

      I'm using foreman with katello plugin and yum subscriptions.

        Attachments

          Activity

            People

            Assignee:
            dorin.pleava Dorin Pleava
            Reporter:
            achevalet Anthony Chevalet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support