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

3 views
Skip to first unread message

Reid Vandewiele (JIRA)

unread,
Dec 17, 2015, 12:31:13 PM12/17/15
to puppe...@googlegroups.com
Reid Vandewiele created an issue
 
Puppet / Improvement PUP-5624
Properties (in resource types) should allow a read-only designation
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2015/12/17 9:30 AM
Priority: Normal Normal
Reporter: Reid Vandewiele

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.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 3:22:03 PM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Labels: triaged
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 3:22:03 PM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-5624
 
Re: Properties (in resource types) should allow a read-only designation

Sounds like we could generalize parameters with an attribute that states in, out, or in_out. Ping David Lutterkort (discussion about API for types and providers).

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 3:22:03 PM5/16/17
to puppe...@googlegroups.com

David Lutterkort (JIRA)

unread,
May 16, 2017, 5:14:35 PM5/16/17
to puppe...@googlegroups.com
David Lutterkort commented on Improvement PUP-5624
 
Re: Properties (in resource types) should allow a read-only designation

These sorts of designations make sense in general - the question is whether it is worth introducing them in the existing API, or if that should only be done in the new t&p API currently under design/discussion.

Geoff Nichols (JIRA)

unread,
May 25, 2017, 1:29:03 PM5/25/17
to puppe...@googlegroups.com

Geoff Nichols (JIRA)

unread,
May 25, 2017, 1:29:03 PM5/25/17
to puppe...@googlegroups.com

Adam Buxton (JIRA)

unread,
Sep 7, 2017, 9:27:02 AM9/7/17
to puppe...@googlegroups.com
Adam Buxton commented on Improvement PUP-5624
 
Re: Properties (in resource types) should allow a read-only designation

David Schmitt Reid and the rest of the coherent thinking universe beat me too it Jeremy Adams too as of interest.

As a personal opinion I think RO attributes should appear in the RAL code, but should be pre commented or flagged i.e
file

{ '/path': ensure => file, #type => file, }

David Schmitt (JIRA)

unread,
Sep 7, 2017, 9:30:03 AM9/7/17
to puppe...@googlegroups.com
David Schmitt commented on Improvement PUP-5624

David Lutterkort I like the idea for this to affect puppet resource output, and it would provide a venue to make the additional information in the Resource API useful to a wider audience (not only the developer).

Jeremy Adams (JIRA)

unread,
Sep 7, 2017, 9:36:03 AM9/7/17
to puppe...@googlegroups.com
Jeremy Adams commented on Improvement PUP-5624

The approach suggested by Adam Buxton above for ((puppet resource}} would be a huge improvement for the new user trying to learn how to write DSL as it would keep them from trying to manage readonly attributes.

David Lutterkort (JIRA)

unread,
Sep 8, 2017, 8:54:03 PM9/8/17
to puppe...@googlegroups.com

I think this would be a nice addition to the output format, though I feel we need two different output formats: one, puppety + human-readable with niceties like outlined above, and one that's machine-readable that includes all attributes to give consumers the full view of a resource (while type => file is not something you want to cut and paste into a manifest, it's something that you'd want to store in a DB where you query resources)

Adam Buxton (JIRA)

unread,
Sep 9, 2017, 1:11:03 AM9/9/17
to puppe...@googlegroups.com
Adam Buxton commented on Improvement PUP-5624

David Lutterkort I feel the above does both, the RAL when queried returns all available default attributes in human readable Puppet DSL which is effectively just machine readable JSON. The point of the request is to allow 'type=> file' and such attributes to be cut and pasted into a manifest as we see this is something users want to do, they want to know from a documentation stand point what the other attributes are, or were at the point the overwrote them. But today unless you have an in-depth knowledge of the resource, attributes it is a stumbling block to adoption of resources. IMHO i don't see any need or value in a second format just additional complexity and maintenance for us.
if we wanted to take this to another level we possibly would highlight mandatory fields these are programmatically discoverable and the namevar too. (that's not a request just a thought) What we want to be able to succeed in doing is lower the barrier to entrys and adoption.

Josh Cooper (Jira)

unread,
Jan 27, 2021, 2:18:03 AM1/27/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
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}}.

{code}
newproperty(:minute, :
ready_only read_only => true)
{code}


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.
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages