Troubleshooting powershell_script resource


#1

Hi All,

I have been working on writing a new recipe that makes use of powershell_script resource. I had some syntax error in the script code but it was not pointed out by chef-client run. Rather, the chef-client run would say that the resource ran successfully. Though I was able to find out the syntax error later but I was wondering if there is a better way to troubleshoot syntax errors in powershell_script resource. I tried running chef-client with -l debug switch but that gave not much information either.

I have seen similar behavior with the use of quotation marks and I had to escape those with “” to make it work.

Thanks

-Kapil


This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.


#2

You might consider using the convert_boolean_return parameter to
actually raise an error if the Powershell script fails.

http://docs.opscode.com/resource_powershell_script.html

  • Julian

On Tue, Jun 17, 2014 at 1:28 PM, Kapil Shardha
Kapil.Shardha@simulationiq.com wrote:

Hi All,

I have been working on writing a new recipe that makes use of
powershell_script resource. I had some syntax error in the script code but
it was not pointed out by chef-client run. Rather, the chef-client run would
say that the resource ran successfully. Though I was able to find out the
syntax error later but I was wondering if there is a better way to
troubleshoot syntax errors in powershell_script resource. I tried running
chef-client with –l debug switch but that gave not much information either.

I have seen similar behavior with the use of quotation marks and I had to
escape those with “\” to make it work.

Thanks

-Kapil


This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of Education
Management Solutions, Inc. If you are not the intended recipient, please
immediately advise the sender by reply email & delete the message & any
attachments without using, copying or disclosing the contents. Thank you.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#3

Thanks Julian! I will look into it. Looks like it was added in the newer version of chef-client.

In general, it will be great for chef documentation to add information regarding relevant chef version. That way, it will be much more clear.

Thanks

-Kapil

-----Original Message-----
From: Julian C. Dunn [mailto:jdunn@aquezada.com]
Sent: Wednesday, June 18, 2014 2:40 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Troubleshooting powershell_script resource

You might consider using the convert_boolean_return parameter to actually raise an error if the Powershell script fails.

http://docs.opscode.com/resource_powershell_script.html

  • Julian

On Tue, Jun 17, 2014 at 1:28 PM, Kapil Shardha Kapil.Shardha@simulationiq.com wrote:

Hi All,

I have been working on writing a new recipe that makes use of
powershell_script resource. I had some syntax error in the script code
but it was not pointed out by chef-client run. Rather, the chef-client
run would say that the resource ran successfully. Though I was able to
find out the syntax error later but I was wondering if there is a
better way to troubleshoot syntax errors in powershell_script
resource. I tried running chef-client with –l debug switch but that gave not much information either.

I have seen similar behavior with the use of quotation marks and I had
to escape those with “\” to make it work.

Thanks

-Kapil


This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of
Education Management Solutions, Inc. If you are not the intended
recipient, please immediately advise the sender by reply email &
delete the message & any attachments without using, copying or disclosing the contents. Thank you.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#4

Yes, I know. You can view docsets for older versions of Chef Client
here: http://docs.opscode.com/releases.html

It’s buried from the homepage (default doc set is all about current
version of Chef Client). We’re looking into ways to improve that
navigation so you can find it more easily. (heads up James Scott)

  • Julian

On Wed, Jun 18, 2014 at 6:44 AM, Kapil Shardha
Kapil.Shardha@simulationiq.com wrote:

Thanks Julian! I will look into it. Looks like it was added in the newer version of chef-client.

In general, it will be great for chef documentation to add information regarding relevant chef version. That way, it will be much more clear.

Thanks

-Kapil

-----Original Message-----
From: Julian C. Dunn [mailto:jdunn@aquezada.com]
Sent: Wednesday, June 18, 2014 2:40 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Troubleshooting powershell_script resource

You might consider using the convert_boolean_return parameter to actually raise an error if the Powershell script fails.

http://docs.opscode.com/resource_powershell_script.html

  • Julian

On Tue, Jun 17, 2014 at 1:28 PM, Kapil Shardha Kapil.Shardha@simulationiq.com wrote:

Hi All,

I have been working on writing a new recipe that makes use of
powershell_script resource. I had some syntax error in the script code
but it was not pointed out by chef-client run. Rather, the chef-client
run would say that the resource ran successfully. Though I was able to
find out the syntax error later but I was wondering if there is a
better way to troubleshoot syntax errors in powershell_script
resource. I tried running chef-client with –l debug switch but that gave not much information either.

I have seen similar behavior with the use of quotation marks and I had
to escape those with “\” to make it work.

Thanks

-Kapil


This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of
Education Management Solutions, Inc. If you are not the intended
recipient, please immediately advise the sender by reply email &
delete the message & any attachments without using, copying or disclosing the contents. Thank you.


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]