You are here

function get_wip_task_status in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 acsf_init/lib/cloud_hooks/common/pre-web-activate/000-acquia-deployment.php \get_wip_task_status()

Requests status of a particular wip task.

Parameters

string $site: The hosting site group name.

string $env: The hosting environment name.

int $task_id: The Wip task id.

Return value

SimpleRestResponse The response.

1 call to get_wip_task_status()
main in acsf_init/lib/cloud_hooks/common/pre-web-activate/000-acquia-deployment.php
The entry point into the script.

File

acsf_init/lib/cloud_hooks/common/pre-web-activate/000-acquia-deployment.php, line 253
This script is responsible for deploying theme files on each webnode.

Code

function get_wip_task_status($site, $env, $task_id) {
  $endpoint = sprintf('site-api/v1/wip/task/%s/status', $task_id);
  try {
    $parameters = [];
    $creds = get_shared_creds($site, $env);
    $message = new SimpleRestMessage($site, $env);
    $response = $message
      ->send('GET', $endpoint, $parameters, $creds);
  } catch (Exception $e) {
    $error_message = sprintf('Wip task status failed with error: %s', $e
      ->getMessage());
    $file = __FILE__;
    syslog(LOG_ERR, "Error in cloud hook pre-web-activate/{$file}: {$error_message}");
    $response = new SimpleRestResponse($endpoint, 500, [
      'message' => $error_message,
    ]);
  }
  return $response;
}