You are here

function get_shared_creds 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_shared_creds()

Returns the shared credentials.

Parameters

string $site: The hosting sitegroup name.

string $env: The hosting environment name.

Return value

SimpleRestCreds The credentials.

Throws

Exception If the credentials cannot be read for any reason.

2 calls to get_shared_creds()
get_wip_task_status in acsf_init/lib/cloud_hooks/common/pre-web-activate/000-acquia-deployment.php
Requests status of a particular wip task.
request_theme_files in acsf_init/lib/cloud_hooks/common/pre-web-activate/000-acquia-deployment.php
Sends the request to deploy themes on the specified webnode.

File

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

Code

function get_shared_creds($site, $env) {
  $path = sprintf('/mnt/files/%s.%s/nobackup', $site, $env);
  $shared = sprintf('%s/sf_shared_creds.ini', $path);
  if (file_exists($shared)) {
    $data = parse_ini_file($shared, TRUE);
    if (!empty($data) && !empty($data['gardener'])) {
      return new SimpleRestCreds($data['gardener']['username'], $data['gardener']['password'], $data['gardener']['url']);
    }
  }
  throw new Exception(sprintf('Unable to read credentials from %s', $shared));
}