summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Danna <steve@opscode.com>2015-03-04 11:30:14 +0000
committerSteven Danna <steve@opscode.com>2015-03-04 11:30:14 +0000
commit0bb2861228fd33fd6a4ef296a1dd223abb6dec9f (patch)
treeb8d832eb826f7d42f203996622e7391c3499f9a5
parent8ef1fa7f78c43472c5bbe4b2a5c7ff69f36d9c28 (diff)
parent0e8630d65a859332f9b580e0d10295c2f40b86ef (diff)
downloadchef-0bb2861228fd33fd6a4ef296a1dd223abb6dec9f.tar.gz
Merge branch 'ryan/knife_ssh_on_error'
-rw-r--r--CHANGELOG.md2
-rw-r--r--DOC_CHANGES.md80
-rw-r--r--lib/chef/knife/ssh.rb7
3 files changed, 13 insertions, 76 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e44ceffa4..dd0615b080 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
* mixin the LWRP attribute DSL method into Chef::Resource directly
* make all LWRP attributes nillable
* windows service now has a configurable timeout
+* `knife ssh` now has an --exit-on-error option that allows users to
+ fail-fast rather than moving on to the next machine.
## 12.1.0
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index f824d2da30..41d70fac61 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -7,79 +7,7 @@ Description of the required change.
-->
-### File-like resources now accept a `verify` attribute
-
-The file, template, cookbook_file, and remote_file resources now all
-accept a `verify` attribute. This file accepts a string or a block,
-similar to `only_if`. A full specification can be found in RFC 027:
-
-https://github.com/opscode/chef-rfc/blob/master/rfc027-file-content-verification.md
-
-### Chef now handles URI Schemes in a case insensitive manner
-
-Previously, when a URI scheme contained all uppercase letters, Chef would reject the URI as invalid. In compliance with RFC3986, Chef now treats URI schemes in a case insensitive manner. This applies to all resources which accept URIs such as remote_file etc.
-
-### Experimental Audit Mode Feature
-
-There is a new command_line flag provided for `chef-client`: `--audit-mode`. This accepts 1 of 3 arguments:
-
-* `disabled` (default) - Audits are disabled and the phase is skipped. This is the default while Audit mode is an
-experimental feature.
-* `enabled` - Audits are enabled and will be performed after the converge phase.
-* `audit-only` - Audits are enabled and convergence is disabled. Only audits will be performed.
-
-This can also be configured in your node's client.rb with the key `audit_mode` and a value of `:disabled`, `:enabled` or `:audit_only`.
-
-### Chef Why Run Mode Ignores Audit Phase
-
-Because most users enable `why_run` mode to determine what resources convergence will update on their system, the audit
-phase is not executed. There is no way to get both `why_run` output and audit output in 1 single command. To get
-audit output without performing convergence use the `--audit-mode` flag.
-
-#### Editors note 1
-
-The `--audit-mode` flag should be a link to the documentation for that flag
-
-#### Editors node 2
-
-This probably only needs to be a bullet point added to http://docs.getchef.com/nodes.html#about-why-run-mode under the
-`certain assumptions` section
-
-## Drop SSL Warnings
-Now that the default for SSL checking is on, no more warning is emitted when SSL
-checking is off.
-
-## Multi-package Support
-The `package` provider has been extended to support multiple packages. This
-support is new and and not all subproviders yet support it. Full support for
-`apt` and `yum` has been implemented.
-
-## Add compile_time option to chef_gem
-
-This option defaults to true, which is deprecated, and setting this to false
-will stop chef_gem from automatically installing at compile_time. False is
-the recommended setting as long as the gem is only used in provider code (a
-best practice) and not used directly in recipe code.
-
-## Yum Package provider now supports version requirements
-
-A documented feature of the yum_package provider was the ability to specify a version requirement such as ` = 1.0.1.el5` in the resource name.
-However, this did not actually work. It has now been fixed, and additionally version requirements are now supported in the `version` attribute
-of yum_package as well.
-
-## Validatorless bootstraps
-
-Validation keys are now optional. If the validation key is simply deleted and does not exist, then knife bootstrap will use the
-user's key to create a client for the node and create the node object and bootstrap the host. Validation keys can continue to be
-used, particularly for autoscaling, but even for that use case a dedicated user for autoscaling would be preferable to the shared
-validation key.
-
-## Bootstrap will create chef-vault items
-
-The --bootstrap-vault-item, --bootstrap-vault-json, and --bootstrap-vault-file arguments have been added to knife bootstrap providing
-three alternative ways to set chef vault items when bootstrapping a host.
-
-## Windows service now has a configurable timeout
-
-You can now set the amount of time a chef-client run is allowed when running the provided windows service. This can be configured by
-setting `windows_service.watchdog_timeout` in your `client.rb` to the number of seconds desired. The default value is 2 hours.
+### knife ssh has --exit-on-error option
+`knife ssh` now has an --exit-on-error option that will cause it to
+fail immediately in the face of an SSH connection error. The default
+behavior is move on to the next node.
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 4569cc097e..db0fb7dd41 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -103,6 +103,13 @@ class Chef
:boolean => true,
:default => true
+ option :on_error,
+ :short => '-e',
+ :long => '--exit-on-error',
+ :description => "Immediately exit if an error is encountered",
+ :boolean => true,
+ :proc => Proc.new { :raise }
+
def session
config[:on_error] ||= :skip
ssh_error_handler = Proc.new do |server|