From: Jason H. <jh...@ap...> - 2011-07-12 20:48:22
|
On Jul 12, 2011, at 10:38 AM, Johnston, Nathaniel wrote: > I have a configuration I am working on that will set up /etc/snmpd.conf on some of my hosts. In order for me to properly set the SNMP trap destinations using the "trapsink" directive, I need to call out to an external resource. In the event that the external resource call fails for whatever reason, I do not want Etch to take action for that run. What is the proper way in my script to indicate "An error occurred, do not etch this particular /etc/snmpd.conf" in a graceful manner? Add nothing to @contents. If nothing is added to @contents then etch will skip the file. So for example, instead of this: @contents << "First line" @contents << `something that might break` Do something like this: externalbits = `something that might break` if externalbits @contents << "First line" @contents << externalbits end That way if your external resource fails nothing gets added to @contents. Jason |