Can data type validation reference a variable for the possible enum values?
78 views
Skip to first unread message
David Karr
unread,
May 20, 2016, 2:23:56 PM5/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Puppet Users
Reading through "Learning Puppet 4", I noticed the ability to define parameter types with pretty specific constraints, like "Enum['foo','bar']", et cetera.
Is there any way for the list of possible enum values to be specified elsewhere and then referenced in the type specification?
Henrik Lindberg
unread,
May 22, 2016, 8:43:54 PM5/22/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Yes, we added type aliases to the language:
type MyModule::MyEnum = Enum['foo', 'bar', 'fee', 'fum']
Which is stored in your module under <root>/types/myenum.pp and should
contain that type alias alone.