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

'ensure' parameter is always treated as if it were a property

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: PUP 2.7.23, PUP 3.7.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Puppet (since at least 2.6.0; I've marked the earliest and latest available released versions as affected) considers any parameter named 'ensure' on a type to be a property that can be synced. While this is true for all built-in types, it is not generally true. A property is a special type of parameter, and if 'ensure' is not a property, then Ruby will throw undefined method exceptions in at least two different places in the code because Puppet assumes that methods defined by Puppet::Property are available.

      A real-world use case where it makes sense to have an 'ensure' parameter which is not a property is a type that exists only to generate additional resources on the agent. For example, we have a custom type (Gen_file) that has a 'command' parameter, runs this command on the agent, and generates a File resource with the command output as its contents. Gen_file itself has no syncable state, so it makes no sense for it to have properties, but it does have an 'ensure' parameter whose value is passed onto the generated File resource's 'ensure' property.

      I intend to submit a pull request to fix this behaviour shortly, which will highlight the specific parts of the code where this assumption is made.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                anchor Anchor
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support