[chef] Re: Catch (return -1) in a batch script


Chronological Thread 
  • From: Aimelyne Mochiron < >
  • To:
  • Subject: [chef] Re: Catch (return -1) in a batch script
  • Date: Wed, 10 Sep 2014 12:46:58 +0300

Hi Carlos,

You can use the 'returns' resource attribute for this; you can pass it either a single return value, or an array; see here:


HTH,

am

On 10 Sep 2014, at 12:26, Carlos Camacho < "> > wrote:

Hello, im executing a Chef batch script and im receiving -1 as the command output. In my case this is an expected output.

Is there a way to catch the error from the script and accept it, so the recipe wont fail?


This is the command output:
STDERR: The IIS Web Site was extended with Windows SharePoint Services, but the following error occurs in creating the default site "http://xxx:8080/". Please correct the input and try to create the default site again. Error: Another site already exists at http://xxx:8080. Delete this site before attempting to create a new site with the same URL, choose a new URL, or create a new inclusion at the path you originally specified.


The chef-client output:
---- End output of "cmd.exe" /c "C:/Users/CARLOS~1.CAM/AppData/Local/Temp/2/chef-script20140910-3376-a8uhvi.bat" ----
Ran "cmd.exe" /c "C:/Users/CARLOS~1.CAM/AppData/Local/Temp/2/chef-script20140910-3376-a8uhvi.bat" returned -1


Cheers,








Archive powered by MHonArc 2.6.16.

§