Information Technology Reference
In-Depth Information
or, for Windows Command Prompt:
> more %USERPROFILE%\stone.txt
Written in stone
Try running chef-apply using the same stone.rb recipe one more time. You should notice
that the output is a little different executing the same recipe for the second time.
Linux/Mac OS X:
$ sudo chef-apply stone.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* file[/Users/misheska/stone.txt] action create (up to date)
Windows (Run As Administrator):
> chef-apply stone.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* file[C:/Users/misheska/stone.txt] action create (up to date)
chef-apply reports that file[...stone.txt] action create is up to date and that no ac-
tion was performed. This is a good example of how chef-apply behaves differently depend-
ing on the machine's state. Chef performs actions autonomously without being explicitly told
to do so:
▪ If stone.txt does not exist, chef-apply creates the file with the appropriate content.
▪ If stone.txt already exists, chef-apply will do nothing.
Do you think that chef-apply is smart enough to detect someone tampering with file con-
tent outside of Chef? Let's try an experiment. Change the contents of stone.txt with the fol-
lowing command for Linux/Mac OS X:
$ sudo sh -c 'echo "Modifying this file written in stone" > $HOME/stone.txt'
For Windows Command Prompt:
> echo Modifying this file written in stone > %USERPRFOILE%\stone.txt
Search WWH ::




Custom Search