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

Allow create_resources() to declare parameterized classes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:

      Description

      You should be able to declare parameterized classes via crete_resources().

      If you use a hash like:

      ---
      classes:
        testfoo::class2: {}
        testfoo::class1:
          require: Class['testfoo::class2']
      

      and code like:

        $classes = hiera_hash('classes')
        create_resources('class', $classes)
      

      you wind up with an error like:

      Invalid relationship: Class[testfoo::class1] { require => Class[testfoo::class2] }, because Class[testfoo::class2] doesn't seem to be in the catalog.
      

      However, specifying the hash in the manifest and using puppet apply works:

      # cat ~/test.pp
      class test1 { notify { 'test1': } }
      class test2 { notify { 'test2': } }
       
      $classhash = {
        'test1' => { 'require' => "Class[test2]" },
        'test2' => { }
      }
       
      create_resources('class', $classhash)
      # puppet apply test.pp
      Notice: Compiled catalog for pe-372-master.puppetdebug.vlan in environment production in 0.06 seconds
      Notice: test2
      Notice: /Stage[main]/Test2/Notify[test2]/message: defined 'message' as 'test2'
      Notice: test1
      Notice: /Stage[main]/Test1/Notify[test1]/message: defined 'message' as 'test1'
      Notice: Finished catalog run in 0.23 seconds
      

      QA Risk Analysis

      N/A for unreproducible bugs

        Attachments

          Activity

            People

            • Assignee:
              lee Lee Lowder
              Reporter:
              lee Lee Lowder
              QA Contact:
              Kurt Wall
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support