Which attribute would you include in an exec resource to ensure it runs only when notified?

Prepare for the Puppet Certified Professional Test with flashcards and multiple choice questions, each with hints and explanations. Gear up for your exam!

The attribute that ensures an exec resource runs only when notified is the refreshonly attribute. When this attribute is set to true, the resource does not execute its command under normal circumstances. Instead, it will only run when another resource in the Puppet manifest sends a notification to it, indicating that it should execute.

This behavior is particularly useful in scenarios where you want to control when a resource should be executed, often in response to changes happening elsewhere in your system. By utilizing refreshonly, you can prevent unnecessary executions that could lead to inefficient use of resources or unintended consequences.

In contrast, the other attributes would not fulfill this requirement as effectively. The onlyif and unless attributes allow the exec resource to evaluate a condition before execution, determining if it should run based on the result of a command. The creates attribute checks for the existence of a specified file or directory before running the command, allowing the resource to execute only if that file doesn’t exist. Neither of these approaches inherently ties the execution of the resource to notifications from other resources.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy