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

Overriding attributes of defined types doesn't work through the ENC

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 3.4.2, PUP 4.2.0
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Environment:
    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      2

      Description

      Consider the following setup, with a defined type and two classes:

      define defined_type_test($value) {
        notify { "message_${title}":
          message => $value,
        }
      }
       
      class base {
        defined_type_test { 'foo':
          value => 'Original Message',
        }
      }
       
      class override {
        Defined_type_test <| title == 'foo' |> {
          value => 'Overridden Message',
        }
      }
      

      When both classes are called via 'node default', it works as expected – The 'message_foo' notify emits 'Overridden Message'.

      However, when the class 'base' is called via 'node default', and the class 'override' is called via the ENC, 'message_foo' emits 'Original Message'. The 'override' class is definitely being executed; other resources added to the class are applied without issues.

      Likewise, only resources that are instances of defined types are affected. Overriding an attribute of a 'real' type works fine from a class called via the ENC.

      As best I can tell, this only occurs when all of the following are true:

      • You're attempting to override an attribute on a resource that is an instance of a defined type
      • The resource is created in a class that is called via manifests/site.pp
      • The collector to override the attribute is in a class that is called via the ENC (not necessarily directly; this also holds if an intermediate class is called from the ENC, which in turn calls the class containing the override)

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  eric.sorenson Eric Sorenson
                  Reporter:
                  samcannell Sam Cannell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support