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

Relationship with a parameter does not work

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 3.8.0, PUP 4.0.0
    • PUP 4.3.0
    • Compiler, Language
    • None
    • 1
    • Language 2015-08-05
    • Bug Fix
    • When giving a resource reference such as Notify['x'] as an attribute value in a resource or class it was not possible to form a relationship with this value.

    Description

      Test.pp:

      notify {
        '1':
      }
       
      define mynotify(Type[Notify] $req) {
        notify {
          $title:
        }
        $req -> Mynotify[$title]
      }
       
      mynotify {
        '2':
          req => Notify['1']
      }
      
      

      Expected:

      Relationship works: Notify['1'] is triggered before Notify['2']

      Result:

      puppet apply test.pp
      Error: Evaluation Error: Illegal relationship operand, can not form a relationship with an Object. A Catalog type is required. at /root/test.pp:9:8 on node foo
      

      Workaround:

      notify {
        '1':
      }
       
      define mynotify(String $prereq) {
        $req = Notify[$prereq] 
        notify {
          $title:
        }
        $req -> Mynotify[$title]
      }
       
      mynotify {
        '2':
          prereq => '1'
      }
      

      Notice: Compiled catalog for foo in environment production in 0.48 seconds
      Notice: 1
      Notice: /Stage[main]/Main/Notify[1]/message: defined 'message' as '1'
      Notice: 2
      Notice: /Stage[main]/Main/Mynotify[2]/Notify[2]/message: defined 'message' as '2'
      Notice: Applied catalog in 0.06 seconds
      

      Attachments

        Activity

          People

            shaigy.nixon Shaigy Nixon [X] (Inactive)
            roidelapluie Julien Pivotto
            Sean Griffin Sean Griffin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support