You are here

function request_theme_files in Acquia Cloud Site Factory Connector 8.2

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

Sends the request to deploy themes on the specified webnode.

Parameters

string $site: The hosting site group name.

string $env: The hosting environment name.

string $webnode: The fully qualified webnode name.

Return value

SimpleRestResponse The response.

1 call to request_theme_files()
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 220
This script is responsible for deploying theme files on each webnode.

Code

function request_theme_files($site, $env, $webnode) {
  $endpoint = 'site-api/v1/theme/deploy';
  try {
    $parameters = [
      'sitegroup' => $site,
      'webnode' => $webnode,
      'environment' => $env,
    ];
    $creds = get_shared_creds($site, $env);
    $message = new SimpleRestMessage($site, $env);
    $response = $message
      ->send('POST', $endpoint, $parameters, $creds);
  } catch (Exception $e) {
    $error_message = sprintf('Theme deploy failed with error: %s', $e
      ->getMessage());
    syslog(LOG_ERR, $error_message);
    $response = new SimpleRestResponse($endpoint, 500, [
      'message' => $error_message,
    ]);
  }
  return $response;
}