ruby - Can opscode chef perform wait until a condition becomes true? -
we have use case want chef orchestration wait until particular directory gets deleted in machine. there way achieve it?
i searched in internet , found following cookbook
i feel can used having difficulty in understanding how can use it, there no read me using it.
how can achieve it?
edit remove hold: have following recipe
execute 'making dir' command 'mkdir /tmp/test2' not_if ::file.directory?('/tmp/test1') end end reference: https://docs.chef.io/resource_common.html#not-if-examples
here, want not_if "wait until /tmp/test1 gets deleted" how chef executs "it found directory exixting did not execute resource , exited"
i need way perform wait until condition becomes true.
it's pattern i've seen time time in various cookbooks, used wait block device or mount something, or wait cloud resource. wait cookbook you've found, had dig the actual source repo on github figure out how use it. here's example:
until 'pigs fly' command '/bin/false' wait_interval 5 message 'sleeping 5 seconds , retrying' action :run end it appears call ruby's system(command) , sleep(wait_interval). hope helps!
edit: other posters have stated, if can whole thing in chef, notification directory resource , delete action better solution. asked how use wait resource, wanted answer specifically.
Comments
Post a Comment