Action
This section describes all available actions for the window_defender_exlusion resource.
- :add - It is the default action.
- :nothing - This action will let the resource until it gets confirmation from the other resource. Once it gets notified, it might run or queue for the run.
- :remove - This action removes the resource.
Properties
Now we will discuss the properties available in the window_defender_exlusion resource
- paths - To exclude file or directory paths from scanning. Paths ruby type is String, array, and the default is [ ].
- extensions - To exclude file extensions from scanning. Extensions ruby type is String, array, and the default is [ ].
- process_paths - To exclude process paths from scanning. Process paths ruby type is String, array, and the default is [ ].
Common properties
Some common properties we can apply to available resources in chef infra client.
- ignore_fiaiure - To ignore a failure.
- retires - To catch a number of exceptions and retry resources.
- retry_delay - Add’s delay during the execution.
- sensitive - To check if the chef infra client logs in sensitive data.
- Compile_time - Control the stage of the node's resource execution.
Notification
Type of notification methods we can use in the scripts.
notifies: notifies let you notify another resource to take action if there is a change in its state.
Syntax:
notifies :action, 'resource[name]', :timer
Just specify an action, resource name, and time for the notification.
Types of timer:
- :before - It notify to execute an action in a resource before processing.
- :delayed - It notify to queued and run at the end.
- :immediate and :immediately - It notifies to run immediately.
subscribe: This lets the resource listen to a particular resource and works if there is a change in the state of the listening resource.
Syntax:
subscribe :action, 'resource[name]', :timer
Just specify an action, resource name, and time for the notification.
Types of timer:
- :before - It notify to execute an action in a resource before processing.
- :delayed - It notify to queued and run at the end.
- :immediate and :immediately - It notifies to run immediately.
Guard
- During the execution stage of a Chef Infra Client run, the condition of a node can be assessed using a guard property.
- A guard property is then used to inform Chef Infra Client whether it should keep running a resource in response to the findings of this assessment.
- A Ruby block value and a string value are acceptable values for a guard property.
Properties
not_if - to stop the execution if the given condition is true.
only_if - to execute a resource if the condition is true.
Frequently Asked Questions
What is a window defender?
A window defender is a system software to protect from malware.
What is the role of extensions in the window_defender_exlusion resource?
The extensions let you declare what type of file extensions, for ex: png, we should exclude in protection scanning.
Can we set the timer for the notification?
Yes, we can set the notification according to our need using :before, :delayed, and :immediately tag.
What if we don't declare the type of action in window_defender_exlusion?
The default value for action is :add.
What is the ruby type for properties in window_defender_exlusion resource?
String and array is the type for window_defender_exlusion properties.
Conclusion
In this blog, we learned about one of the resources, window_defender_exlusion, available in chef. We discussed the syntax of window_defender_exlusion and various properties and actions available for the window_defender_exlusion resource.
To learn more about chefs, check out the articles given below:
CHEF- RESOURCES -windows_defender Resource
CHEF RESOURCES -windows_password_policy Resource
CHEF RESOURCES -windows_desktop_winrm_settings Resource
CHEF- RESOURCES -rescue_account Resource
To learn more about DSA, competitive coding, and many more knowledgeable topics, please look into the guided paths on Coding Ninjas Studio. Also, you can enroll in our courses and check out the mock test and problems available to you. Please check out our interview experiences and interview bundle for placement preparations.