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

{stdlib} : defined_with_params broken for unquoted classes

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • None
    • stdlib
    • None
    • Needs Assessment
    • Needs Assessment

    Description

      Basic Info
      Module Version: 5.1.0
      Puppet Version: 6.0.4 (Probably since 4.6.0
      OS Name/Version: Mac (Probably all)

      I want to verify that a class is defined with certain parameters.

      if defined_with_params(Class[foo], { important => true, })
      

      Desired Behavior:

      The function should return a valid result.

      Actual Behavior:

      $ cat test.pp
      class foo (
        $bar = 'a',
        $baz = 'b',
      ) {
      }
       
      class { 'foo':
        bar => 'q',
        baz => 'b',
      }
       
      warning(defined_with_params(Class['foo'], { bar => 'q', baz => 'b' }))
      $ puppet apply --noop test.pp
      Warning: Scope(Class[main]): false
      Notice: Compiled catalog for mbaur.syseleven.net in environment production in 0.05 seconds
      Notice: Applied catalog in 0.01 seconds
      

      It works, if the class is quoted:

      $ cat test.pp
      class foo (
        $bar = 'a',
        $baz = 'b',
      ) {
      }
       
      class { 'foo':
        bar => 'q',
        baz => 'b',
      }
       
      warning(defined_with_params('Class[foo]', { bar => 'q', baz => 'b' }))
      $ puppet apply --noop test.pp
      Warning: Scope(Class[main]): true
      Notice: Compiled catalog for mbaur.syseleven.net in environment production in 0.05 seconds
      Notice: Applied catalog in 0.01 seconds
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            baurmatt Matthias Baur
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support