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

Check if package is installed before enforcing configured version

    XMLWordPrintable

Details

    • New Feature
    • Status: Resolved
    • Normal
    • Resolution: Won't Fix
    • None
    • None
    • Types and Providers
    • Night's Watch
    • NW - 2020-08-18, NW - 2020-09-01, NW - 2020-09-16, NW - 2020-09-30
    • 40361
    • 1
    • Needs Assessment

    Description

      Customer has asked me to create a feature request to allow them to check if a package is installed before puppet enforces the configured version.

      For example, customer would like to be able to do something like this:

      $packages =

      {   'puppet' => \{ ensure => '6.14.0-1.el7' }

      ,
        'ntp' => { ensure => '1.5.3-1' },
      }

      keys($pkg_hash).each |Integer $index, String $pkg| {
        if ! $facts['_puppet_inventory_1']['packages'][$pkg]['1']

      {     $upgrade=undef   }

        elsif versioncmp($facts['_puppet_inventory_1']['packages'][$pkg]['1'], ${attributes['ensure']}) == "1"

      {     $upgrade=False   }

        elsif versioncmp($facts['_puppet_inventory_1']['packages'][$pkg]['1'], ${attributes['ensure']}) == "-1"

      {     $upgrade=True   }

      if ($upgrade == undef) or ($upgrade) {
        package

      { $pkg:     ensure => $attributes['ensure'],   }

      }
      }

       

      Attachments

        Issue Links

          Activity

            People

              luchian.nemes Luchian Nemes
              corey.benefrayim Corey Benefrayim
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support