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

Shadow fact / plan variable collisions in PAL catalog compiler

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 7.0.0, PUP 6.20.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Shadow fact/variable collisions in PAL catalog compiler.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Current Behavior

      **When Bolt runs an apply block in a plan, it uses PAL to compile a catalog. Before calling PAL.with_catalog_compiler, Bolt detects any collisions between facts, target vars, and plan vars, and shadows them as needed (see https://github.com/puppetlabs/bolt/blob/main/lib/bolt/catalog.rb#L71-L88) . However, this can cause a potential problem when plan variables are using local references. If plan variable $bar has a reference to plan variable $foo, and the target has a fact foo, Bolt will shadow the plan variable $foo. When the variables are passed on to the catalog compiler, PAL will be unable to deserialize the plan variables as the local reference for $bar is no longer valid (see https://github.com/puppetlabs/bolt/issues/2111). 

       

      Desired Behavior

      Shadowing variables that collide with facts of the same name should not result in PAL being unable to deserialize plan variables due to a missing local reference. Because FromDataConverter assumes that the data it receives comes directly from ToDataConverter, the serialized plan variables should be passed as-is to the catalog compiler where they can be deserialized. After the plan variables are deserialized, PAL should then shadow any variables that collide with facts of the same name (and warn when this happens).

       

        Attachments

          Activity

            People

            Assignee:
            thomas.beech Tom Beech
            Reporter:
            thomas.beech Tom Beech
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support