Chef not run if on same version -


i have cookbook installs software package source. version 1.0.0, when run chef-client cookbook installed on itself. not want happen. want cookbook run if cookbook not installed or version has changed, example 1.0.1.

how can make happen?

thanks

this not how chef works. cookbook executed, if included in run list.

however, isn't problem, long cookbook idempotent (only changes things aren't in desired state).

edit: in order make code idempotent, here's small tutorial using guards:

assuming have following resource, installs software called xyz /usr/local/xyz-1.0.0(for version 1.0.0):

execute "compile-xyz"   command "./configure && make && make install"   pwd node['xyz']['download_path'] end 

you can prevent executing adding not_if argument checking presence of /usr/local/xyz-1.0.0:

execute "compile-xyz"   command "./configure && make && make install"   pwd node['xyz']['download_path']   not_if ::file.directory?("/usr/local/xyz-#{node['xyz']['version']}/") end end 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -