diff options
author | sersut <serdar@opscode.com> | 2013-10-31 14:01:01 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-10-31 14:01:01 -0700 |
commit | d31c7bce0d17ca63950e20448da31f10d49d0231 (patch) | |
tree | 652ab43675bddcdcd957c796259d682bbbe973c5 | |
parent | ea78d04813138e6f82c4cac5e237064d800a479a (diff) | |
parent | ef28b792794752a7ab0a518057eb6fd809363f51 (diff) | |
download | chef-d31c7bce0d17ca63950e20448da31f10d49d0231.tar.gz |
Merge branch '11-stable'
Conflicts:
lib/chef/config.rb
42 files changed, 435 insertions, 215 deletions
diff --git a/chef-x86-mingw32.gemspec b/chef-x86-mingw32.gemspec index 8e59f8257f..2d7871b57f 100644 --- a/chef-x86-mingw32.gemspec +++ b/chef-x86-mingw32.gemspec @@ -4,7 +4,6 @@ gemspec = eval(IO.read(File.expand_path("../chef.gemspec", __FILE__))) gemspec.platform = "x86-mingw32" gemspec.add_dependency "mixlib-shellout", "1.2.0" -gemspec.add_dependency "systemu", "2.5.2" # CHEF-3718 gemspec.add_dependency "ffi", "1.3.1" gemspec.add_dependency "rdp-ruby-wmi", "0.3.1" gemspec.add_dependency "windows-api", "0.4.2" diff --git a/distro/common/html/chef-client.8.html b/distro/common/html/chef-client.8.html index b2e21a6c56..abb9b8313c 100644 --- a/distro/common/html/chef-client.8.html +++ b/distro/common/html/chef-client.8.html @@ -124,9 +124,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with +manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with help2man. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -135,7 +135,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-client(8)</li> </ol> diff --git a/distro/common/html/chef-expander.8.html b/distro/common/html/chef-expander.8.html index 31b0b21407..ac7c0dac2c 100644 --- a/distro/common/html/chef-expander.8.html +++ b/distro/common/html/chef-expander.8.html @@ -143,9 +143,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was created by Nuo Yan <a href="mailto:nuo@opscode.com" data-bare-link="true">nuo@opscode.com</a>. Permission is +manual page was created by Nuo Yan <a href="mailto:nuo@opscode.com" data-bare-link="true">nuo@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -154,7 +154,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-expander(8)</li> </ol> diff --git a/distro/common/html/chef-expanderctl.8.html b/distro/common/html/chef-expanderctl.8.html index 8e4cc64c20..3fbcf1e898 100644 --- a/distro/common/html/chef-expanderctl.8.html +++ b/distro/common/html/chef-expanderctl.8.html @@ -125,9 +125,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was created by Nuo Yan <a href="mailto:nuo@opscode.com" data-bare-link="true">nuo@opscode.com</a>. Permission is +manual page was created by Nuo Yan <a href="mailto:nuo@opscode.com" data-bare-link="true">nuo@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -136,7 +136,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-expanderctl(8)</li> </ol> diff --git a/distro/common/html/chef-server-webui.8.html b/distro/common/html/chef-server-webui.8.html index 004a6536cb..9b85f9869e 100644 --- a/distro/common/html/chef-server-webui.8.html +++ b/distro/common/html/chef-server-webui.8.html @@ -163,9 +163,9 @@ is located on the Chef wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with +manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with help2man for the Debian project (but may be used by others). Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -175,7 +175,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-server-webui(8)</li> </ol> diff --git a/distro/common/html/chef-server.8.html b/distro/common/html/chef-server.8.html index e3741a9f9c..63c3eaf7db 100644 --- a/distro/common/html/chef-server.8.html +++ b/distro/common/html/chef-server.8.html @@ -161,9 +161,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with +manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with help2man. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -172,7 +172,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-server(8)</li> </ol> diff --git a/distro/common/html/chef-shell.1.html b/distro/common/html/chef-shell.1.html index 3f2db2217c..f80172667a 100644 --- a/distro/common/html/chef-shell.1.html +++ b/distro/common/html/chef-shell.1.html @@ -260,13 +260,13 @@ libraries.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community. chef-shell was written by Daniel DeLeo.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. +<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -276,7 +276,7 @@ libraries.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-shell(1)</li> </ol> diff --git a/distro/common/html/chef-solo.8.html b/distro/common/html/chef-solo.8.html index bcbc00d043..1543e2fa07 100644 --- a/distro/common/html/chef-solo.8.html +++ b/distro/common/html/chef-solo.8.html @@ -164,9 +164,9 @@ http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with +manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with help2man. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -175,7 +175,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-solo(8)</li> </ol> diff --git a/distro/common/html/chef-solr.8.html b/distro/common/html/chef-solr.8.html index 785b870904..c3153d8f76 100644 --- a/distro/common/html/chef-solr.8.html +++ b/distro/common/html/chef-solr.8.html @@ -144,9 +144,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode +<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode (http://www.opscode.com), with contributions from the community. This -manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with +manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with help2man. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> @@ -155,7 +155,7 @@ found in /usr/share/common-licenses/Apache-2.0.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>chef-solr(8)</li> </ol> diff --git a/distro/common/html/knife-bootstrap.1.html b/distro/common/html/knife-bootstrap.1.html index f3b14b0095..3fc53eb2f8 100644 --- a/distro/common/html/knife-bootstrap.1.html +++ b/distro/common/html/knife-bootstrap.1.html @@ -218,11 +218,11 @@ to other users via the process list using tools such as <span class="man-ref">ps <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -231,7 +231,7 @@ to other users via the process list using tools such as <span class="man-ref">ps <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-bootstrap(1)</li> </ol> diff --git a/distro/common/html/knife-client.1.html b/distro/common/html/knife-client.1.html index fb93214e1e..bcf03cb884 100644 --- a/distro/common/html/knife-client.1.html +++ b/distro/common/html/knife-client.1.html @@ -196,11 +196,11 @@ setting up a host for management with Chef.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -209,7 +209,7 @@ setting up a host for management with Chef.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-client(1)</li> </ol> diff --git a/distro/common/html/knife-configure.1.html b/distro/common/html/knife-configure.1.html index cbb55f4e13..91b20628ca 100644 --- a/distro/common/html/knife-configure.1.html +++ b/distro/common/html/knife-configure.1.html @@ -147,11 +147,11 @@ may need to modify that setting after copying to a remote host.</p></li> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -160,7 +160,7 @@ may need to modify that setting after copying to a remote host.</p></li> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-configure(1)</li> </ol> diff --git a/distro/common/html/knife-cookbook-site.1.html b/distro/common/html/knife-cookbook-site.1.html index 334b875186..7750843314 100644 --- a/distro/common/html/knife-cookbook-site.1.html +++ b/distro/common/html/knife-cookbook-site.1.html @@ -218,11 +218,11 @@ configuration file.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -231,7 +231,7 @@ configuration file.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-cookbook-site(1)</li> </ol> diff --git a/distro/common/html/knife-cookbook.1.html b/distro/common/html/knife-cookbook.1.html index 444ff96c94..3dbf299226 100644 --- a/distro/common/html/knife-cookbook.1.html +++ b/distro/common/html/knife-cookbook.1.html @@ -358,11 +358,11 @@ cookbook.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -371,7 +371,7 @@ cookbook.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-cookbook(1)</li> </ol> diff --git a/distro/common/html/knife-data-bag.1.html b/distro/common/html/knife-data-bag.1.html index 18244f67f1..10edd68c45 100644 --- a/distro/common/html/knife-data-bag.1.html +++ b/distro/common/html/knife-data-bag.1.html @@ -212,11 +212,11 @@ encryption keys.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -225,7 +225,7 @@ encryption keys.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-data-bag(1)</li> </ol> diff --git a/distro/common/html/knife-environment.1.html b/distro/common/html/knife-environment.1.html index 917604726e..b0465b29b6 100644 --- a/distro/common/html/knife-environment.1.html +++ b/distro/common/html/knife-environment.1.html @@ -242,11 +242,11 @@ override_attributes "aws_s3_bucket" => "production" <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. +<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -255,7 +255,7 @@ override_attributes "aws_s3_bucket" => "production" <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-environment(1)</li> </ol> diff --git a/distro/common/html/knife-exec.1.html b/distro/common/html/knife-exec.1.html index 0365ebd31e..0ce454fc27 100644 --- a/distro/common/html/knife-exec.1.html +++ b/distro/common/html/knife-exec.1.html @@ -111,11 +111,11 @@ description of the commands available.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -124,7 +124,7 @@ description of the commands available.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-exec(1)</li> </ol> diff --git a/distro/common/html/knife-index.1.html b/distro/common/html/knife-index.1.html index d797dd7840..a691980101 100644 --- a/distro/common/html/knife-index.1.html +++ b/distro/common/html/knife-index.1.html @@ -102,11 +102,11 @@ time for all objects to be indexed and available for search.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -115,7 +115,7 @@ time for all objects to be indexed and available for search.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-index(1)</li> </ol> diff --git a/distro/common/html/knife-node.1.html b/distro/common/html/knife-node.1.html index b9a7f187a8..6a399c96de 100644 --- a/distro/common/html/knife-node.1.html +++ b/distro/common/html/knife-node.1.html @@ -227,11 +227,11 @@ run list, the correct syntax is "role[ROLE_NAME]"</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -240,7 +240,7 @@ run list, the correct syntax is "role[ROLE_NAME]"</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-node(1)</li> </ol> diff --git a/distro/common/html/knife-role.1.html b/distro/common/html/knife-role.1.html index 4e0f9359de..62a6b4abf4 100644 --- a/distro/common/html/knife-role.1.html +++ b/distro/common/html/knife-role.1.html @@ -177,11 +177,11 @@ run_list.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -190,7 +190,7 @@ run_list.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-role(1)</li> </ol> diff --git a/distro/common/html/knife-search.1.html b/distro/common/html/knife-search.1.html index e331128f4f..3626259f9b 100644 --- a/distro/common/html/knife-search.1.html +++ b/distro/common/html/knife-search.1.html @@ -265,11 +265,11 @@ www.example.com:</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -278,7 +278,7 @@ www.example.com:</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-search(1)</li> </ol> diff --git a/distro/common/html/knife-ssh.1.html b/distro/common/html/knife-ssh.1.html index 5c4e1f449a..944f6bb93a 100644 --- a/distro/common/html/knife-ssh.1.html +++ b/distro/common/html/knife-ssh.1.html @@ -133,11 +133,11 @@ option.</dd> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -146,7 +146,7 @@ option.</dd> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-ssh(1)</li> </ol> diff --git a/distro/common/html/knife-status.1.html b/distro/common/html/knife-status.1.html index 363b17724b..e012d22976 100644 --- a/distro/common/html/knife-status.1.html +++ b/distro/common/html/knife-status.1.html @@ -105,11 +105,11 @@ may not be publicly reachable.</p> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -118,7 +118,7 @@ may not be publicly reachable.</p> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-status(1)</li> </ol> diff --git a/distro/common/html/knife-tag.1.html b/distro/common/html/knife-tag.1.html index 27205a5a20..c33b5c9871 100644 --- a/distro/common/html/knife-tag.1.html +++ b/distro/common/html/knife-tag.1.html @@ -114,11 +114,11 @@ <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. +<p> This manual page was written by Daniel DeLeo <a href="mailto:dan@opscode.com" data-bare-link="true">dan@opscode.com</a>. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p> <h2 id="CHEF">CHEF</h2> @@ -127,7 +127,7 @@ <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife-tag(1)</li> </ol> diff --git a/distro/common/html/knife.1.html b/distro/common/html/knife.1.html index 0f5376d019..464a02d7ba 100644 --- a/distro/common/html/knife.1.html +++ b/distro/common/html/knife.1.html @@ -286,12 +286,12 @@ data editing entirely.</dd> <h2 id="AUTHOR">AUTHOR</h2> -<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> of Opscode +<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> of Opscode (<a href="http://www.opscode.com" data-bare-link="true">http://www.opscode.com</a>), with contributions from the community.</p> <h2 id="DOCUMENTATION">DOCUMENTATION</h2> -<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.</p> +<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.</p> <h2 id="LICENSE">LICENSE</h2> @@ -305,7 +305,7 @@ data editing entirely.</dd> <ol class='man-decor man-foot man foot'> - <li class='tl'>Chef 11.8.0.rc.0</li> + <li class='tl'>Chef 11.8.0</li> <li class='tc'>October 2013</li> <li class='tr'>knife(1)</li> </ol> diff --git a/distro/common/man/man1/knife-diff.1 b/distro/common/man/man1/knife-diff.1 index f773820286..12fcf4bbca 100644 --- a/distro/common/man/man1/knife-diff.1 +++ b/distro/common/man/man1/knife-diff.1 @@ -111,6 +111,9 @@ This subcommand has the following options: .B \fB\-\-chef\-repo\-path PATH\fP The path to the chef\-repo. This setting will override the default path to the chef\-repo. Default: same as specified by \fBchef_repo_path\fP in config.rb. .TP +.B \fB\-\-cookbook\-version VERSION\fP +The version of a cookbook to be downloaded. +.TP .B \fB\-\-concurrency\fP The number of allowed concurrent connections. Default: \fB10\fP. .TP diff --git a/distro/common/man/man1/knife-list.1 b/distro/common/man/man1/knife-list.1 index 0314abef33..2788e5b903 100644 --- a/distro/common/man/man1/knife-list.1 +++ b/distro/common/man/man1/knife-list.1 @@ -108,6 +108,9 @@ $ knife list [PATTERN...] (options) This subcommand has the following options: .INDENT 0.0 .TP +.B \fB\-1\fP +Indicates that only one results column will be shown. +.TP .B \fB\-\-chef\-repo\-path PATH\fP The path to the chef\-repo. This setting will override the default path to the chef\-repo. Default: same as specified by \fBchef_repo_path\fP in config.rb. .TP diff --git a/distro/common/man/man1/knife-upload.1 b/distro/common/man/man1/knife-upload.1 index f7498f861c..e59f2f1c48 100644 --- a/distro/common/man/man1/knife-upload.1 +++ b/distro/common/man/man1/knife-upload.1 @@ -114,18 +114,18 @@ The path to the chef\-repo. This setting will override the default path to the c .B \fB\-\-concurrency\fP The number of allowed concurrent connections. Default: \fB10\fP. .TP -.B \fB\-\-[no\-]force\fP -Use \fB\-\-force\fP to upload roles, cookbooks, etc. even if the file in the directory is identical (by default, no \fBPOST\fP or \fBPUT\fP is performed unless an actual change would be made). Default: \fB\-\-no\-force\fP. -.TP -.B \fB\-n\fP, \fB\-\-dry\-run\fP -Indicates that no action is taken and that results are only printed out. Default: \fBfalse\fP. -.TP .B \fB\-\-[no\-]diff\fP Indicates that only new and modified files will be uploaded. Set to \fBfalse\fP to upload all files. Default: \fBtrue\fP. .TP +.B \fB\-\-[no\-]force\fP +Use \fB\-\-force\fP to upload roles, cookbooks, etc. even if the file in the directory is identical (by default, no \fBPOST\fP or \fBPUT\fP is performed unless an actual change would be made). Default: \fB\-\-no\-force\fP. +.TP .B \fB\-\-[no\-]freeze\fP Indicates that a cookbook cannot be modified; any changes to this cookbook must be included as a new version. Only the \fB\-\-force\fP option can override this setting. Default: \fBfalse\fP. .TP +.B \fB\-n\fP, \fB\-\-dry\-run\fP +Indicates that no action is taken and that results are only printed out. Default: \fBfalse\fP. +.TP .B \fB\-\-[no\-]purge\fP Use \fB\-\-purge\fP to delete roles, cookbooks, etc. from the server if their corresponding files do not exist in the chef\-repo. By default, such objects are left alone and NOT purged. Default: \fB\-\-no\-purge\fP. .TP diff --git a/distro/common/man/man1/knife-xargs.1 b/distro/common/man/man1/knife-xargs.1 index 74f7bcaaab..23e74ead94 100644 --- a/distro/common/man/man1/knife-xargs.1 +++ b/distro/common/man/man1/knife-xargs.1 @@ -108,6 +108,9 @@ $ knife xargs [PATTERN...] (options) This subcommand has the following options: .INDENT 0.0 .TP +.B \fB\-0\fP +Indicates that a \fBNULL\fP character (\fB\e0\fP) will be used as a separator, instead of white space. Default: \fBfalse\fP. +.TP .B \fB\-\-chef\-repo\-path PATH\fP The path to the chef\-repo. This setting will override the default path to the chef\-repo. Default: same as specified by \fBchef_repo_path\fP in config.rb. .TP @@ -132,9 +135,6 @@ The maximum number of arguments per command line. Default: \fBnil\fP. .B \fB\-s LENGTH\fP, \fB\-\-max\-chars LENGTH\fP The maximum size (in characters) for a command line. Default: \fBnil\fP. .TP -.B \fB\-0\fP -Indicates that a \fBNULL\fP character (\fB\e0\fP) will be used as a separator, instead of white space. Default: \fBfalse\fP. -.TP .B \fB\-p [PATTERN...]\fP, \fB\-\-pattern [PATTERN...]\fP One (or more) patterns for a command line. If this option is not specified, a list of patterns may be expected on standard input. Default: \fBnil\fP. .TP diff --git a/distro/common/man/man8/chef-solo.8 b/distro/common/man/man8/chef-solo.8 index b3ee9a0a5d..541e7b6912 100644 --- a/distro/common/man/man8/chef-solo.8 +++ b/distro/common/man/man8/chef-solo.8 @@ -67,11 +67,11 @@ The configuration file to use. .B \fB\-d\fP, \fB\-\-daemonize\fP Indicates that the executable will be run as a daemon. This option is only available on machines that run in UNIX or Linux environments. For machines that are running Microsoft Windows that require similar functionality, use the \fBchef\-client::service\fP recipe in the \fBchef\-client\fP cookbook: \fI\%http://community.opscode.com/cookbooks/chef-client\fP. This will install a chef\-client service under Microsoft Windows using the Windows Service Wrapper. .TP -.B \fB\-f\fP, \fB\-\-fork\fP -Indicates that a chef\-client run will be contained in a secondary process with dedicated RAM. When the chef\-client run is complete the RAM will be returned to the master process. This option helps ensure that a chef\-client will use a steady amount of RAM over time because the master process will not run recipes. This option will also help prevent memory leaks (such as those that can be introduced by the code contained within a poorly designed cookbook). +.B \fB\-f\fP, \fB\-\-[no\-]fork\fP +Indicates that a chef\-client run will be contained in a secondary process with dedicated RAM. When the chef\-client run is complete the RAM will be returned to the master process. This option helps ensure that a chef\-client will use a steady amount of RAM over time because the master process will not run recipes. This option will also help prevent memory leaks (such as those that can be introduced by the code contained within a poorly designed cookbook). Use \fB\-\-no\-fork\fP to disable running the chef\-client in fork node. Default value: \fB\-\-fork\fP. .TP -.B \fB\-F FORMATTER\fP, \fB\-\-format FORMATTER\fP -The output format. +.B \fB\-F FORMAT\fP, \fB\-\-format FORMAT\fP +The output format: \fBsummary\fP (default), \fBtext\fP, \fBjson\fP, \fByaml\fP, and \fBpp\fP. .TP .B \fB\-\-force\-formatter\fP Indicates that formatter output will be used instead of logger output. @@ -98,7 +98,7 @@ The level of logging that will be stored in a log file: \fBdebug\fP, \fBinfo\fP, The location in which log file output files will be saved. If this location is set to something other than \fBSTDOUT\fP, standard output logging will still be performed (otherwise there would be no output other than to a file). This is recommended when starting any executable as a daemon. .TP .B \fB\-\-[no\-]color\fP -Use \fB\-\-no\-color\fP to disable colored output. Default setting: \fB\-\-color\fP. +Indicates that color will not be used in the output. Default setting: \fB\-\-color\fP. .TP .B \fB\-N NODE_NAME\fP, \fB\-\-node\-name NODE_NAME\fP The name of the node. @@ -119,7 +119,7 @@ The user that owns a process. This is required when starting any executable as a The version of the chef\-client. .TP .B \fB\-W\fP, \fB\-\-why\-run\fP -Indicates that the executable will be run in whyrun mode, which is a chef\-client run that does everything except modify the system. Use whyrun mode to understand why the chef\-client makes the decisions that it makes and to learn more about the current and proposed state of the system. +Indicates that the executable will be run in why\-run mode, which is a type of chef\-client run that does everything except modify the system. Use why\-run mode to understand why the chef\-client makes the decisions that it makes and to learn more about the current and proposed state of the system. .UNINDENT .SH EXAMPLES .sp diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index 08403c7aa2..4c99e50b0e 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -105,6 +105,10 @@ class Chef end end + # Daemon class needs to have all the signal callbacks return + # before service_main returns. + Chef::Log.debug("Giving signal callbacks some time to exit...") + sleep 1 Chef::Log.debug("Exiting service...") end @@ -113,15 +117,27 @@ class Chef ################################################################################ def service_stop + run_warning_displayed = false Chef::Log.info("STOP request from operating system.") - if @service_action_mutex.try_lock - @service_signal.signal - @service_action_mutex.unlock - Chef::Log.info("Service is stopping....") - else - Chef::Log.info("Currently a chef-client run is happening.") - Chef::Log.info("Service will stop once it's completed.") + loop do + # See if a run is in flight + if @service_action_mutex.try_lock + # Run is not in flight. Wake up service_main to exit. + @service_signal.signal + @service_action_mutex.unlock + break + else + unless run_warning_displayed + Chef::Log.info("Currently a chef run is happening on this system.") + Chef::Log.info("Service will stop when run is completed.") + run_warning_displayed = true + end + + Chef::Log.debug("Waiting for chef-client run...") + sleep 1 + end end + Chef::Log.info("Service is stopping....") end def service_pause diff --git a/lib/chef/config.rb b/lib/chef/config.rb index f8148d939e..082c00c767 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -23,6 +23,7 @@ require 'chef/log' require 'chef/exceptions' require 'mixlib/config' require 'chef/util/selinux' +require 'pathname' class Chef class Config @@ -519,17 +520,13 @@ class Chef # "embedded" directory which contains all of the software packaged with # omnibus. This is used to locate the cacert.pem file on windows. def self.embedded_dir - find_embedded_dir_in(_this_file) - end - - def self.find_embedded_dir_in(path) - if File.basename(path) == "embedded" - path - elsif File.basename(path) == path - nil - else - find_embedded_dir_in(File.dirname(path)) + Pathname.new(_this_file).ascend do |path| + if path.basename.to_s == "embedded" + return path.to_s + end end + + nil end # Path to this file in the current install. diff --git a/lib/chef/knife/core/node_editor.rb b/lib/chef/knife/core/node_editor.rb index 7707743ce5..073492197c 100644 --- a/lib/chef/knife/core/node_editor.rb +++ b/lib/chef/knife/core/node_editor.rb @@ -18,6 +18,7 @@ require 'chef/json_compat' require 'chef/node' +require 'tempfile' class Chef class Knife @@ -35,11 +36,24 @@ class Chef abort "You specified the --disable_editing option, nothing to edit" if config[:disable_editing] assert_editor_set! - updated_node_data = edit_data(view) + updated_node_data = @ui.edit_data(view) apply_updates(updated_node_data) @updated_node end + def updated? + pristine_copy = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(node), :create_additions => false) + updated_copy = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@updated_node), :create_additions => false) + unless pristine_copy == updated_copy + updated_properties = %w{name normal chef_environment run_list default override automatic}.reject do |key| + pristine_copy[key] == updated_copy[key] + end + end + ( pristine_copy != updated_copy ) && updated_properties + end + + private + def view result = {} result["name"] = node.name @@ -52,12 +66,7 @@ class Chef result["override"] = node.override_attrs result["automatic"] = node.automatic_attrs end - Chef::JSONCompat.to_json_pretty(result) - end - - def edit_data(text) - edited_data = tempfile_for(text) {|filename| system("#{config[:editor]} #{filename}")} - Chef::JSONCompat.from_json(edited_data) + result end def apply_updates(updated_data) @@ -84,19 +93,6 @@ class Chef end end - def updated? - pristine_copy = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(node), :create_additions => false) - updated_copy = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@updated_node), :create_additions => false) - unless pristine_copy == updated_copy - updated_properties = %w{name normal chef_environment run_list default override automatic}.reject do |key| - pristine_copy[key] == updated_copy[key] - end - end - ( pristine_copy != updated_copy ) && updated_properties - end - - private - def abort(message) ui.error(message) exit 1 @@ -108,22 +104,6 @@ class Chef end end - def tempfile_for(data) - # TODO: include useful info like the node name in the temp file - # name - basename = "knife-edit-" << rand(1_000_000_000_000_000).to_s.rjust(15, '0') << '.json' - filename = File.join(Dir.tmpdir, basename) - File.open(filename, "w+") do |f| - f.sync = true - f.puts data - end - - yield filename - - IO.read(filename) - ensure - File.unlink(filename) - end end end end diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb index d0bdaa7ac0..dfa8c11644 100644 --- a/lib/chef/knife/core/ui.rb +++ b/lib/chef/knife/core/ui.rb @@ -21,6 +21,7 @@ require 'forwardable' require 'chef/platform/query_helpers' require 'chef/knife/core/generic_presenter' +require 'tempfile' class Chef class Knife @@ -165,19 +166,14 @@ class Chef output = Chef::JSONCompat.to_json_pretty(data) if (!config[:disable_editing]) - filename = "knife-edit-" - 0.upto(20) { filename += rand(9).to_s } - filename << ".json" - filename = File.join(Dir.tmpdir, filename) - tf = File.open(filename, "w") - tf.sync = true - tf.puts output - tf.close - raise "Please set EDITOR environment variable" unless system("#{config[:editor]} #{tf.path}") - tf = File.open(filename, "r") - output = tf.gets(nil) - tf.close - File.unlink(filename) + Tempfile.open([ 'knife-edit-', '.json' ]) do |tf| + tf.sync = true + tf.puts output + tf.close + raise "Please set EDITOR environment variable" unless system("#{config[:editor]} #{tf.path}") + + output = IO.read(tf.path) + end end parse_output ? Chef::JSONCompat.from_json(output) : output diff --git a/lib/chef/knife/edit.rb b/lib/chef/knife/edit.rb index 830da84a12..7408179ed0 100644 --- a/lib/chef/knife/edit.rb +++ b/lib/chef/knife/edit.rb @@ -51,10 +51,8 @@ class Chef def edit_text(text, extension) if (!config[:disable_editing]) - file = Tempfile.new([ 'knife-edit-', extension ]) - begin + Tempfile.open([ 'knife-edit-', extension ]) do |file| # Write the text to a temporary file - file.open file.write(text) file.close @@ -63,12 +61,9 @@ class Chef raise "Please set EDITOR environment variable" end - file.open - result_text = file.read - return result_text if result_text != text + result_text = IO.read(file.path) - ensure - file.close! + return result_text if result_text != text end end end diff --git a/lib/chef/win32/mutex.rb b/lib/chef/win32/mutex.rb index b0a9ba210e..0b7d99f111 100644 --- a/lib/chef/win32/mutex.rb +++ b/lib/chef/win32/mutex.rb @@ -22,25 +22,10 @@ class Chef module ReservedNames::Win32 class Mutex include Chef::ReservedNames::Win32::API::Synchronization - extend Chef::ReservedNames::Win32::API::Synchronization def initialize(name) @name = name - # First check if there exists a mutex in the system with the - # given name. - - # In the initial creation of the mutex initial_owner is set to - # false so that mutex will not be acquired until someone calls - # acquire. - # In order to call "*W" windows apis, strings needs to be - # encoded as wide strings. - @handle = CreateMutexW(nil, false, name.to_wstring) - - # Fail early if we can't get a handle to the named mutex - if @handle == 0 - Chef::Log.error("Failed to create system mutex with name'#{name}'") - Chef::ReservedNames::Win32::Error.raise! - end + create_system_mutex end attr_reader :handle @@ -57,17 +42,27 @@ class Chef ##################################################### # Attempts to grab the mutex and waits until it is acquired. def wait - wait_result = WaitForSingleObject(handle, INFINITE) - case wait_result - when WAIT_ABANDONED - # Previous owner of the mutex died before it can release the - # mutex. Log a warning and continue. - Chef::Log.debug "Existing owner of the mutex exited prematurely." - when WAIT_OBJECT_0 - # Mutex is successfully acquired. - else - Chef::Log.error("Failed to acquire system mutex '#{name}'. Return code: #{wait_result}") - Chef::ReservedNames::Win32::Error.raise! + loop do + wait_result = WaitForSingleObject(handle, 1000) + case wait_result + when WAIT_TIMEOUT + # We are periodically waking up in order to give ruby a + # chance to process any signal it got while we were + # sleeping. This condition shouldn't contain any logic + # other than sleeping. + sleep 0.1 + when WAIT_ABANDONED + # Previous owner of the mutex died before it can release the + # mutex. Log a warning and continue. + Chef::Log.debug "Existing owner of the mutex exited prematurely." + break + when WAIT_OBJECT_0 + # Mutex is successfully acquired. + break + else + Chef::Log.error("Failed to acquire system mutex '#{name}'. Return code: #{wait_result}") + Chef::ReservedNames::Win32::Error.raise! + end end end @@ -87,6 +82,34 @@ if the mutex is attempted to be acquired by other threads.") Chef::ReservedNames::Win32::Error.raise! end end + + private + + def create_system_mutex + # First check if there exists a mutex in the system with the + # given name. We need only synchronize rights if a mutex is + # already created. + # InheritHandle is set to true so that subprocesses can + # inherit the ownership of the mutex. + @handle = OpenMutexW(SYNCHRONIZE, true, name.to_wstring) + + if @handle == 0 + # Mutext doesn't exist so create one. + # In the initial creation of the mutex initial_owner is set to + # false so that mutex will not be acquired until someone calls + # acquire. + # In order to call "*W" windows apis, strings needs to be + # encoded as wide strings. + @handle = CreateMutexW(nil, false, name.to_wstring) + + # Looks like we can't create the mutex for some reason. + # Fail early. + if @handle == 0 + Chef::Log.error("Failed to create system mutex with name'#{name}'") + Chef::ReservedNames::Win32::Error.raise! + end + end + end end end end diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb new file mode 100644 index 0000000000..a342206161 --- /dev/null +++ b/spec/functional/version_spec.rb @@ -0,0 +1,35 @@ +# +# Author:: Serdar Sutay (<dan@opscode.com>) +# Copyright:: Copyright (c) 2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require File.expand_path('../../spec_helper', __FILE__) +require 'chef/mixin/shell_out' +require 'chef/version' +require 'ohai/version' + +describe "Chef Versions" do + include Chef::Mixin::ShellOut + let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..") } + + binaries = [ "chef-client", "chef-shell", "chef-apply", "knife", "chef-solo" ] + + binaries.each do |binary| + it "#{binary} version should be sane" do + shell_out!("ruby #{File.join("bin", binary)} -v", :cwd => chef_dir).stdout.chomp.should == "Chef: #{Chef::VERSION}" + end + end + +end diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index d428a3ea30..94d279c726 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -63,17 +63,17 @@ EOM # run_lock gets stuck we can discover it. lambda { Timeout.timeout(120) do - chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin") + chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..") # Instantiate the first chef-solo run - s1 = Process.spawn("chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \ + s1 = Process.spawn("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \ -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir) # Give it some time to progress sleep 1 # Instantiate the second chef-solo run - s2 = Process.spawn("chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \ + s2 = Process.spawn("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' \ -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir) Process.waitpid(s1) diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 3771b853a1..0a246037fb 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -183,8 +183,14 @@ describe Chef::Config do Chef::Config[:ssl_ca_path].should be_nil end - it "Chef::Config[:ssl_ca_file] defaults to nil" do - Chef::Config[:ssl_ca_file].should be_nil + describe "when on UNIX" do + before do + Chef::Config.stub(:on_windows?).and_return(false) + end + + it "Chef::Config[:ssl_ca_file] defaults to nil" do + Chef::Config[:ssl_ca_file].should be_nil + end end it "Chef::Config[:data_bag_path] defaults to /var/chef/data_bags" do diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb index 0b6978596a..18e88b6cde 100644 --- a/spec/unit/knife/core/ui_spec.rb +++ b/spec/unit/knife/core/ui_spec.rb @@ -28,6 +28,124 @@ describe Chef::Knife::UI do @ui = Chef::Knife::UI.new(@out, @err, @in, @config) end + describe "edit" do + ruby_for_json = { 'foo' => 'bar' } + json_from_ruby = "{\n \"foo\": \"bar\"\n}" + json_from_editor = "{\n \"bar\": \"foo\"\n}" + ruby_from_editor = { 'bar' => 'foo' } + my_editor = "veeeye" + temp_path = "/tmp/bar/baz" + + let(:subject) { @ui.edit_data(ruby_for_json, parse_output) } + let(:parse_output) { false } + + context "when editing is disabled" do + before do + @ui.config[:disable_editing] = true + stub_const("Tempfile", double) # Tempfiles should never be invoked + end + context "when parse_output is false" do + it "returns pretty json string" do + expect(subject).to eql(json_from_ruby) + end + end + context "when parse_output is true" do + let(:parse_output) { true } + it "returns a ruby object" do + expect(subject).to eql(ruby_for_json) + end + end + + end + + context "when editing is enabled" do + before do + @ui.config[:disable_editing] = false + @ui.config[:editor] = my_editor + @mock = mock('Tempfile') + @mock.should_receive(:sync=).with(true) + @mock.should_receive(:puts).with(json_from_ruby) + @mock.should_receive(:close) + @mock.should_receive(:path).at_least(:once).and_return(temp_path) + Tempfile.should_receive(:open).with([ 'knife-edit-', '.json' ]).and_yield(@mock) + end + context "and the editor works" do + before do + @ui.should_receive(:system).with("#{my_editor} #{temp_path}").and_return(true) + IO.should_receive(:read).with(temp_path).and_return(json_from_editor) + end + + context "when parse_output is false" do + it "returns an edited pretty json string" do + expect(subject).to eql(json_from_editor) + end + end + context "when parse_output is true" do + let(:parse_output) { true } + it "returns an edited ruby object" do + expect(subject).to eql(ruby_from_editor) + end + end + end + context "when running the editor fails with nil" do + before do + @ui.should_receive(:system).with("#{my_editor} #{temp_path}").and_return(nil) + IO.should_not_receive(:read) + end + it "throws an exception" do + expect{ subject }.to raise_error(RuntimeError) + end + end + context "when running the editor fails with false" do + before do + @ui.should_receive(:system).with("#{my_editor} #{temp_path}").and_return(false) + IO.should_not_receive(:read) + end + it "throws an exception" do + expect{ subject }.to raise_error(RuntimeError) + end + end + end + context "when editing and not stubbing Tempfile (semi-functional test)" do + before do + @ui.config[:disable_editing] = false + @ui.config[:editor] = my_editor + @tempfile = Tempfile.new([ 'knife-edit-', '.json' ]) + Tempfile.should_receive(:open).with([ 'knife-edit-', '.json' ]).and_yield(@tempfile) + end + + context "and the editor works" do + before do + @ui.should_receive(:system).with("#{my_editor} #{@tempfile.path}").and_return(true) + IO.should_receive(:read).with(@tempfile.path).and_return(json_from_editor) + end + + context "when parse_output is false" do + it "returns an edited pretty json string" do + expect(subject).to eql(json_from_editor) + end + it "the tempfile should have mode 0600", :unix_only do + # XXX: this looks odd because we're really testing Tempfile.new here + expect(File.stat(@tempfile.path).mode & 0777).to eql(0600) + expect(subject).to eql(json_from_editor) + end + end + + context "when parse_output is true" do + let(:parse_output) { true } + it "returns an edited ruby object" do + expect(subject).to eql(ruby_from_editor) + end + it "the tempfile should have mode 0600", :unix_only do + # XXX: this looks odd because we're really testing Tempfile.new here + expect(File.stat(@tempfile.path).mode & 0777).to eql(0600) + expect(subject).to eql(ruby_from_editor) + end + end + end + end + end + describe "format_list_for_display" do it "should print the full hash if --with-uri is true" do @ui.config[:with_uri] = true diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb index e8f6937a31..7fbd8192d1 100644 --- a/spec/unit/knife/node_edit_spec.rb +++ b/spec/unit/knife/node_edit_spec.rb @@ -20,6 +20,12 @@ require 'spec_helper' Chef::Knife::NodeEdit.load_deps describe Chef::Knife::NodeEdit do + + # helper to convert the view from Chef objects into Ruby objects representing JSON + def deserialized_json_view + actual = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json_pretty(@knife.node_editor.send(:view))) + end + before(:each) do Chef::Config[:node_name] = "webmonkey.example.com" @knife = Chef::Knife::NodeEdit.new @@ -49,7 +55,7 @@ describe Chef::Knife::NodeEdit do end it "creates a view of the node without attributes from roles or ohai" do - actual = Chef::JSONCompat.from_json(@knife.node_editor.view) + actual = deserialized_json_view actual.should_not have_key("automatic") actual.should_not have_key("override") actual.should_not have_key("default") @@ -61,7 +67,7 @@ describe Chef::Knife::NodeEdit do it "shows the extra attributes when given the --all option" do @knife.config[:all_attributes] = true - actual = Chef::JSONCompat.from_json(@knife.node_editor.view) + actual = deserialized_json_view actual["automatic"].should == {"go" => "away"} actual["override"].should == {"dont" => "show"} actual["default"].should == {"hide" => "me"} @@ -71,18 +77,39 @@ describe Chef::Knife::NodeEdit do end it "does not consider unedited data updated" do - view = Chef::JSONCompat.from_json( @knife.node_editor.view ) - @knife.node_editor.apply_updates(view) + view = deserialized_json_view + @knife.node_editor.send(:apply_updates, view) @knife.node_editor.should_not be_updated end it "considers edited data updated" do - view = Chef::JSONCompat.from_json( @knife.node_editor.view ) + view = deserialized_json_view view["run_list"] << "role[fuuu]" - @knife.node_editor.apply_updates(view) + @knife.node_editor.send(:apply_updates, view) @knife.node_editor.should be_updated end end + + describe "edit_node" do + + before do + @knife.stub!(:node).and_return(@node) + end + + let(:subject) { @knife.node_editor.edit_node } + + it "raises an exception when editing is disabled" do + @knife.config[:disable_editing] = true + expect{ subject }.to raise_error(SystemExit) + end + + it "raises an exception when the editor is not set" do + @knife.config[:editor] = nil + expect{ subject }.to raise_error(SystemExit) + end + + end + end diff --git a/spec/unit/util/diff_spec.rb b/spec/unit/util/diff_spec.rb index 0e3bc0a0d7..947ce1d5aa 100644 --- a/spec/unit/util/diff_spec.rb +++ b/spec/unit/util/diff_spec.rb @@ -20,24 +20,17 @@ require 'spec_helper' require 'tmpdir' -describe Chef::Util::Diff, :uses_diff => true do +shared_context "using file paths with spaces" do + let!(:old_tempfile) { Tempfile.new("chef-util diff-spec") } + let!(:new_tempfile) { Tempfile.new("chef-util diff-spec") } +end + +shared_context "using file paths without spaces" do let!(:old_tempfile) { Tempfile.new("chef-util-diff-spec") } let!(:new_tempfile) { Tempfile.new("chef-util-diff-spec") } - let!(:old_file) { old_tempfile.path } - let!(:new_file) { new_tempfile.path } - - let(:plain_ascii) { "This is a text file.\nWith more than one line.\nAnd a \tTab.\nAnd lets make sure that other printable chars work too: ~!@\#$%^&*()`:\"<>?{}|_+,./;'[]\\-=\n" } - # these are all byte sequences that are illegal in the other encodings... (but they may legally transcode) - let(:utf_8) { "testing utf-8 unicode...\n\n\non a new line: \xE2\x80\x93\n" } # unicode em-dash - let(:latin_1) { "It is more metal.\nif you have an \xFDmlaut.\n" } # NB: changed to y-with-diaresis, but i'm American so I don't know the difference - let(:shift_jis) { "I have no idea what this character is:\n \x83\x80.\n" } # seriously, no clue, but \x80 is nice and illegal in other encodings - - let(:differ) do # subject - differ = Chef::Util::Diff.new - differ.diff(old_file, new_file) - differ - end +end +shared_examples_for "a diff util" do it "should return a Chef::Util::Diff" do expect(differ).to be_a_kind_of(Chef::Util::Diff) end @@ -554,4 +547,33 @@ describe Chef::Util::Diff, :uses_diff => true do end +describe Chef::Util::Diff, :uses_diff => true do + let!(:old_file) { old_tempfile.path } + let!(:new_file) { new_tempfile.path } + + let(:plain_ascii) { "This is a text file.\nWith more than one line.\nAnd a \tTab.\nAnd lets make sure that other printable chars work too: ~!@\#$%^&*()`:\"<>?{}|_+,./;'[]\\-=\n" } + # these are all byte sequences that are illegal in the other encodings... (but they may legally transcode) + let(:utf_8) { "testing utf-8 unicode...\n\n\non a new line: \xE2\x80\x93\n" } # unicode em-dash + let(:latin_1) { "It is more metal.\nif you have an \xFDmlaut.\n" } # NB: changed to y-with-diaresis, but i'm American so I don't know the difference + let(:shift_jis) { "I have no idea what this character is:\n \x83\x80.\n" } # seriously, no clue, but \x80 is nice and illegal in other encodings + + let(:differ) do # subject + differ = Chef::Util::Diff.new + differ.diff(old_file, new_file) + differ + end + + describe "when file path has spaces" do + include_context "using file paths with spaces" + + it_behaves_like "a diff util" + end + + + describe "when file path doesn't have spaces" do + include_context "using file paths without spaces" + + it_behaves_like "a diff util" + end +end |