Is a Chef Resource that returns a boolean value?

I work with Chef on Windows node and find myself writing a lot of Chef guards for the powershell_script resource. I was wondering if there was a Chef resource that returned a boolean value that I could use here.
Thank you,
David Williams


CONFIDENTIALITY NOTICE: This electronic mail may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic mail or its contents by persons other than the intended recipient(s) is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail so that we may correct our internal records. Please then delete the original message. Thank you.

David, I have a branch in progress that adds this feature to
powershell_script (if I understand you correctly). See the doc at
https://github.com/opscode/chef-rfc/blob/adamed/resource-guard/rfc0001-resource-guard.md--
it has a link to a branch.

Is this the behavior you’d like to see?

# What if guards evaluated powershell script code that powershell

# evaluates as a boolean type as the actual boolean value of the guard

# itself? You can avoid extra script code to translate the boolean into

# a process exit code that results in the right true / false behavior

# for the guard

powershell_script "set execution policy" do

  code "set-executionpolicy remotesigned"

  not_if "(get-executionpolicy) -eq 'remotesigned'" # Like I barely

left Ruby – wow!

end

The current workaround for the example above is to use an expression like

powershell -command “exit int32 -eq
’remotesigned’)”

in the not_if above. It basically forces the script to convert a Boolean
data type to an integer that is then returned as the process exit code,
which is interpreted by Chef as a Boolean value.

-Adam

-----Original Message-----
From: David A. Williams [mailto:dwilliams@daxko.com]
Sent: Thursday, February 6, 2014 7:36 PM
To: Chef users
Subject: [chef] Is a Chef Resource that returns a boolean value?

I work with Chef on Windows node and find myself writing a lot of Chef
guards for the powershell_script resource. I was wondering if there was a
Chef resource that returned a boolean value that I could use here.

Thank you,

David Williams


CONFIDENTIALITY NOTICE: This electronic mail may contain information that
is privileged, confidential, and/or otherwise protected from disclosure to
anyone other than its intended recipient(s). Any dissemination or use of
this electronic mail or its contents by persons other than the intended
recipient(s) is strictly prohibited. If you have received this
communication in error, please notify the sender immediately by reply
e-mail so that we may correct our internal records. Please then delete the
original message. Thank you.