Information Technology Reference
In-Depth Information
NOTE
Sharp-eyed readers might wonder how we could get away with using the $HOME reference
if you are using the Windows Command Prompt. If you try to echo %HOME% using the
Windows Command Prompt, you'll discover the environment variable doesn't exist. By
default on Windows, internally Chef uses PowerShell to evaluate command-line referen-
ces, even when you run Chef on the Windows Command Prompt. PowerShell is more
Unix-like than the Windows Command Prompt, so Chef uses PowerShell by default.
Now that we've explained the changes to the source, run your Chef code using chef-apply
on a command line. The output should resemble, for Linux/Mac OS X:
$ sudo chef-apply stone.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* file[/Users/misheska/stone.txt] action create
- create new file /Users/misheska/stone.txt
- update content in file /Users/misheska/stone.txt from none to ba4fda
--- /Users/misheska/stone.txt 2014-08-10 22:33:40.000000000 -0700
+++ /tmp/.stone.txt20140810-14302-1nfmi0r 2014-08-10 22:33:40.000000000
-0700 @@ -1 +1,2 @@
+Written in stone
For Windows (Run As Administrator):
> chef-apply stone.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* file[C:/Users/misheska/stone.txt] action create
- create new file C:/Users/misheska/stone.txt
- update content in file C:/Users/misheska/stone.txt from none to ba4fda
--- C:/Users/misheska/stone.txt 2014-07-11 15:48:46.000000000 -0700
+++ C:/Users/misheska/AppData/Local/Temp/stone.txt20140711-2232-1wpswfb
@@ -1 +1,2 @@
+Written in stone
Now the file stone.txt should be created in your home directory with the content Written in
stone . Verify with the following command for Linux/Mac OS X/Windows PowerShell:
$ more $HOME/stone.txt
Written in stone
Search WWH ::




Custom Search