ServerMania logo

Get the List of Recipe Steps

To get the list of recipe steps, use the following request:

GET /recipes/:recipe_id/recipe_steps.xml
GET /recipes/:recipe_id/recipe_steps.json

XML Request Example

curl -i -X GET -u user:userpass http://test/recipes/1/recipe_steps.xml -H 'Accept: application/xml' -H 'Content-type: application/xml'

JSON Request Example

curl -i -X GET -u user:userpass http://test/recipes/1/recipe_steps.json -H 'Accept: application/json' -H 'Content-type: application/json'

XML Output Example

<recipe>
  <compatible_with>unix</compatible_with>
  <created_at type="datetime">2013-04-19T10:26:41+03:00</created_at>
  <description>Apache example</description>
  <id type="integer">1</id>
  <label>Apache example</label>
  <script_type>bat</script_type>
  <updated_at type="datetime">2013-05-13T13:08:00+03:00</updated_at>
  <user_id type="integer">6</user_id>
  <recipe_steps type="array">
    <recipe_step>
      <created_at type="datetime">2013-04-19T10:29:50+03:00</created_at>
      <fail_anything_else type="boolean">true</fail_anything_else>
      <fail_values></fail_values>
      <failure_goto_step nil="true"/>
      <id type="integer">1</id>
      <number type="integer">1</number>
      <on_failure>fail</on_failure>
      <on_success>proceed</on_success>
      <pass_anything_else type="boolean">false</pass_anything_else>
      <pass_values>0</pass_values>
      <recipe_id type="integer">1</recipe_id>
      <result_source>exit_code</result_source>
      <script>#if echo $OPERATING_SYSTEM_DISTRO |grep rhel ; then
  if rpm -qa |grep httpd |grep -v grep ; then
    yum -y update httpd
  else
    yum -y install httpd
  fi
#else
 # exit 1
#fi</script>
      <success_goto_step nil="true"/>
      <updated_at type="datetime">2013-04-26T12:37:28+03:00</updated_at>
    </recipe_step>
    <recipe_step>
      <created_at type="datetime">2013-04-23T13:54:02+03:00</created_at>
      <fail_anything_else type="boolean">true</fail_anything_else>
      <fail_values></fail_values>
      <failure_goto_step type="integer">4</failure_goto_step>
      <id type="integer">2</id>
      <number type="integer">2</number>
      <on_failure>goto_step</on_failure>
      <on_success>goto_step</on_success>
      <pass_anything_else type="boolean">false</pass_anything_else>
      <pass_values>0</pass_values>
      <recipe_id type="integer">1</recipe_id>
      <result_source>exit_code</result_source>
      <script>echo "&lt;p&gt;&lt;a href=http://$CP_ADDRESS&gt; Cloud&lt;/a&gt;&lt;/p&gt;" &gt; /var/www/html/index.html</script>
      <success_goto_step type="integer">5</success_goto_step>
      <updated_at type="datetime">2013-04-26T13:03:26+03:00</updated_at>
    </recipe_step>
    <recipe_step>
      <created_at type="datetime">2013-04-26T11:42:58+03:00</created_at>
      <fail_anything_else type="boolean">true</fail_anything_else>
      <fail_values></fail_values>
      <failure_goto_step nil="true"/>
      <id type="integer">19</id>
      <number type="integer">3</number>
      <on_failure>fail</on_failure>
      <on_success>stop</on_success>
      <pass_anything_else type="boolean">false</pass_anything_else>
      <pass_values>0</pass_values>
      <recipe_id type="integer">1</recipe_id>
      <result_source>exit_code</result_source>
      <script>service httpd restart</script>
      <success_goto_step nil="true"/>
      <updated_at type="datetime">2013-04-26T11:42:58+03:00</updated_at>
    </recipe_step>
    <recipe_step>
      <created_at type="datetime">2013-04-26T11:44:05+03:00</created_at>
      <fail_anything_else type="boolean">true</fail_anything_else>
      <fail_values></fail_values>
      <failure_goto_step nil="true"/>
      <id type="integer">20</id>
      <number type="integer">4</number>
      <on_failure>fail</on_failure>
      <on_success>stop</on_success>
      <pass_anything_else type="boolean">false</pass_anything_else>
      <pass_values>0</pass_values>
      <recipe_id type="integer">1</recipe_id>
      <result_source>exit_code</result_source>
      <script>echo "Can not write to file" &gt; /var/log/recipes.log</script>
      <success_goto_step nil="true"/>
      <updated_at type="datetime">2013-04-26T12:38:51+03:00</updated_at>
    </recipe_step>
    <recipe_step>
      <created_at type="datetime">2013-04-26T11:52:53+03:00</created_at>
      <fail_anything_else type="boolean">true</fail_anything_else>
      <fail_values></fail_values>
      <failure_goto_step type="integer">4</failure_goto_step>
      <id type="integer">21</id>
      <number type="integer">5</number>
      <on_failure>goto_step</on_failure>
      <on_success>goto_step</on_success>
      <pass_anything_else type="boolean">false</pass_anything_else>
      <pass_values>0</pass_values>
      <recipe_id type="integer">1</recipe_id>
      <result_source>exit_code</result_source>
      <script>echo "&lt;p&gt;&lt;a href=http://$IP_ADDRESS&gt;$HOSTNAME&lt;/a&gt;&lt;/p&gt;" &gt;&gt; /var/www/html/index.html</script>
      <success_goto_step type="integer">3</success_goto_step>
      <updated_at type="datetime">2013-04-26T12:45:56+03:00</updated_at>
    </recipe_step>
  </recipe_steps>
</recipe>


Where:

compatible_with - recipe compatibility: windows or unix

created_at — the date when the recipe was created in the [YYYY][MM][DD]T[hh][mm][ss]Z format

description - recipe description

id - recipe ID

label - recipe label

script_type - script type for Windows-compatible recipes:

  • bat 
  • vbs 
  • powershell (PowerShell v1.0)

updated_at — the date when the recipe was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format

use_on_hv_zones - true, if the recipe can be used on compute zones, otherwise false

use_on_vms - true, if the recipe can be used on virtual servers, otherwise false

user_id — the ID of a recipe owner

recipe_steps - an array of recipe steps with the following details:

  • created_at — the date when the step was created in the [YYYY][MM][DD]T[hh][mm][ss]Z format

  • updated_at — the date when the step was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format

  • fail_anything_else - set true, if you have specified the recipe pass value, otherwise set false

    You can only specify behavior for one scenario: for example, if the fail_anything_else = false, pass_anything_else must be set to true.
  • fail_values - recipe fail value

  • failure_goto_step - if the on_failure parameter = goto_step, specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • id - step ID

  • number - step number

  • on_failure - step behavior in case of failure:

    • proceed - proceed to the next step.
    • fail - terminate the recipe and mark it as failed.
    • stop - terminate the recipe and mark it as successful.
    • go_to_step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • on_success - step behavior in case of success:

    • proceed - proceed to the next step.
    • fail - terminate the recipe and mark it as failed.
    • stop - terminate the recipe and mark it as successful.
    • go_to_step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  • pass_anything_else -  set true, if you have specified the recipe fail value, otherwise set false

  • pass_values - recipe pass value

  • recipe_id - ID of a recipe the step belongs to

  • result_source - step result source:

    • exit_code - an exit status, e.g. 0 will be returned on success

    • std_out - standard output
    • std_err - standard error
    • std_out_and_std_err - standard output and standard error
  • success_goto_step - if the on_success parameter = goto_step, specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.