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

Relationship with a parameter does not work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.8.0, PUP 4.0.0
    • Fix Version/s: PUP 4.3.0
    • Component/s: Compiler, Language
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2015-08-05
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      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

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

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support