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

Properties (in resource types) should allow a read-only designation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
    • Template:
    • Team:
      Coremunity

      Description

      Properties exist which are read-only. Examples include the "mtime" property of the File resource and the "power_state" property of the Vsphere_vm resource.

      Today, these read-only properties are implemented by making the validate method fail. This is a hack.

      In order to support better automatic documentation and validation there should exist a way to designate a property as read-only when defining them. A possible implementation would be a flag that can be passed when defining the property, similar to :array_matching.

      newproperty(:minute, :ready_only => true)
      

      A property defined as read-only should not need a custom validate function, and it should be possible to enumerate read-only properties for a type so as to separate them from read-write properties. This can be useful in auto documentation, pretty-print generation of Puppet code, or editing tools that integrate with Puppet's RAL.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            reid Reid Vandewiele
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support