Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-9782

Stdlib : ensure_resources function does not throw an error if dependent resource type is missing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Cannot Reproduce
    • None
    • None
    • stdlib
    • Needs Assessment
    • 35766
    • 1
    • Needs Assessment

    Description

      Basic Info
      Module Version: puppetlabs-stdlib (v6.0.0)
      Puppet Version: PE 2018, (5.5.14)
      OS Name/Version: RHEL 7 agent

      Replication...

      Install the inifile module (puppetlabs-inifile (v3.1.0)) on a Master and use the following test code to apply a file to my test agent:

      class ensurerestest{
       
      ensure_resources ('ini_setting', {'sample' => {'ensure' => 'present', 'path' => '/tmp/foo.ini', 'section' => 'bar', 'setting' => 'baz', 'value' => 'quux'}})
       
      }
      

      Next, I run the code on my agent and it applies the file just fine:

      [root@kpnk72tadahzkhg ~]# puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Retrieving locales
      Info: Loading facts
      Info: Caching catalog for kpnk72tadahzkhg.delivery.puppetlabs.net
      Info: Applying configuration version '1566905395'
      Notice: /Stage[main]/Ensurerestest/Ini_setting[sample]/ensure: created
      Notice: Applied catalog in 0.05 seconds
      

      Next, uninstall the inifile module from your Master, and remove the /tmp/foo.ini file from the agent.

      Do a puppet run and nothing happens. The file doesn't get recreated and it throws no error regarding the missing inifile resource type:

      [root@kpnk72tadahzkhg ~]# puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Retrieving locales
      Info: Loading facts
      Info: Caching catalog for kpnk72tadahzkhg.delivery.puppetlabs.net
      Info: Applying configuration version '1566907718'
      Notice: Applied catalog in 0.05 seconds
      

      Desired Behavior: Agent tries to create the resource and an error should be thrown when the infile provider isn't found, something like the classic Evaluation Error: "Error while evaluating a Function Call, Unknown resource type: 'ini_setting'"

      Actual Behavior: The agent just runs, the resource doesn't get created and no error is thrown about the missing resource type

      Attachments

        1. 201910agenttest.txt
          7 kB
        2. 201910applytest.txt
          2 kB
        3. ensure_resources.txt
          50 kB

        Issue Links

          Activity

            People

              tp Thomas Honey
              patrick.grant Patrick Grant
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support