The first part, making sure that the allowed values for a class
parameter are declared is simply done with the puppet type system
class example(Enum[red, blue, green] $color) { ... }
The type information should be available to the pe services that queries
for all classes and their parameters. The question is what it
(pe-console) can do with that information.
It gets somewhat complicated in that the types may be something other
than a simple enumeration and the logic added to pe-console would
naturally need to handle those cases gracefully. The type information
may also be based on custom types, and those will require loading of
those to fully understand what they mean. This because a definition like
this:
type PrimaryColor = Enum[red, blue, green]
can be autoloaded, and the class parameter could be declared like this:
class example(PrimaryColor $color) { ... }
One alternative way of implementing that in pe-console is to have the
service precompute those cases where value is a simple "multiple choice"
- that may have a performance impact though as it would require
computing it for all parameters in every class.
Another way would be to have a service that for a given environment an
answer if a parameter's type results in a static "multiple choice".
yet another way would be to have a service that validates what the user
entered against the type. The error message would state what the valid
options are, or where it went wrong. Something like this would then
also handle types that are based on patterns.
Hope that provides you with some ideas.
Best,
- henrik
> Thanks,
> James
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
puppet-users...@googlegroups.com
> <mailto:
puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/puppet-users/87cf8470-953d-4362-8efa-f38171e5cf48%40googlegroups.com
> <
https://groups.google.com/d/msgid/puppet-users/87cf8470-953d-4362-8efa-f38171e5cf48%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/