summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DOC_CHANGES.md32
-rw-r--r--RELEASE_NOTES.md26
2 files changed, 43 insertions, 15 deletions
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index 1657d86f3f..f29d6ab132 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -179,12 +179,14 @@ end
* returns - Return codes that signal a successful installation. Defaults to 0.
### New resource attribute: `guard_interpreter`
-Resources have a new attribute, `guard_interpreter`, which specifies a
-Chef script resource's that should be used to evaluate a
-string passed to a guard. Any attributes for that resource may be specified in
+All resources have a new attribute, `guard_interpreter`, which specifies a
+Chef script resource that should be used to evaluate a string command
+passed to a guard. Any attributes of the evaluating resource may be specified in
the options that normally follow the guard's command string argument. For example:
- # Use a guard command that is valid for bash but not for csh
+ # Tell Chef to use bash to interpret the guard string.
+ # Then we can use a guard command that is valid for bash
+ # but not for csh for instance
bash 'backupsettings' do
guard_interpreter :bash
code 'cp ~/appsettings.json ~/backup/appsettings.json'
@@ -198,32 +200,32 @@ The argument for `guard_interpreter` may be set to any of the following values:
the guard command argument, it is simply executed by the default shell as in
previous releases of Chef.
-By default, guard_interpreter is set to `:default` in this release.
+By default, `guard_interpreter` is set to `:default` in this release.
#### Attribute inheritance with `guard_interpreter`
-When `guard_interpreter` is used, the resource that evaluates the command will
+When `guard_interpreter` is not set to `:default`, the resource that evaluates the command will
also inherit certain attribute values from the resource that contains the
guard.
Inherited attributes for all `script` resources are:
-* :cwd
-* :environment
-* :group
-* :path
-* :user
-* :umask
+* `:cwd`
+* `:environment`
+* `:group`
+* `:path`
+* `:user`
+* `:umask`
For the `powershell_script` resource, the following attribute is inherited:
-* :architecture
+* `:architecture`
Inherited attributes may be overridden by specifying the same attribute as an
argument to the guard itself.
#### Guard inheritance example
-In the following example, the :environment hash only needs to be set once
+In the following example, the `:environment` hash only needs to be set once
since the `bash` resource that execute the guard will inherit the same value:
script "javatooling" do
@@ -248,7 +250,7 @@ following two fragments will run successfully without error:
code '$true'
end
-When `convert_boolean_return` is set to `true`, the "true" case above will
+But when `convert_boolean_return` is set to `true`, the "true" case above will
still succeed, but the false case will raise an exception:
# Raises an exception
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 355733af38..a4796c3e5a 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -133,6 +133,32 @@ If you're an advanced user of attribute precedence, you may find some attributes
The weekday attribute now accepts the weekday as a symbol, e.g. :monday or :thursday.
There is a new attribute named ```time``` that takes special cron time values as a symbol, such as :reboot or :monthly.
+#### `guard_interpreter` attribute
+
+All Chef resources now support the `guard_interpreter` attribute, which
+enables you to use a Chef `script` such as `bash`, `powershell_script`,
+`perl`, etc., to evaluate the string command passed to a
+guard (i.e. `not_if` or `only_if` attribute). This addresses the related ticket
+[CHEF-4553](https://tickets.opscode.com/browse/CHEF-4453) which is concerned
+with the usability of the `powershell_script` resource, but also benefits
+users of resources like `python`, `bash`, etc:
+
+ # See CHEF-4553 -- let powershell_script execute the guard
+ powershell_script 'make_logshare' do
+ guard_interpreter :powershell_script
+ code 'new-smbshare logshare $env:systemdrive\\logs'
+ not_if 'get-smbshare logshare'
+ end
+
+#### `convert_boolean_return` attribute for `powershell_script`
+
+When set to `true`, the `convert_boolean_return` attribute will allow any script executed by
+`powershell_script` that exits with a PowerShell boolean data type to convert
+PowerShell boolean `$true` to exit status 0 and `$false` to exit status 1.
+
+The new attribute defaults to `false` except when the `powershell_script` resource is executing script passed to a guard attribute
+via the `guard_interpreter` attribute in which case it is `true` by default.
+
#### knife bootstrap log_level
Running ```knife bootstrap -V -V``` will run the initial chef-client with a log level of debug.