This feels like a beginner question so apologies to the experts out there 
reading this. Please skip to the last line of this post for the 'shortened 
version of this question'.

For my module, I believe there is a high likelihood the user may not copy a 
required source file to the module 'files' directory before applying the 
module. In this use case, we cannot version control the source file with 
the module due to constraints. As such, I would like to present a custom 
error message that clearly explains to the user what they need to do (e.g. 
You must download file X from Y and ensure it is copied to Z before doing a 
puppet run.)

I know that without this custom error message puppet will automatically 
throw an error when we try to first use the file. That said, I don't 
believe in this particular case the error message will be user friendly 
enough as it would look something like this:
 
Error: /Stage[main]/Mymodule::Install/File[/tmp/mydestinationfile.txt]: 
Could not evaluate: Could not retrieve information from environment 
production source(s) puppet:///modules/mymodule/mysourcefile.txt

To an experienced puppet user this makes perfect sense but to a puppet 
novice they may initially scratch their head wondering where 
puppet:///modules/mymodule/mysourcefile.txt would be on the file system.

I tried a few things but where I came unstuck was on how to assert against 
a file in the convention puppet:///modules/mymodule/mysourcefile.txt since 
this is not a native file representation.

TL;DR How do I output a custom error message for a failed assertion that a 
source file exists. In other words, how do I display a nice error message 
when puppet:///modules/mymodule/mysourcefile.txt does not exist

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/dccb747b-2948-4426-9b1b-5cdde0020ee3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to