Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the chef execute resource, what does the "creates" parameter do?

Tags:

chef-infra

In the chef execute resource, the "creates" property/parameter... what does that do exactly? I'm sure it's straightforward, but can someone explain please? Thank you.

https://docs.chef.io/resource_execute.html

creates Ruby Type: String Prevent a command from creating a file when that file already exists.

like image 590
Johnny5 Avatar asked Sep 04 '25 02:09

Johnny5


2 Answers

It tests for the file that is specified before running the execute. If the file already exists, it will not run that execute. If the file does not exist, it will run the execute.

like image 140
Cody Avatar answered Sep 07 '25 18:09

Cody


creates "/foo" is equivalent to not_if { File.exist?("/foo") }.

like image 45
coderanger Avatar answered Sep 07 '25 19:09

coderanger