Groups
Groups
Sign in
Groups
Groups
Puppet Users
Conversations
About
Send feedback
Help
How to make a module reject invalid parameter
57 views
Skip to first unread message
Philip Brown
unread,
Sep 25, 2012, 11:57:36 AM
9/25/12
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
I tried a few google searches on this, and attempted to look through
docs.puppetlabs.com
, but couldnt find anything...
how do you make a module throw an error for an unrecognized parameter?
ie:
class setitup($machtype) {
case $machtype {
prod: { blah}
dev: {blah}
default: { error Unrecognized machtype parameter value }
}
}
windowsrefund
unread,
Sep 25, 2012, 12:14:11 PM
9/25/12
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
if !$foo {
fail 'foo is missing'
}
Justin Stoller
unread,
Sep 25, 2012, 1:15:03 PM
9/25/12
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
I think you'll have better luck in the standard library:
https://github.com/puppetlabs/puppetlabs-stdlib
Specifically the validate_*, type, member, and is_* functions are all
for helping validate parameters. Documentation is the in the Readme
and pretty good.
HTH,
Justin
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/puppet-users/-/_8zyA3QImNcJ
.
> To post to this group, send email to
puppet...@googlegroups.com
.
> To unsubscribe from this group, send email to
>
puppet-users...@googlegroups.com
.
> For more options, visit this group at
>
http://groups.google.com/group/puppet-users?hl=en
.
Reply all
Reply to author
Forward
0 new messages